diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-10-08 06:04:24 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-10-08 06:04:24 +0000 |
commit | 724ed6c46b13a5a511d1dbe1fc0f557189f9c798 (patch) | |
tree | fee804a13390a4b711f136b1dcbe1f3a628f4496 /src/client.cpp | |
parent | 4a166239394cf859a36c63bdfaa5c4a6a2252739 (diff) | |
download | libbu++-724ed6c46b13a5a511d1dbe1fc0f557189f9c798.tar.gz libbu++-724ed6c46b13a5a511d1dbe1fc0f557189f9c798.tar.bz2 libbu++-724ed6c46b13a5a511d1dbe1fc0f557189f9c798.tar.xz libbu++-724ed6c46b13a5a511d1dbe1fc0f557189f9c798.zip |
More updates, I'll doc them later, http works, client is less picky.
Diffstat (limited to '')
-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 ) |