mirror of
				https://github.com/libssh2/libssh2.git
				synced 2025-11-03 22:13:11 +03:00 
			
		
		
		
	Make sure keepalive is working even when poll is used.
This commit is contained in:
		@@ -521,6 +521,12 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
 | 
			
		||||
    int dir;
 | 
			
		||||
#if HAVE_POLL
 | 
			
		||||
    struct pollfd sockets[1];
 | 
			
		||||
    int seconds_to_next;
 | 
			
		||||
 | 
			
		||||
    rc = libssh2_keepalive_send (session, &seconds_to_next);
 | 
			
		||||
    if (rc < 0)
 | 
			
		||||
      return rc;
 | 
			
		||||
 | 
			
		||||
    sockets[0].fd = session->socket_fd;
 | 
			
		||||
    sockets[0].events = 0;
 | 
			
		||||
    sockets[0].revents = 0;
 | 
			
		||||
@@ -534,7 +540,7 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
 | 
			
		||||
    if(dir & LIBSSH2_SESSION_BLOCK_OUTBOUND)
 | 
			
		||||
        sockets[0].events |= POLLOUT;
 | 
			
		||||
 | 
			
		||||
    rc = poll(sockets, 1, -1);
 | 
			
		||||
    rc = poll(sockets, 1, seconds_to_next ? seconds_to_next / 1000 : -1);
 | 
			
		||||
#else
 | 
			
		||||
    fd_set fd;
 | 
			
		||||
    fd_set *writefd = NULL;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user