This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bug report: poll() with listen sockets always gives POLLERR


Corinna Vinschen wrote:

> On Tue, Nov 19, 2002 at 01:34:30PM +0000, Steven O'Brien wrote:
> > Hi
> > 
> > The current implementation of poll() does not behave correctly with
> > listen sockets. It always gives a POLLERR revent when a connection
> > request is received. I believe the error is in poll.cc lines 96-108:
> > [...]

> Thanks for the report.  I've checked in a patch.  Please try the
> next developers snapshot.

> Corinna

Thanks Corinna, but its still not quite right. poll() needs to set
POLLIN
when a connection request is received on a listen socket. The following
patch completes the job:

--- poll.cc	2002-11-20 08:57:03.000000000 +0000
+++ poll.cc-fix	2002-11-20 09:01:21.000000000 +0000
@@ -111,9 +111,12 @@ poll (struct pollfd *fds, unsigned int n
 				 Unfortunately, recvfrom() doesn't make much
 				 sense then.  It returns WSAENOTCONN in that
 				 case.  Since that's not actually an error,
-				 we must not set POLLERR. */
+				 we must not set POLLERR, but POLLIN to
+				 indicate the request. */
 			      if (WSAGetLastError () != WSAENOTCONN)
 				fds[i].revents |= POLLERR;
+			      else
+			        fds[i].revents |= POLLIN;
 			      break;
 			    case 0:  /* Closed on the read side. */
 			      fds[i].revents |= POLLHUP;

Regards,
 Steven

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]