Beispiel #1
0
void zmq::ctx_t::connect_pending (const char *addr_, zmq::socket_base_t *bind_socket_)
{
    scoped_lock_t locker(endpoints_sync);

    std::pair<pending_connections_t::iterator, pending_connections_t::iterator> pending = pending_connections.equal_range(addr_);
    for (pending_connections_t::iterator p = pending.first; p != pending.second; ++p)
        connect_inproc_sockets(bind_socket_, endpoints[addr_].options, p->second, bind_side);

    pending_connections.erase(pending.first, pending.second);
}
Beispiel #2
0
void zmq::ctx_t::pend_connection (const char *addr_, pending_connection_t &pending_connection_)
{
    endpoints_sync.lock ();

    endpoints_t::iterator it = endpoints.find (addr_);
    if (it == endpoints.end ()) {
        // Still no bind.
        pending_connection_.endpoint.socket->inc_seqnum ();
        pending_connections.insert (pending_connections_t::value_type (std::string (addr_), pending_connection_));
    }
    else
        // Bind has happened in the mean time, connect directly
        connect_inproc_sockets(it->second.socket, it->second.options, pending_connection_, connect_side);

    endpoints_sync.unlock ();
}
Beispiel #3
0
void zmq::ctx_t::pend_connection (const std::string &addr_,
        const endpoint_t &endpoint_, pipe_t **pipes_)
{
    scoped_lock_t locker(endpoints_sync);

    const pending_connection_t pending_connection = {endpoint_, pipes_ [0], pipes_ [1]};

    endpoints_t::iterator it = endpoints.find (addr_);
    if (it == endpoints.end ()) {
        //  Still no bind.
        endpoint_.socket->inc_seqnum ();
        pending_connections.insert (pending_connections_t::value_type (addr_, pending_connection));
    } else {
        //  Bind has happened in the mean time, connect directly
        connect_inproc_sockets(it->second.socket, it->second.options, pending_connection, connect_side);
    }
}