On Mon, Oct 05, 2015 at 02:01:26PM -0700, Gurucharan Shetty wrote:
> >
> > I think that when the assertion is true (presumably always), the new and
> > the old 'if' conditions are equivalent. Is that right?
>
> They are not equivalent. In poll_create_node, we have the following
> piece of code.
>
> /* Check for duplicate. If found, "or" the events. */
> node = find_poll_node(loop, fd, wevent);
> if (node) {
> node->pollfd.events |= events;
> } else {
> node = xzalloc(sizeof *node);
> hmap_insert(&loop->poll_nodes, &node->hmap_node,
> hash_2words(fd, (uint32_t)wevent));
> node->pollfd.fd = fd;
> node->pollfd.events = events;
> #ifdef _WIN32
> if (!wevent) {
> wevent = CreateEvent(NULL, FALSE, FALSE, NULL);
> }
> #endif
> node->wevent = wevent;
> node->where = where;
> }
>
> For Windows, when 'fd' is set, when find_poll_node() returns false, we
> create a new poll_node whose key is 'fd' (wevent is zero). We later
> set node->wevent to the return value of CreateEvent().
>
> When find_poll_node() is called again with the same 'fd', the current
> if condition in poll_fd_node() is wrong, because it does:
> "node->pollfd.fd == fd && node->wevent == wevent". The condition will
> never be true because 'wevent' passed to find_poll_node is 0 whereas
> node->wevent has a value set.
>
> Did my above explanation make sense?
Yes.
Acked-by: Ben Pfaff <[email protected]>
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev