Fix sendPreparedQuery write error hang
If the Write call in sendPreparedQuery encountered a non-fatal error - which means it sent no bytes. It still was marking the connection as not ready for query. That caused the next call to hang.
This commit is contained in:
@@ -1039,12 +1039,15 @@ func (c *Conn) sendPreparedQuery(ps *PreparedStatement, arguments ...interface{}
|
|||||||
buf = appendSync(buf)
|
buf = appendSync(buf)
|
||||||
|
|
||||||
n, err := c.conn.Write(buf)
|
n, err := c.conn.Write(buf)
|
||||||
if err != nil && fatalWriteErr(n, err) {
|
if err != nil {
|
||||||
c.die(err)
|
if fatalWriteErr(n, err) {
|
||||||
|
c.die(err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
c.readyForQuery = false
|
c.readyForQuery = false
|
||||||
|
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// fatalWriteError takes the response of a net.Conn.Write and determines if it is fatal
|
// fatalWriteError takes the response of a net.Conn.Write and determines if it is fatal
|
||||||
|
|||||||
Reference in New Issue
Block a user