summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-10-08 06:04:24 +0000
committerMike Buland <eichlan@xagasoft.com>2007-10-08 06:04:24 +0000
commit724ed6c46b13a5a511d1dbe1fc0f557189f9c798 (patch)
treefee804a13390a4b711f136b1dcbe1f3a628f4496 /src
parent4a166239394cf859a36c63bdfaa5c4a6a2252739 (diff)
downloadlibbu++-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 'src')
-rw-r--r--src/client.cpp33
-rw-r--r--src/fstring.h2
-rw-r--r--src/protocolhttp.cpp8
3 files changed, 24 insertions, 19 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 )
diff --git a/src/fstring.h b/src/fstring.h
index 0306aa1..97959d3 100644
--- a/src/fstring.h
+++ b/src/fstring.h
@@ -444,6 +444,8 @@ namespace Bu
444 if( pFirst == NULL ) { 444 if( pFirst == NULL ) {
445 if( pData == NULL ) 445 if( pData == NULL )
446 return true; 446 return true;
447 if( pData[0] == (chr)0 )
448 return true;
447 return false; 449 return false;
448 } 450 }
449 451
diff --git a/src/protocolhttp.cpp b/src/protocolhttp.cpp
index e962b7a..ed303b6 100644
--- a/src/protocolhttp.cpp
+++ b/src/protocolhttp.cpp
@@ -25,17 +25,17 @@ void Bu::ProtocolHttp::onNewConnection( Bu::Client *pClient )
25 iState = 0; 25 iState = 0;
26} 26}
27 27
28//#define SDB( i ) { } 28#define SDB( i ) { }
29#define SDB( i ) printf("state %d: %d, \"%s\"\n", i, tt, sToken.getStr() ) 29//#define SDB( i ) printf("state %d: %d, \"%s\"\n", i, tt, sToken.getStr() )
30 30
31void Bu::ProtocolHttp::onNewData( Bu::Client *pClient ) 31void Bu::ProtocolHttp::onNewData( Bu::Client *pClient )
32{ 32{
33 logHexDump( 33/* logHexDump(
34 1, 34 1,
35 pClient->getInput().getStr(), 35 pClient->getInput().getStr(),
36 pClient->getInput().getSize(), 36 pClient->getInput().getSize(),
37 "input" 37 "input"
38 ); 38 );*/
39 39
40 for(;;) 40 for(;;)
41 { 41 {