Skip to content

Commit

Permalink
do not lock while writing to a socket (globalsign#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
idy authored and domodwyer committed Oct 19, 2017
1 parent 4931a6c commit de32dd0
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 de32dd0

Please sign in to comment.