Skip to content

Commit de32dd0

Browse files
idydomodwyer
authored andcommitted
do not lock while writing to a socket (globalsign#52)
fix globalsign#51
1 parent 4931a6c commit de32dd0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

socket.go

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

555+
stats.sentOps(len(ops))
556556
socket.updateDeadline(writeDeadline)
557557
_, err = socket.conn.Write(buf)
558558
if !wasWaiting && requestCount > 0 {
559559
socket.updateDeadline(readDeadline)
560560
}
561-
socket.Unlock()
562561
return err
563562
}
564563

0 commit comments

Comments
 (0)