Reset fd sets every time we poll (because network.fd() can now change)

This commit is contained in:
Keith Winstein
2012-10-05 00:06:37 -04:00
parent 50e75b3127
commit d17fb7824b
3 changed files with 16 additions and 4 deletions
+5 -2
View File
@@ -510,8 +510,6 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
{
/* prepare to poll for events */
Select &sel = Select::get_instance();
sel.add_fd( network.fd() );
sel.add_fd( host_fd );
sel.add_signal( SIGTERM );
sel.add_signal( SIGINT );
@@ -534,6 +532,11 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
timeout = min( timeout, timeout_if_no_client );
}
/* poll for events */
sel.clear_fds();
sel.add_fd( network.fd() );
sel.add_fd( host_fd );
int active_fds = sel.select( timeout );
if ( active_fds < 0 ) {
perror( "select" );