diff options
Diffstat (limited to 'libssh/poll.c')
-rw-r--r-- | libssh/poll.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libssh/poll.c b/libssh/poll.c index ea59266..56f940a 100644 --- a/libssh/poll.c +++ b/libssh/poll.c @@ -463,10 +463,18 @@ int ssh_poll_ctx_add(ssh_poll_ctx ctx, ssh_poll_handle p) { * @return 0 on success, < 0 on error */ int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, ssh_socket s) { - ssh_poll_handle p=ssh_socket_get_poll_handle(s); - if(p==NULL) + ssh_poll_handle p_in, p_out; + int ret; + p_in=ssh_socket_get_poll_handle_in(s); + if(p_in==NULL) return -1; - return ssh_poll_ctx_add(ctx,p); + ret = ssh_poll_ctx_add(ctx,p_in); + if(ret != 0) + return ret; + p_out=ssh_socket_get_poll_handle_out(s); + if(p_in != p_out) + ret = ssh_poll_ctx_add(ctx,p_out); + return ret; } |