Skip to content

Commit

Permalink
Revert "do not lock while writing to a socket (#52)"
Browse files Browse the repository at this point in the history
This reverts commit 95448ed.
  • Loading branch information
domodwyer committed Oct 19, 2017
1 parent 95448ed commit 8d9e210
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,15 +549,16 @@ func (socket *mongoSocket) Query(ops ...interface{}) (err error) {
socket.replyFuncs[requestId] = request.replyFunc
requestId++
}
socket.Unlock()
debugf("Socket %p to %s: sending %d op(s) (%d bytes)", socket, socket.addr, len(ops), len(buf))

debugf("Socket %p to %s: sending %d op(s) (%d bytes)", socket, socket.addr, len(ops), len(buf))
stats.sentOps(len(ops))

socket.updateDeadline(writeDeadline)
_, err = socket.conn.Write(buf)
if !wasWaiting && requestCount > 0 {
socket.updateDeadline(readDeadline)
}
socket.Unlock()
return err
}

Expand Down

0 comments on commit 8d9e210

Please sign in to comment.