mirror of
				https://github.com/zeromq/libzmq.git
				synced 2025-10-30 05:29:43 +01:00 
			
		
		
		
	Merge pull request #2221 from minrk/check-socket
only compare pollitem.fd if pollitem.socket is NULL
This commit is contained in:
		| @@ -793,7 +793,7 @@ inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) | |||||||
|             //  Poll item is a raw file descriptor. |             //  Poll item is a raw file descriptor. | ||||||
|             for (int j = 0; j < i; ++j) { |             for (int j = 0; j < i; ++j) { | ||||||
|                 // Check for repeat entries |                 // Check for repeat entries | ||||||
|                 if (items_[j].fd == items_[i].fd) { |                 if (!items_[j].socket && items_[j].fd == items_[i].fd) { | ||||||
|                     repeat_items = true; |                     repeat_items = true; | ||||||
|                     modify = true; |                     modify = true; | ||||||
|                     e |= items_[j].events; |                     e |= items_[j].events; | ||||||
| @@ -825,8 +825,8 @@ inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) | |||||||
|  |  | ||||||
|     //  Transform poller events into zmq_pollitem events. |     //  Transform poller events into zmq_pollitem events. | ||||||
|     //  items_ contains all items, while events only contains fired events. |     //  items_ contains all items, while events only contains fired events. | ||||||
|     //  If no sockets are repeated (likely), the two are still co-ordered, so the step through items |     //  If no sockets are repeated (likely), the two are still co-ordered, so step through the items | ||||||
|     //  Checking for matches only on the first event. |     //  checking for matches only on the first event. | ||||||
|     //  If there are repeat items, they cannot be assumed to be co-ordered, |     //  If there are repeat items, they cannot be assumed to be co-ordered, | ||||||
|     //  so each pollitem must check fired events from the beginning. |     //  so each pollitem must check fired events from the beginning. | ||||||
|     int j_start = 0, found_events = rc; |     int j_start = 0, found_events = rc; | ||||||
| @@ -834,7 +834,7 @@ inline int zmq_poller_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) | |||||||
|         for (int j = j_start; j < found_events; ++j) { |         for (int j = j_start; j < found_events; ++j) { | ||||||
|             if ( |             if ( | ||||||
|                 (items_[i].socket && items_[i].socket == events[j].socket) || |                 (items_[i].socket && items_[i].socket == events[j].socket) || | ||||||
|                 (items_[i].fd && items_[i].fd == events[j].fd) |                 (!(items_[i].socket || items_[j].socket) && items_[i].fd == events[j].fd) | ||||||
|             ) { |             ) { | ||||||
|                 items_[i].revents = events[j].events & items_[i].events; |                 items_[i].revents = events[j].events & items_[i].events; | ||||||
|                 if (!repeat_items) { |                 if (!repeat_items) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Luca Boccassi
					Luca Boccassi