Commit 5f44f900 authored by legoc's avatar legoc
Browse files

Removed some functions from ContextZmq

parent 5d0cbe02
......@@ -133,57 +133,4 @@ bool ContextZmq::isAvailable(RequestSocket * socket, int timeout) {
return false;
}
void ContextZmq::sendSyncStream(RequestSocket * socket, const std::string& name) {
try {
socket->requestJSON(createSyncStreamRequest(name));
}
catch (const ConnectionTimeout&) {
// The server is not accessible.
}
catch (...) {
// Should not happen.
}
}
void ContextZmq::waitForStreamSubscriber(zmq::socket_t * subscriber, RequestSocket * socket, const std::string& name) {
// Poll subscriber.
zmq_pollitem_t items[1];
items[0].socket = static_cast<void *>(*subscriber);
items[0].fd = 0;
items[0].events = ZMQ_POLLIN;
items[0].revents = 0;
while (true) {
sendSyncStream(socket, name);
// Wait for 100ms.
int rc = zmq::poll(items, 1, 100);
if (rc != 0) {
break;
}
}
}
void ContextZmq::waitForSubscriber(zmq::socket_t * subscriber, RequestSocket * socket) {
// Poll subscriber.
zmq_pollitem_t items[1];
items[0].socket = static_cast<void *>(*subscriber);
items[0].fd = 0;
items[0].events = ZMQ_POLLIN;
items[0].revents = 0;
while (true) {
isAvailable(socket, 100);
// Wait for 100ms.
int rc = zmq::poll(items, 1, 100);
if (rc != 0) {
break;
}
}
}
}
......@@ -48,9 +48,6 @@ public:
zmq::socket_t * createRequestSocket(const std::string& endpoint);
bool isAvailable(RequestSocket * socket, int timeout);
void sendSyncStream(RequestSocket * socket, const std::string& name);
void waitForStreamSubscriber(zmq::socket_t * subscriber, RequestSocket * socket, const std::string& name);
void waitForSubscriber(zmq::socket_t * subscriber, RequestSocket * socket);
private:
std::unique_ptr<zmq::context_t> m_context;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment