From 7ad392ce0426a040cc55713691bf6fdbf53c3d31 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 13 May 2010 21:11:47 +0000 Subject: QueueBuf is updated, and everything else uses it now, including Client. Unfortunately this breaks some programs that accessed the client internal buffer directly. Overall it's much, much more efficient, so it's worth it, maybe we'll find a good workaround later. --- src/tests/multiserver.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/tests/multiserver.cpp') diff --git a/src/tests/multiserver.cpp b/src/tests/multiserver.cpp index 22ce94b..85971b5 100644 --- a/src/tests/multiserver.cpp +++ b/src/tests/multiserver.cpp @@ -19,8 +19,12 @@ public: virtual void onNewData( Bu::Client *pClient ) { - pClient->write( pClient->getInput() ); - pClient->seek( pClient->getInputSize() ); + char buf[1024]; + while( pClient->hasInput() ) + { + int iAmnt = pClient->read( buf, 1024 ); + pClient->write( buf, iAmnt ); + } } }; @@ -34,20 +38,23 @@ public: virtual void onNewData( Bu::Client *pClient ) { - Bu::FString sTmp = pClient->getInput(); - for( int j = 0; j < sTmp.getSize(); j++ ) + while( pClient->hasInput() ) { - if( sTmp[j] >= 'a' && sTmp[j] <= 'z' ) - { - sTmp[j] = ((sTmp[j]-'a'+13)%26) + 'a'; - } - else if( sTmp[j] >= 'A' && sTmp[j] <= 'Z' ) + char sTmp[1024]; + int iAmnt = pClient->read( sTmp, 1024 ); + for( int j = 0; j < iAmnt; j++ ) { - sTmp[j] = ((sTmp[j]-'A'+13)%26) + 'A'; + if( sTmp[j] >= 'a' && sTmp[j] <= 'z' ) + { + sTmp[j] = ((sTmp[j]-'a'+13)%26) + 'a'; + } + else if( sTmp[j] >= 'A' && sTmp[j] <= 'Z' ) + { + sTmp[j] = ((sTmp[j]-'A'+13)%26) + 'A'; + } } + pClient->write( sTmp, iAmnt ); } - pClient->write( sTmp ); - pClient->seek( pClient->getInputSize() ); } }; -- cgit v1.2.3