[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Polling POLLRDHUP events?


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’.

Follow-Ups:
Re: Polling POLLRDHUP events?Andreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org