Skip to content

Commit 8d9e210

Browse files
committed
Revert "do not lock while writing to a socket (#52)"
This reverts commit 95448ed.
1 parent 95448ed commit 8d9e210

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

socket.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,15 +549,16 @@ func (socket *mongoSocket) Query(ops ...interface{}) (err error) {
549549
socket.replyFuncs[requestId] = request.replyFunc
550550
requestId++
551551
}
552-
socket.Unlock()
553-
debugf("Socket %p to %s: sending %d op(s) (%d bytes)", socket, socket.addr, len(ops), len(buf))
554552

553+
debugf("Socket %p to %s: sending %d op(s) (%d bytes)", socket, socket.addr, len(ops), len(buf))
555554
stats.sentOps(len(ops))
555+
556556
socket.updateDeadline(writeDeadline)
557557
_, err = socket.conn.Write(buf)
558558
if !wasWaiting && requestCount > 0 {
559559
socket.updateDeadline(readDeadline)
560560
}
561+
socket.Unlock()
561562
return err
562563
}
563564

0 commit comments

Comments
 (0)