Skip to content

Commit

Permalink
Fix failing send when socket not ready
Browse files Browse the repository at this point in the history
Fixes issue zeromq#207
When another message should be sent on a socket due to a pending reply,
which was not read yet, the message to be sent is put back in the queue.
As the read is already performed before that, nothing triggers a new flush_writes.
This makes the flushReads call asynchronous.
  • Loading branch information
jgrnt authored and rgbkrk committed Mar 3, 2018
1 parent 24531eb commit 10202be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ exports.Socket = function (type) {
this._outgoing = new BatchList();

this._zmq.onReadReady = function () {
self._flushReads();
setImmediate(function(){
self._flushReads();
});
};

this._zmq.onSendReady = function () {
Expand Down

0 comments on commit 10202be

Please sign in to comment.