From cf04dd313578a009b0e9708eb49b97634c15e6ae Mon Sep 17 00:00:00 2001 From: Ralf Gerlich <rgerlich@hypersphere.calit.net> Date: Wed, 2 Jan 2008 11:23:39 -0800 Subject: [PATCH] Fixed select()-call in fgfs-tools-{client,server} which occasionally led to lockup. --- src/BuildTiles/Parallel/client.cxx | 2 +- src/BuildTiles/Parallel/server.cxx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/BuildTiles/Parallel/client.cxx b/src/BuildTiles/Parallel/client.cxx index a800394f..c19e763c 100644 --- a/src/BuildTiles/Parallel/client.cxx +++ b/src/BuildTiles/Parallel/client.cxx @@ -159,7 +159,7 @@ long int get_next_task( const string& host, int port, long int last_tile ) { FD_SET(sock, &ready); // block until input from sock - select(32, &ready, 0, 0, NULL); + select(sock+1, &ready, 0, 0, NULL); cout << " received reply" << endl; if ( FD_ISSET(sock, &ready) ) { diff --git a/src/BuildTiles/Parallel/server.cxx b/src/BuildTiles/Parallel/server.cxx index 28317087..8739c53b 100644 --- a/src/BuildTiles/Parallel/server.cxx +++ b/src/BuildTiles/Parallel/server.cxx @@ -364,7 +364,7 @@ int main( int argc, char **argv ) { FD_SET(sock, &ready); // block until we get some input on sock - select(32, &ready, 0, 0, NULL); + select(sock+1, &ready, 0, 0, NULL); if ( FD_ISSET(sock, &ready) ) { // printf("%d %d Incomming message --> ", getpid(), pid); @@ -409,6 +409,7 @@ int main( int argc, char **argv ) { } } else { // This is the child + close(sock); // cout << "new process started to handle new connection for " // << next_tile << endl;