mirror of https://github.com/tidwall/tile38.git
Fix hang on empty response
This commit is contained in:
parent
a824d58419
commit
2b6ab4368a
|
@ -947,7 +947,7 @@ func (s *Server) handleInputCommand(client *Client, msg *Message) error {
|
|||
}
|
||||
}
|
||||
res = NOMessage
|
||||
err = writeErr("timeout")
|
||||
err = errTimeout
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
@ -975,23 +975,17 @@ func (s *Server) handleInputCommand(client *Client, msg *Message) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if !isRespValueEmptyString(res) {
|
||||
var resStr string
|
||||
resStr, err := serializeOutput(res)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := writeOutput(resStr); err != nil {
|
||||
return err
|
||||
}
|
||||
var resStr string
|
||||
resStr, err = serializeOutput(res)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := writeOutput(resStr); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func isRespValueEmptyString(val resp.Value) bool {
|
||||
return !val.IsNull() && (val.Type() == resp.SimpleString || val.Type() == resp.BulkString) && len(val.Bytes()) == 0
|
||||
}
|
||||
|
||||
func randomKey(n int) string {
|
||||
b := make([]byte, n)
|
||||
nn, err := rand.Read(b)
|
||||
|
|
Loading…
Reference in New Issue