2
0

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:
Jack Christensen
2017-05-31 18:33:01 -05:00
parent 95c11a1fd1
commit dcf3ee2781
+6 -3
View File
@@ -1039,12 +1039,15 @@ func (c *Conn) sendPreparedQuery(ps *PreparedStatement, arguments ...interface{}
buf = appendSync(buf)
n, err := c.conn.Write(buf)
if err != nil && fatalWriteErr(n, err) {
c.die(err)
if err != nil {
if fatalWriteErr(n, err) {
c.die(err)
}
return err
}
c.readyForQuery = false
return err
return nil
}
// fatalWriteError takes the response of a net.Conn.Write and determines if it is fatal