aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-08-25 22:07:53 +0000
committerMike Buland <eichlan@xagasoft.com>2006-08-25 22:07:53 +0000
commite1f398363812115611d20c0c803802c78ed65974 (patch)
tree0a685408d2a720f8ae9293692aeda17c80c8bc10 /src
parent0a700ced28520be170c0965191f2450a2e4a82ac (diff)
downloadlibbu++-e1f398363812115611d20c0c803802c78ed65974.tar.gz
libbu++-e1f398363812115611d20c0c803802c78ed65974.tar.bz2
libbu++-e1f398363812115611d20c0c803802c78ed65974.tar.xz
libbu++-e1f398363812115611d20c0c803802c78ed65974.zip
Fixed the connection manager to not suck with the new connection read api.
Diffstat (limited to '')
-rw-r--r--src/connection.cpp3
-rw-r--r--src/connectionmanager.cpp2
-rw-r--r--src/test/clistress/main.cpp23
3 files changed, 5 insertions, 23 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index 045ea17..c68c519 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -215,6 +215,8 @@ int Connection::readInput()
215 } 215 }
216 else 216 else
217 { 217 {
218 if( nbytes == 0 )
219 break;
218 nTotalRead += nbytes; 220 nTotalRead += nbytes;
219 appendInput( buffer, nbytes ); 221 appendInput( buffer, nbytes );
220 /* Data read. */ 222 /* Data read. */
@@ -258,6 +260,7 @@ bool Connection::readInput( int nSec, int nUSec, int *pnSecBack, int *pnUSecBack
258 } 260 }
259 else if( retval ) 261 else if( retval )
260 { 262 {
263 printf("retval=%d, nSocket=%d,%d, sec=%d, usec=%d\n", retval, nSocket, FD_ISSET( nSocket, &rfds ), tv.tv_sec, tv.tv_usec );
261 // None of them have data, but the connection is still active. 264 // None of them have data, but the connection is still active.
262 if( readInput() == 0 ) 265 if( readInput() == 0 )
263 { 266 {
diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 88d7878..cffdf29 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -167,7 +167,7 @@ bool ConnectionManager::scanConnections( int nTimeout, bool bForceTimeout )
167 } 167 }
168 168
169 /* Data arriving on an already-connected socket. */ 169 /* Data arriving on an already-connected socket. */
170 if( pCon->readInput() != true ) 170 if( pCon->readInput() == 0 )
171 { 171 {
172 xLog.LineLog( MultiLog::LStatus, "Closing connection due to disconnect."); 172 xLog.LineLog( MultiLog::LStatus, "Closing connection due to disconnect.");
173 close( i ); 173 close( i );
diff --git a/src/test/clistress/main.cpp b/src/test/clistress/main.cpp
index 3f5038b..0869945 100644
--- a/src/test/clistress/main.cpp
+++ b/src/test/clistress/main.cpp
@@ -1,26 +1,5 @@
1#include "connection.h" 1#include "connection.h"
2 2
3void _waitForLength( Connection &con, int len)
4{
5 int rlen = con.getInputAmnt();
6
7 if (rlen >= len)
8 return;
9
10 int time_left = 5;
11 int mic_left = 0;
12
13 while (rlen < len)
14 {
15 if (time_left == 0 && mic_left == 0)
16 {
17 throw "Socket Timeout";
18 }
19 con.readInput(time_left, mic_left, &time_left, &mic_left);
20 rlen = con.getInputAmnt();
21 }
22}
23
24int main() 3int main()
25{ 4{
26 Connection c; 5 Connection c;
@@ -30,7 +9,7 @@ int main()
30 c.appendOutput("d"); 9 c.appendOutput("d");
31 c.writeOutput(); 10 c.writeOutput();
32 11
33 _waitForLength( c, 40 ); 12 c.waitForInput( 5, 40, 0 );
34 13
35 c.close(); 14 c.close();
36 15