Add API to extract ZMQ_EVENTS from socket backend

This commit is contained in:
Giulio Eulisse
2020-07-14 21:53:50 +02:00
committed by Alexey Rybalchenko
parent d5d5c27958
commit e8cc104344
3 changed files with 31 additions and 0 deletions

View File

@@ -375,6 +375,15 @@ class Socket final : public fair::mq::Socket
}
}
void Events(uint32_t* events) override
{
size_t eventsSize = sizeof(uint32_t);
if (zmq_getsockopt(fSocket, ZMQ_EVENTS, events, &eventsSize) < 0) {
throw SocketError(
tools::ToString("failed setting ZMQ_EVENTS, reason: ", zmq_strerror(errno)));
}
}
int GetLinger() const override
{
int value = 0;
@@ -485,6 +494,12 @@ class Socket final : public fair::mq::Socket
if (constant == "snd-more no-block") return ZMQ_DONTWAIT|ZMQ_SNDMORE;
if (constant == "fd") return ZMQ_FD;
if (constant == "events")
return ZMQ_EVENTS;
if (constant == "pollin")
return ZMQ_POLLIN;
if (constant == "pollout")
return ZMQ_POLLOUT;
return -1;
}