Skip to content

Commit

Permalink
do not lock while writing to a socket (#52) (#54)
Browse files Browse the repository at this point in the history
fix #51
  • Loading branch information
domodwyer committed Oct 19, 2017
1 parent 345ab0b commit 0454966
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,16 +549,15 @@ 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))
stats.sentOps(len(ops))

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 0454966

Please sign in to comment.