mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
Fix poll not waking up on connect on win32
Under windows, poll does not detect connected socket using POLLOUT but POLLWRNORM. "Pending connect requests are indicated in the returned revents member of WSAPOLLFD structure by POLLWRNORM." http://msdn.microsoft.com/en-us/library/ms741669%28VS.85%29.aspx However, I did not test that fix. (no windows at hands). I also don't know if the poll emulation layer works with that too.
This commit is contained in:
@@ -188,7 +188,11 @@ int ssh_socket_pollcallback(ssh_poll_handle p, int fd, int revents, void *v_s){
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef _WIN32
|
||||
if(revents & POLLOUT || revents & POLLWRNORM){
|
||||
#else
|
||||
if(revents & POLLOUT){
|
||||
#endif
|
||||
/* First, POLLOUT is a sign we may be connected */
|
||||
if(s->state == SSH_SOCKET_CONNECTING){
|
||||
ssh_log(s->session,SSH_LOG_PACKET,"Received POLLOUT in connecting state");
|
||||
@@ -797,6 +801,9 @@ int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bin
|
||||
s->state=SSH_SOCKET_CONNECTING;
|
||||
/* POLLOUT is the event to wait for in a nonblocking connect */
|
||||
ssh_poll_set_events(ssh_socket_get_poll_handle(s),POLLOUT);
|
||||
#ifdef _WIN32
|
||||
ssh_poll_add_events(ssh_socket_get_poll_handle(s),POLLWRNORM);
|
||||
#endif
|
||||
leave_function();
|
||||
return SSH_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user