Hi, ----- Original Message ----- From: "JF B" <[EMAIL PROTECTED]> Sent: Wednesday, June 05, 2002 2:54 AM
> What is exactly the problem with the getsockopt() function? Nothing that I know of. I've seen posts on other issues to this list talk about reducing the number of system calls, so I thought maybe the extra call to getsockopt() was bothering some people. > My implementation is slightly different from yours. I use the getsockopt() > function only when WSAGetLastError() returns WSAENOTCONN. Yeah, I wasn't saying mine was better or anything ;) I'd planned to repost my patch on its 2 month anniversary, but I was away for that week, so I was going to when I got back. Then your post came in, so I thought I'd throw my old patch into the mix as well. Yours is probably actually better since it doesn't do the getsockopt() for the probably more usual case of an already-connected socket. However, my patch also includes something to make zero bytes received result in a hangup event. Maybe a combination of the two patches would be best overall. > By the way, why in your implementation don't you test the return of > getsockopt()? Good question, I probably should :) > Also, I considered first using a flag in the apr_socket_t structure, but my > problem is that there is already one: 'disconnected'. I would use this > flag, but after many review of the code, I still don't know the utility of > this flag. I don't know either, but it looks like it's used for something else. I was considering a different flag called 'connected', like the unix code uses if poll() is being emulated with select(). It's set to true in apr_accept() and apr_connect(), and then apr_poll_revents_get() checks it before trying to do the recv(). btw, if you're using apr_poll() with more than one socket in the poll set, after the method returns only the sockets which were actually signaled will be left in the set (in win32). I posted this problem nearly two months ago to the list, asking for confirmation that this was wrong, and offering to write a patch to fix it if so. I was going to wait until my first patch to poll.c was committed before chasing this up any further, though. bye, Saxon Druce ([EMAIL PROTECTED])
