Monday, August 10, 2020

Re: ZeroMQ Linger option

At socket shutdown, LINGER determines how long close(2) or shutdown(2) will block waiting for queue messages to be sent. See man socket(7).

On Mon, Aug 10, 2020 at 7:00 PM Cameron Matson <ncmatson95@gmail.com> wrote:
Hi all,

Can someone help me understand what's going on with any of the ZMQ Message Sink blocks?  The block takes a timeout parameter which is assigned to d_timeout, but ultimately it looks like the zmq.LINGER option (which I believe is how long zmq will block before dropping the frame) is always set to a different variable, time, which is initialized in the constructor to be 0 that is used for the setsockopt call.

if (major < 3) {
d_timeout = timeout * 1000;
}
d_context = new zmq::context_t(1);
d_socket = new zmq::socket_t(*d_context, ZMQ_REP);
int time = 0;
d_socket->setsockopt(ZMQ_LINGER, &time, sizeof(time));

Am I missing something?

Thanks,
Cameron

No comments:

Post a Comment