diff options
author | Roger Dingledine <arma@torproject.org> | 2003-08-06 18:38:46 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2003-08-06 18:38:46 +0000 |
commit | 60d52a7e08cde87fb07e60a1c97cc104f1eb254a (patch) | |
tree | 5fc7710d206caf46e4c4ffa3d01d417d44756282 /src/or/main.c | |
parent | ac5893c62675ac0f25538c5b231dd3cd287eb4d9 (diff) | |
download | tor-60d52a7e08cde87fb07e60a1c97cc104f1eb254a.tar tor-60d52a7e08cde87fb07e60a1c97cc104f1eb254a.tar.gz |
patch to let poll() recognize eof on more architectures
svn:r372
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/or/main.c b/src/or/main.c index 5c6f3386e..5853fd6ce 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -274,7 +274,8 @@ static void conn_read(int i) { connection_free(conn); if(i<nfds) { /* we just replaced the one at i with a new one. process it too. */ - if(poll_array[i].revents & POLLIN) /* something to read */ + if(poll_array[i].revents & POLLIN || + poll_array[i].revents & POLLHUP ) /* something to read */ conn_read(i); } } @@ -552,8 +553,11 @@ static int do_main_loop(void) { if(poll_result > 0) { /* we have at least one connection to deal with */ /* do all the reads first, so we can detect closed sockets */ for(i=0;i<nfds;i++) - if(poll_array[i].revents & POLLIN) /* something to read */ + if(poll_array[i].revents & POLLIN || + poll_array[i].revents & POLLHUP ) /* something to read */ conn_read(i); /* this also blows away broken connections */ +/* see http://www.greenend.org.uk/rjk/2001/06/poll.html for discussion + * of POLLIN vs POLLHUP */ /* then do the writes */ for(i=0;i<nfds;i++) |