[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: possible issue with bsd_poll() on Windows

On Tuesday, 27 November 2018 18:45:41 CET John Dunn wrote:
> On Friday, November 23, 2018 12:54 PM Andreas Schneider said:
> > Can you take a look at:
> > 
> > https://git.libssh.org/users/asn/libssh.git/log/?h=master-poll
> This code doesn't work - in the case where either the connection is refused
> ( WSAECONNREFUSED ) or times out ( WSAETIMEDOUT ) it continuously loops
> trying to connect since bsd_socket_disconnected doesn't handle those two
> cases. Adding them to the switch statement is straightforward and does
> cause the connection to fail but I still have concerns about this approach
> (1) it still doesn't get good error messages on Windows. I get "Failed to
> poll context: The operation completed successfully" which doesn't inform
> the user what's actually going on

poll() also doesn't set an error message for POLLHUP, I guess we need to call 
getsockopt() for the error to get an error we can report down ...

> (2) there may be other WSA errors that could possibly happen that are also
> missing from the switch statement. I'm definitely not a Winsock expert so
> I'm don't know what those might be.

Returning -1 is wrong, this is a poll emulation and so it should implement 
poll(2) semantics and not do things completely different. The way to go 
forward is to fix this so it works on Linux and Windows the same way.

I hope you understand ... :-)


Andreas Schneider                 asn@xxxxxxxxxxxxxx
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D

RE: possible issue with bsd_poll() on WindowsJohn Dunn <John.Dunn@xxxxxxx>
Re: possible issue with bsd_poll() on WindowsAndreas Schneider <asn@xxxxxxxxxxxxxx>
RE: possible issue with bsd_poll() on WindowsJohn Dunn <John.Dunn@xxxxxxx>
Archive administrator: postmaster@lists.cynapses.org