File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -143,9 +143,9 @@ func (c *Connection) sendQuery(q Query) error {
143143
144144 // Set timeout
145145 if c .opts .Timeout == 0 {
146- c .conn .SetDeadline (time.Time {})
146+ c .conn .SetWriteDeadline (time.Time {})
147147 } else {
148- c .conn .SetDeadline (time .Now ().Add (c .opts .Timeout ))
148+ c .conn .SetWriteDeadline (time .Now ().Add (c .opts .Timeout ))
149149 }
150150
151151 // Send the JSON encoding of the query itself.
@@ -165,6 +165,13 @@ func (c *Connection) nextToken() int64 {
165165}
166166
167167func (c * Connection ) readResponse () (* Response , error ) {
168+ // Set timeout
169+ if c .opts .Timeout == 0 {
170+ c .conn .SetReadDeadline (time.Time {})
171+ } else {
172+ c .conn .SetReadDeadline (time .Now ().Add (c .opts .Timeout ))
173+ }
174+
168175 // Read response header (token+length)
169176 _ , err := io .ReadFull (c .conn , c .headerBuf [:respHeaderLen ])
170177 if err != nil {
You can’t perform that action at this time.
0 commit comments