-
-
Notifications
You must be signed in to change notification settings - Fork 217
Description
Describe the bug
The request-reply state is not reset when this flag is set to true.
Reproducing
The code snippet is as follows:
const zmq = require('zeromq');
constructor(){
this.socket = zmq.socket("req",{relaxed: true, correlate:true});
this.address = PORT;
this.init();
}
init(){
var client = this;
client.socket.connect(client.address);
console.log('Client connected to',client.address);
}
sendMessage(message){
var client = this;
return new Promise ((resolve, reject) => {
var ret = client.socket.send(message);
console.log(ret);
client.socket.on('message', (msg) => {
console.log('got reply', msg.toString());
client.socket.removeAllListeners('message');
resolve(msg);
});
client.socket.on('error', (err) => {
reject(err);
});
});//promise
}
Expected behavior
This is the socket.send() event output for a new request when the previous request's response is received
EventEmitter {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
type: 'req',
_zmq: {
pending: false,
state: 0,
onReadReady: [Function],
onSendReady: [Function]
},
_paused: false,
_isFlushingReads: false,
_isFlushingWrites: false,
_outgoing: BatchList {
firstBatch: null,
lastBatch: OutBatch { content: [Array], cbs: [], isClosed: true, next: null },
length: 0
},
relaxed: true,
correlate: true,
[Symbol(kCapture)]: false
}
This is the socket.send() event output for a new request when the previous request's response is not received
EventEmitter {
_events: [Object: null prototype] {
error: [ [Function], [Function] ],
message: [Function]
},
_eventsCount: 2,
_maxListeners: undefined,
type: 'req',
_zmq: {
pending: true,
state: 0,
onReadReady: [Function],
onSendReady: [Function]
},
_paused: false,
_isFlushingReads: false,
_isFlushingWrites: false,
_outgoing: BatchList {
firstBatch: OutBatch { content: [Array], cbs: [], isClosed: true, next: null },
lastBatch: OutBatch { content: [Array], cbs: [], isClosed: true, next: null },
length: 1
},
relaxed: true,
correlate: true,
[Symbol(kCapture)]: false
}
Tested on
-
OS:
NAME="NXP i.MX Release Distro"
VERSION="5.10-hardknott (hardknott)"
VERSION_ID=5.10-hardknott
PRETTY_NAME="NXP i.MX Release Distro 5.10-hardknott (hardknott)" -
ZeroMQ.js version: 5.2.8