1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-02 01:17:52 +03:00

socket: Undouble socket fds

Signed-off-by: Sanne Raymaekers <sraymaek@redhat.com>
This commit is contained in:
Sanne Raymaekers
2018-10-25 18:38:32 +02:00
committed by Andreas Schneider
parent b796924fea
commit ced05eb6db
8 changed files with 85 additions and 159 deletions

View File

@@ -536,7 +536,7 @@ socket_t ssh_get_fd(ssh_session session) {
return -1;
}
return ssh_socket_get_fd_in(session->socket);
return ssh_socket_get_fd(session->socket);
}
/**
@@ -599,7 +599,7 @@ void ssh_set_fd_except(ssh_session session) {
* @return SSH_OK on success, SSH_ERROR otherwise.
*/
int ssh_handle_packets(ssh_session session, int timeout) {
ssh_poll_handle spoll_in,spoll_out;
ssh_poll_handle spoll;
ssh_poll_ctx ctx;
int tm = timeout;
int rc;
@@ -608,17 +608,13 @@ int ssh_handle_packets(ssh_session session, int timeout) {
return SSH_ERROR;
}
spoll_in = ssh_socket_get_poll_handle_in(session->socket);
spoll_out = ssh_socket_get_poll_handle_out(session->socket);
ssh_poll_add_events(spoll_in, POLLIN);
ctx = ssh_poll_get_ctx(spoll_in);
spoll = ssh_socket_get_poll_handle(session->socket);
ssh_poll_add_events(spoll, POLLIN);
ctx = ssh_poll_get_ctx(spoll);
if (!ctx) {
ctx = ssh_poll_get_default_ctx(session);
ssh_poll_ctx_add(ctx, spoll_in);
if (spoll_in != spoll_out) {
ssh_poll_ctx_add(ctx, spoll_out);
}
ssh_poll_ctx_add(ctx, spoll);
}
if (timeout == SSH_TIMEOUT_USER) {