zeromq/zmqpp — pull request #48 by xaqq (2014-05-17 04:42:47+00:00)
Title: Bug in zmqpp::reactor

Hello,
I submitted a PR (#47) that was merged (thank you). However, I didn't do much testing and spotted a bug.

Problem:
* Calling ` remove() `modify the watched item vector. Doing so from an handler means we remove element from a vector while iterating over it (see `zmqpp::reactor::poll`). This is wrong.

Fix:
* This add two vectors that store items are to be removed. Those vector are "flushed" (meaning the items are effectively removed from the reactor and poller) in the `poll()` method.
* Calling remove from a handler will cause a delayed removable, and will not cause incorrect behavior.

Does that seems right?