Linux w/ ZMQ 2.2.0

I have a publish function that is called from a thread.  This publish
function connects an inproc socket with a socket in another thread.
Since inproc sockets error on a connect call if the other side isn't
setup yet I have the publish functino return without publishing
until the connection can be succesfully established.

This function publishes a high volume of data and sometimes when the
other side of the socket takes a second or two to setup I run into
the assertion

    Too many open files (signaler.cpp:330)

when it tries to create a socketpair.  Can't find where the socketpair
gets cleaned up after deletion.

Am I missing something with my approach? Initially tried to reuse
created socket instead of deleting/recreating every time but
connect would never succeed.

TIA
Marc

zmq::socket *s = NULL;
void publish(void *data)
{
    if (s == NULL)
    {
        s = new zmq::socket_t(context, ZMQ_PUB);

        try
        {
            s->connect("inproc://test");
        }

        catch (...)
        {
            delete s;
            s = NULL;
            return;
        }
    }

    // here I publish data on the socket
}
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to