Thread (48 messages) flat view 48 messages, 3 authors, 2016-06-15

Re: [PATCH/RFC 01/11] mingw: add network-wrappers for daemon

From: Erik Faye-Lund <hidden>
Date: 2016-06-15 22:47:49

On Wed, Dec 2, 2009 at 2:49 PM, Erik Faye-Lund [off-list ref] wrote:
On Wed, Dec 2, 2009 at 2:21 PM, Martin Storsjö [off-list ref] wrote:
quoted
On Wed, 2 Dec 2009, Erik Faye-Lund wrote:
quoted
@@ -854,6 +850,7 @@ static int service_loop(int socknum, int *socklist)
                                        }
                                }
                                handle(incoming, (struct sockaddr *)&ss, sslen);

+                               break;
What's this good for?
When I clone git://localhost/some-repo, select() returns a fd-set with
both the IPv4 and IPv6 fds. After accept()'ing the first one, the
second call to accept() hangs. I solved this by accepting only the
first connection I got; the second one should be accepted in the next
round of the service loop (if still available).
Actually, it's no good - my code is broken. FD_SET() and FD_ISSET()
needs wrapping to call _get_osfhandle() on the socket. Since this is
not needed on Linux, the code ran just fine there. But on Windows,
select() failed, but due to the following bug, it wasn't picked up:
+               if (select(0, &fds, NULL, NULL, &timeout) > 0) {

changing the comparison around, revealed that select hadn't done
anything so fds wasn't modified at all! Thus, I wrongly interpreted it
as if both sockets had an awaiting connection, making IPv6 connections
work (since they are on the first socket), but IPv4 not.

I've corrected this locally, and I'll include the fixed patch in the next round.

Thanks for pointing out the issue, causing me to second guess my "cure" :)

-- 
Erik "kusma" Faye-Lund
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help