|
|
@@ -366,6 +366,15 @@ func (c *conn) Receive() (reply interface{}, err error) {
|
|
|
}
|
|
|
|
|
|
func (c *conn) Do(cmd string, args ...interface{}) (interface{}, error) {
|
|
|
+ c.mu.Lock()
|
|
|
+ pending := c.pending
|
|
|
+ c.pending = 0
|
|
|
+ c.mu.Unlock()
|
|
|
+
|
|
|
+ if cmd == "" && pending == 0 {
|
|
|
+ return nil, nil
|
|
|
+ }
|
|
|
+
|
|
|
if c.writeTimeout != 0 {
|
|
|
c.conn.SetWriteDeadline(time.Now().Add(c.writeTimeout))
|
|
|
}
|
|
|
@@ -378,11 +387,6 @@ func (c *conn) Do(cmd string, args ...interface{}) (interface{}, error) {
|
|
|
return nil, c.fatal(err)
|
|
|
}
|
|
|
|
|
|
- c.mu.Lock()
|
|
|
- pending := c.pending
|
|
|
- c.pending = 0
|
|
|
- c.mu.Unlock()
|
|
|
-
|
|
|
if c.readTimeout != 0 {
|
|
|
c.conn.SetReadDeadline(time.Now().Add(c.readTimeout))
|
|
|
}
|