When a poll_node is created, it gets either a 'fd' or
a 'wevent' (can't get both). When the poll_node is
searched for previous creations on that 'fd' or 'wevent',
the search criteria was wrong for Windows. In Windows,
when a 'fd' is received in poll_create_node, we create a
corresponding 'wevent'. So while searching for that 'fd',
we should not look for 'wevent' in the hmap_node.
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Ben Pfaff <blp@nicira.com>
static struct poll_loop *poll_loop(void);
static struct poll_loop *poll_loop(void);
-/* Look up the node with same fd and wevent. */
+/* Look up the node with same fd or wevent. */
static struct poll_node *
find_poll_node(struct poll_loop *loop, int fd, HANDLE wevent)
{
struct poll_node *node;
static struct poll_node *
find_poll_node(struct poll_loop *loop, int fd, HANDLE wevent)
{
struct poll_node *node;
+ /* Both 'fd' and 'wevent' cannot be set. */
+ ovs_assert(!fd != !wevent);
+
HMAP_FOR_EACH_WITH_HASH (node, hmap_node,
hash_2words(fd, (uint32_t)wevent),
&loop->poll_nodes) {
HMAP_FOR_EACH_WITH_HASH (node, hmap_node,
hash_2words(fd, (uint32_t)wevent),
&loop->poll_nodes) {
- if (node->pollfd.fd == fd && node->wevent == wevent) {
+ if ((fd && node->pollfd.fd == fd)
+ || (wevent && node->wevent == wevent)) {