aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-01-09 18:51:27 +0000
committerMike Buland <eichlan@xagasoft.com>2009-01-09 18:51:27 +0000
commit595afe519791894c77c77a949fba7732f4d94872 (patch)
treefac2a59fb82672ad40a053ce11c549345428a418 /src
parent861e5bd7d3df941685f048d7039029b83ec87cb9 (diff)
downloadlibbu++-595afe519791894c77c77a949fba7732f4d94872.tar.gz
libbu++-595afe519791894c77c77a949fba7732f4d94872.tar.bz2
libbu++-595afe519791894c77c77a949fba7732f4d94872.tar.xz
libbu++-595afe519791894c77c77a949fba7732f4d94872.zip
Whoops! You can't fix a problem in server and forget about ItoServer! That's
just aweful! Well, he's not forgotten now.
Diffstat (limited to '')
-rw-r--r--src/itoserver.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/itoserver.cpp b/src/itoserver.cpp
index fc1f40b..c7328b4 100644
--- a/src/itoserver.cpp
+++ b/src/itoserver.cpp
@@ -148,9 +148,15 @@ void *Bu::ItoServer::ItoClient::run()
148 struct timeval xTimeout = { nTimeoutSec, nTimeoutUSec }; 148 struct timeval xTimeout = { nTimeoutSec, nTimeoutUSec };
149 149
150 fd_set fdRead = fdActive; 150 fd_set fdRead = fdActive;
151 fd_set fdWrite;
151 fd_set fdException = fdActive; 152 fd_set fdException = fdActive;
152 153
153 if( TEMP_FAILURE_RETRY( select( FD_SETSIZE, &fdRead, NULL, &fdException, &xTimeout ) ) < 0 ) 154 FD_ZERO( &fdWrite );
155 if( pClient->hasOutput() )
156 FD_SET( iSocket, &fdWrite );
157
158 if( TEMP_FAILURE_RETRY( select( FD_SETSIZE,
159 &fdRead, &fdWrite, &fdException, &xTimeout ) ) < 0 )
154 { 160 {
155 throw ExceptionBase("Error attempting to scan open connections."); 161 throw ExceptionBase("Error attempting to scan open connections.");
156 } 162 }
@@ -182,12 +188,12 @@ void *Bu::ItoServer::ItoClient::run()
182 } 188 }
183 } 189 }
184 190
185 // Now we just try to write all the pending data on the socket. 191 if( FD_ISSET( iSocket, &fdWrite ) )
186 // this could be done better eventually, if we care about the socket 192 {
187 // wanting to accept writes (using a select). 193 imProto.lock();
188 imProto.lock(); 194 pClient->processOutput();
189 pClient->processOutput(); 195 imProto.unlock();
190 imProto.unlock(); 196 }
191 } 197 }
192 198
193 return NULL; 199 return NULL;