On Mittwoch, 2. Dezember 2009, Erik Faye-Lund wrote: > I'm not very familiar with poll(), but if I understand the man-pages > correctly it's waiting for events on file descriptors, and is in our > case used to check for incoming connections, right? If so, I see three > possible ways forward: (1) extending our poll()-emulation to handle > multiple sockets, (2) change daemon.c to check one socket at the time, > and (3) using select() instead of poll(). > > (1) seems like the "correct" but tricky thing to do, (2) like the > "easy" but nasty thing to do. However, (3) strikes me as the least > dangerous thing to do ;) > > For (1), there's also a WSAPoll() function in Windows, but I'm not > sure how to figure out if an fd is a socket or a pipe. There's also > WaitForMultipleObjects. GetFileType() returns FILE_TYPE_PIPE for both pipes and sockets. But once you know this, you can use getsockopt(): If it succeeds, it is a socket, and in this case, assume that poll() was called from git-daemon, i.e. all polled-for fds are sockets and you can select(). -- Hannes -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html