mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
Fixed ssh_socket_poll behaviour
This commit is contained in:
@@ -484,22 +484,19 @@ int ssh_socket_poll(struct socket *s, int *writeable, int *except) {
|
|||||||
|
|
||||||
if (!s->data_to_read) {
|
if (!s->data_to_read) {
|
||||||
fd->events |= POLLIN;
|
fd->events |= POLLIN;
|
||||||
} else if (!s->data_to_write) {
|
|
||||||
fd->events |= POLLOUT;
|
|
||||||
} else {
|
|
||||||
*except = 1;
|
|
||||||
*writeable = 0;
|
|
||||||
|
|
||||||
leave_function();
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
if (!s->data_to_write) {
|
||||||
/* Make the call, and listen for errors */
|
fd->events |= POLLOUT;
|
||||||
rc = ssh_poll(fd, 1, 0);
|
}
|
||||||
if (rc < 0) {
|
/* do not do poll if fd->events is empty, we already know the response */
|
||||||
ssh_set_error(session, SSH_FATAL, "poll(): %s", strerror(errno));
|
if(fd->events != 0){
|
||||||
leave_function();
|
/* Make the call, and listen for errors */
|
||||||
return -1;
|
rc = ssh_poll(fd, 1, 0);
|
||||||
|
if (rc < 0) {
|
||||||
|
ssh_set_error(session, SSH_FATAL, "poll(): %s", strerror(errno));
|
||||||
|
leave_function();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->data_to_read) {
|
if (!s->data_to_read) {
|
||||||
|
|||||||
Reference in New Issue
Block a user