aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2023-07-31 11:16:58 -0700
committerMike Buland <eichlan@xagasoft.com>2023-07-31 11:16:58 -0700
commit9a7dde29dc1bc1f699508ad9c0335f4d7abf319f (patch)
treeeb3ab95cf784c799d85df81eb5b631b6a04c1730
parent412173a23c88a49ebaeb982e0c7eeddc5662b8cc (diff)
downloadlibbu++-9a7dde29dc1bc1f699508ad9c0335f4d7abf319f.tar.gz
libbu++-9a7dde29dc1bc1f699508ad9c0335f4d7abf319f.tar.bz2
libbu++-9a7dde29dc1bc1f699508ad9c0335f4d7abf319f.tar.xz
libbu++-9a7dde29dc1bc1f699508ad9c0335f4d7abf319f.zip
It actually works. Now to make it fast fast.
-rw-r--r--src/stable/clientbuf.cpp4
-rw-r--r--src/stable/server.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/stable/clientbuf.cpp b/src/stable/clientbuf.cpp
index 4e59120..c6b310f 100644
--- a/src/stable/clientbuf.cpp
+++ b/src/stable/clientbuf.cpp
@@ -200,9 +200,9 @@ Bu::size Bu::ClientBuf::ClientAccess::peek( void *pData, int iBytes,
200 // Do we have enough data in the peek buffer to handle this? 200 // Do we have enough data in the peek buffer to handle this?
201 if( qbPeek.getSize() < iBytes+iOffset ) 201 if( qbPeek.getSize() < iBytes+iOffset )
202 { 202 {
203 Bu::println("ClientAccess::peek: Insufficient buffered data (%1)").arg( qbPeek.getSize() ); 203 Bu::println("ClientAccess::peek: Insufficient buffered (have %1b, need %2b)").arg( qbPeek.getSize() ).arg( iBytes+iOffset );
204 // Nope, make an attempt to fill it in. 204 // Nope, make an attempt to fill it in.
205 int nDiff = iBytes-qbPeek.getSize(); 205 int nDiff = (iBytes+iOffset)-qbPeek.getSize();
206 // We have to make our own buffer, since iBytes+nOffeset could be bigger 206 // We have to make our own buffer, since iBytes+nOffeset could be bigger
207 // than pData. 207 // than pData.
208 char *pTmp = new char[nDiff]; 208 char *pTmp = new char[nDiff];
diff --git a/src/stable/server.cpp b/src/stable/server.cpp
index 3f03a63..7c44c11 100644
--- a/src/stable/server.cpp
+++ b/src/stable/server.cpp
@@ -297,6 +297,7 @@ void Bu::Server::shutdown()
297 297
298void Bu::Server::closeClient( fd iSocket ) 298void Bu::Server::closeClient( fd iSocket )
299{ 299{
300 Bu::MutexLocker l( mClients );
300 BU_PROFILE_START("closeClient"); 301 BU_PROFILE_START("closeClient");
301 Bu::Client *pClient = hClients.get( iSocket ); 302 Bu::Client *pClient = hClients.get( iSocket );
302 Bu::Socket *pSocket = hSockets.get( iSocket ); 303 Bu::Socket *pSocket = hSockets.get( iSocket );
@@ -421,7 +422,7 @@ void Bu::Server::IoWorker::handleRead( Client *pClient, Socket *pSocket )
421 { 422 {
422 Bu::println("IoWorker::handleRead: exception, closing: %1").arg( e.what() ); 423 Bu::println("IoWorker::handleRead: exception, closing: %1").arg( e.what() );
423 close( pSocket ); 424 close( pSocket );
424 break; 425 return;
425 } 426 }
426 } 427 }
427 BU_PROFILE_END("client.read"); 428 BU_PROFILE_END("client.read");
@@ -492,6 +493,7 @@ void Bu::Server::ClientWorker::run()
492 Bu::println("Processing input..."); 493 Bu::println("Processing input...");
493 pClient->processInput(); 494 pClient->processInput();
494 Bu::println("Processing input complete."); 495 Bu::println("Processing input complete.");
496 Bu::println("*** ClientBuf: input: %1b, output: %2b").arg( pClient->getInputSize() ).arg( pClient->getOutputSize() );
495 delete pEv; 497 delete pEv;
496 } 498 }
497} 499}