mirror of https://github.com/tidwall/tile38.git
Hang on to lower command
This commit is contained in:
parent
545e9316b0
commit
3bf91077d9
|
@ -656,7 +656,7 @@ func (server *Server) netServe() error {
|
||||||
server.flushAOF()
|
server.flushAOF()
|
||||||
}()
|
}()
|
||||||
conn.Write(client.out)
|
conn.Write(client.out)
|
||||||
client.out = client.out[:0]
|
client.out = nil
|
||||||
}
|
}
|
||||||
if close {
|
if close {
|
||||||
break
|
break
|
||||||
|
@ -853,6 +853,7 @@ func (server *Server) handleInputCommand(client *Client, msg *Message) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ping. Just send back the response. No need to put through the pipeline.
|
// Ping. Just send back the response. No need to put through the pipeline.
|
||||||
if msg.Command() == "ping" || msg.Command() == "echo" {
|
if msg.Command() == "ping" || msg.Command() == "echo" {
|
||||||
switch msg.OutputType {
|
switch msg.OutputType {
|
||||||
|
@ -870,6 +871,7 @@ func (server *Server) handleInputCommand(client *Client, msg *Message) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
writeErr := func(errMsg string) error {
|
writeErr := func(errMsg string) error {
|
||||||
switch msg.OutputType {
|
switch msg.OutputType {
|
||||||
case JSON:
|
case JSON:
|
||||||
|
@ -913,6 +915,7 @@ func (server *Server) handleInputCommand(client *Client, msg *Message) error {
|
||||||
return writeErr("invalid password")
|
return writeErr("invalid password")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// choose the locking strategy
|
// choose the locking strategy
|
||||||
switch msg.Command() {
|
switch msg.Command() {
|
||||||
default:
|
default:
|
||||||
|
@ -946,6 +949,7 @@ func (server *Server) handleInputCommand(client *Client, msg *Message) error {
|
||||||
"chans", "search", "ttl", "bounds", "server", "info", "type", "jget",
|
"chans", "search", "ttl", "bounds", "server", "info", "type", "jget",
|
||||||
"evalro", "evalrosha":
|
"evalro", "evalrosha":
|
||||||
// read operations
|
// read operations
|
||||||
|
|
||||||
server.mu.RLock()
|
server.mu.RLock()
|
||||||
defer server.mu.RUnlock()
|
defer server.mu.RUnlock()
|
||||||
if server.config.followHost() != "" && !server.fcuponce {
|
if server.config.followHost() != "" && !server.fcuponce {
|
||||||
|
@ -984,7 +988,6 @@ func (server *Server) handleInputCommand(client *Client, msg *Message) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
res, d, err := server.command(msg, client)
|
res, d, err := server.command(msg, client)
|
||||||
|
|
||||||
if res.Type() == resp.Error {
|
if res.Type() == resp.Error {
|
||||||
return writeErr(res.String())
|
return writeErr(res.String())
|
||||||
}
|
}
|
||||||
|
@ -1003,7 +1006,6 @@ func (server *Server) handleInputCommand(client *Client, msg *Message) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isRespValueEmptyString(res) {
|
if !isRespValueEmptyString(res) {
|
||||||
var resStr string
|
var resStr string
|
||||||
resStr, err := serializeOutput(res)
|
resStr, err := serializeOutput(res)
|
||||||
|
@ -1275,6 +1277,7 @@ const (
|
||||||
|
|
||||||
// Message is a resp message
|
// Message is a resp message
|
||||||
type Message struct {
|
type Message struct {
|
||||||
|
_command string
|
||||||
Args []string
|
Args []string
|
||||||
ConnType Type
|
ConnType Type
|
||||||
OutputType Type
|
OutputType Type
|
||||||
|
@ -1283,7 +1286,10 @@ type Message struct {
|
||||||
|
|
||||||
// Command returns the first argument as a lowercase string
|
// Command returns the first argument as a lowercase string
|
||||||
func (msg *Message) Command() string {
|
func (msg *Message) Command() string {
|
||||||
return strings.ToLower(msg.Args[0])
|
if msg._command == "" {
|
||||||
|
msg._command = strings.ToLower(msg.Args[0])
|
||||||
|
}
|
||||||
|
return msg._command
|
||||||
}
|
}
|
||||||
|
|
||||||
// PipelineReader ...
|
// PipelineReader ...
|
||||||
|
|
Loading…
Reference in New Issue