[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Polling POLLRDHUP events?
[Thread Prev] | [Thread Next]
[Date Prev] | [Date Next]
- Subject: Polling POLLRDHUP events?
- From: Ludovic Courtès <ludo@xxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 10 Jan 2019 18:12:36 +0100
- To: libssh@xxxxxxxxxx
Hello, Apparently libssh only ever polls for POLLIN events; on GNU/Linux, I think it would be useful to poll for POLLIN | POLLRDHUP, which would allow connection shutdowns to be caught, as opposed to sitting in a poll(2) call. I believe the change would be along these lines:
diff --git a/src/bind.c b/src/bind.c index 6b0fb238..89f89464 100644 --- a/src/bind.c +++ b/src/bind.c @@ -321,7 +321,7 @@ static int ssh_bind_poll_callback(ssh_poll_handle sshpoll, ssh_poll_handle ssh_bind_get_poll(ssh_bind sshbind){ if(sshbind->poll) return sshbind->poll; - sshbind->poll=ssh_poll_new(sshbind->bindfd,POLLIN, + sshbind->poll=ssh_poll_new(sshbind->bindfd, POLLIN | POLLRDHUP, ssh_bind_poll_callback,sshbind); return sshbind->poll; }
Thoughts? Ludo’.
Re: Polling POLLRDHUP events? | Andreas Schneider <asn@xxxxxxxxxxxxxx> |