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/itoserver.cpp | 8 ++++++-- src/tests/multiserver.cpp | 31 +++++++++++++++++++------------ src/tests/rot13.cpp | 8 ++++++-- 3 files changed, 31 insertions(+), 16 deletions(-) (limited to 'src/tests') diff --git a/src/tests/itoserver.cpp b/src/tests/itoserver.cpp index cf5f6d1..5f6e4fa 100644 --- a/src/tests/itoserver.cpp +++ b/src/tests/itoserver.cpp @@ -33,8 +33,12 @@ public: virtual void onNewData( Bu::Client *pClient ) { TRACE(); - pClient->write( pClient->getInput().getStr(), pClient->getInputSize() ); - pClient->seek( pClient->getInputSize() ); + char buf[1024]; + while( pClient->hasInput() ) + { + int iAmnt = pClient->read( buf, 1024 ); + pClient->write( buf, iAmnt ); + } } }; 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() ); } }; diff --git a/src/tests/rot13.cpp b/src/tests/rot13.cpp index 2326888..03ba385 100644 --- a/src/tests/rot13.cpp +++ b/src/tests/rot13.cpp @@ -67,8 +67,12 @@ public: void onNewData( Bu::Client *pClient ) { - pClient->write( pClient->getInput().getStr(), pClient->getInputSize() ); - pClient->seek( pClient->getInputSize() ); + char buf[1024]; + while( pClient->hasInput() ) + { + int iAmnt = pClient->read( buf, 1024 ); + pClient->write( buf, iAmnt ); + } } }; -- cgit v1.2.3