Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions common/zmqserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,7 @@ void ZmqServer::bind()
zmq_setsockopt(m_socket, ZMQ_BINDTODEVICE, m_vrf.c_str(), m_vrf.length());
}

int rc = zmq_bind(m_socket, m_endpoint.c_str());
if (rc != 0)
{
SWSS_LOG_THROW("zmq_bind failed on endpoint: %s, zmqerrno: %d",
m_endpoint.c_str(),
zmq_errno());
}

SWSS_LOG_DEBUG("ZmqServer bind to endpoint: %s", m_endpoint.c_str());
SWSS_LOG_NOTICE("ZmqServer socket created, actual bind to %s will occur in mqPollThread to prevent blocking", m_endpoint.c_str());

startMqPollThread();
}
Expand Down Expand Up @@ -153,6 +145,14 @@ void ZmqServer::mqPollThread()
SWSS_LOG_ENTER();
SWSS_LOG_NOTICE("mqPollThread begin");

SWSS_LOG_NOTICE("Attempting to bind to zmq endpoint: %s", m_endpoint.c_str());
if (zmq_bind(m_socket, m_endpoint.c_str()) != 0)
{
SWSS_LOG_THROW("zmq_bind failed on endpoint: %s, zmqerrno: %d",
m_endpoint.c_str(),
zmq_errno());
}

// zmq_poll will use less CPU
zmq_pollitem_t poll_item;
poll_item.fd = 0;
Expand Down