[zeromq-dev] patch: handle idle connections

Martin Sustrik sustrik at fastmq.com
Thu Mar 26 22:43:14 CET 2009


Dhammika Pathirana wrote:
> Yes, this is way better.
> But we'll have inserts/deletes in the middle.
> 
> 1. New connections going directly to active, we can work around this.
>     pipes.push_back (pipe);
>     std::swap (pipes[pipes.end () - 1], pipes[active]);
>     active++;

Right.

> 
> 2. Connection shutdown, this'll shift later elements.
>     pipes.erase (it)
> 
> Would this be a problem for short lived connections?

What about removing connection x like this:

if (x < active) {
     std::swap (pipes [x], pipes [A-1]);
     x = A = A - 1;
}
std::swap (pipes [x], pipes [pipes.size () - 1]);
pipes.resize (pipes.size () - 1);

Martin



More information about the zeromq-dev mailing list