From 724ed6c46b13a5a511d1dbe1fc0f557189f9c798 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 8 Oct 2007 06:04:24 +0000 Subject: More updates, I'll doc them later, http works, client is less picky. --- src/client.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index ee301e9..b546deb 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -27,31 +27,34 @@ void Bu::Client::processInput() for(;;) { - nRead = pSocket->read( buf, nRead ); - if( nRead < 0 ) + try { - throw Bu::ConnectionException( - excodeReadError, - "Read error: %s", - strerror( errno ) - ); + nRead = pSocket->read( buf, RBS ); + + if( nRead == 0 ) + { + break; + } + else + { + nTotal += nRead; + sReadBuf.append( buf, nRead ); + if( !pSocket->canRead() ) + break; + } } - else if( nRead == 0 ) + catch( ConnectionException &e ) { + pSocket->close(); + bWantsDisconnect = true; break; } - else - { - nTotal += nRead; - sReadBuf.append( buf, nRead ); - if( !pSocket->canRead() ) - break; - } } if( nTotal == 0 ) { pSocket->close(); + bWantsDisconnect = true; } if( pProto && nTotal ) -- cgit v1.2.3