File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,15 @@ poller::~poller()
36
36
_fdindex.clear ();
37
37
}
38
38
39
+ #if defined _WIN32
40
+ static const SOCKET invalid_fd = INVALID_SOCKET;
41
+ #else
42
+ static const int invalid_fd = -1 ;
43
+ #endif
44
+
39
45
void poller::add (socket& socket, short const event /* = POLL_IN */ )
40
46
{
41
- zmq_pollitem_t const item { socket, 0 , event, 0 };
47
+ zmq_pollitem_t const item { socket, invalid_fd , event, 0 };
42
48
43
49
add (item);
44
50
}
@@ -96,16 +102,16 @@ void poller::reindex(size_t const index)
96
102
97
103
void poller::remove (socket_t const & socket)
98
104
{
99
- zmq_pollitem_t const item{ socket, 0 , 0 , 0 };
105
+ zmq_pollitem_t const item{ socket, invalid_fd , 0 , 0 };
100
106
101
107
remove (item);
102
108
}
103
109
104
110
void poller::remove (raw_socket_t const descriptor)
105
111
{
106
112
zmq_pollitem_t const item{ nullptr , descriptor, 0 , 0 };
107
-
108
- remove (item);
113
+ if (descriptor != invalid_fd)
114
+ remove (item);
109
115
}
110
116
111
117
void poller::remove (zmq_pollitem_t const & item)
You can’t perform that action at this time.
0 commit comments