Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Commit

Permalink
Stop delaying events only if there is no other ZMQ_DELAY_EVENT comman…
Browse files Browse the repository at this point in the history
…d requested
  • Loading branch information
bourtemb committed Apr 8, 2020
1 parent 154b32c commit a5d2c80
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cppapi/client/zmqeventconsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,9 @@ bool ZmqEventConsumer::process_ctrl(zmq::message_t &received_ctrl,zmq::pollitem_
{
bool ret = false;

// static variable to count the number of ZMQ_DELAY_EVENT requests currently in progress:
static int nb_current_delay_event_requests = 0;

//
// For debug and logging purposes
//
Expand Down Expand Up @@ -1086,12 +1089,21 @@ bool ZmqEventConsumer::process_ctrl(zmq::message_t &received_ctrl,zmq::pollitem_
old_poll_nb = poll_nb;
poll_nb = 1;
}
nb_current_delay_event_requests++;
}
break;

case ZMQ_RELEASE_EVENT:
{
poll_nb = old_poll_nb;
if(nb_current_delay_event_requests >= 1)
{
nb_current_delay_event_requests--;
}
if(nb_current_delay_event_requests == 0)
{
// Stop delaying events only if there is no other ZMQ_DELAY_EVENT command requested
poll_nb = old_poll_nb;
}
}
break;

Expand Down

0 comments on commit a5d2c80

Please sign in to comment.