diff options
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
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() | |||
27 | 27 | ||
28 | for(;;) | 28 | for(;;) |
29 | { | 29 | { |
30 | nRead = pSocket->read( buf, nRead ); | 30 | try |
31 | if( nRead < 0 ) | ||
32 | { | 31 | { |
33 | throw Bu::ConnectionException( | 32 | nRead = pSocket->read( buf, RBS ); |
34 | excodeReadError, | 33 | |
35 | "Read error: %s", | 34 | if( nRead == 0 ) |
36 | strerror( errno ) | 35 | { |
37 | ); | 36 | break; |
37 | } | ||
38 | else | ||
39 | { | ||
40 | nTotal += nRead; | ||
41 | sReadBuf.append( buf, nRead ); | ||
42 | if( !pSocket->canRead() ) | ||
43 | break; | ||
44 | } | ||
38 | } | 45 | } |
39 | else if( nRead == 0 ) | 46 | catch( ConnectionException &e ) |
40 | { | 47 | { |
48 | pSocket->close(); | ||
49 | bWantsDisconnect = true; | ||
41 | break; | 50 | break; |
42 | } | 51 | } |
43 | else | ||
44 | { | ||
45 | nTotal += nRead; | ||
46 | sReadBuf.append( buf, nRead ); | ||
47 | if( !pSocket->canRead() ) | ||
48 | break; | ||
49 | } | ||
50 | } | 52 | } |
51 | 53 | ||
52 | if( nTotal == 0 ) | 54 | if( nTotal == 0 ) |
53 | { | 55 | { |
54 | pSocket->close(); | 56 | pSocket->close(); |
57 | bWantsDisconnect = true; | ||
55 | } | 58 | } |
56 | 59 | ||
57 | if( pProto && nTotal ) | 60 | if( pProto && nTotal ) |