summaryrefslogtreecommitdiff
path: root/src/sub.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sub.cpp')
-rw-r--r--src/sub.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sub.cpp b/src/sub.cpp
index 51e0c23..101c62f 100644
--- a/src/sub.cpp
+++ b/src/sub.cpp
@@ -101,6 +101,12 @@ int zmq::sub_t::recv (struct zmq_msg_t *msg_, int flags_)
if (rc != 0 && errno == EAGAIN)
return -1;
+ // If there is no subscription return -1/EAGAIN.
+ if (!all_count && prefixes.empty () && topics.empty ()) {
+ errno = EAGAIN;
+ return -1;
+ }
+
// If there is at least one "*" subscription, the message matches.
if (all_count)
return 0;