diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-05-13 21:11:47 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-05-13 21:11:47 +0000 |
commit | 7ad392ce0426a040cc55713691bf6fdbf53c3d31 (patch) | |
tree | a50a7cb05f0d8550a7a37aa0cc3f3090250148e7 /src/tests/multiserver.cpp | |
parent | 093ef85e95d1b37e4a87ffc2a51433b2f1ed24e0 (diff) | |
download | libbu++-7ad392ce0426a040cc55713691bf6fdbf53c3d31.tar.gz libbu++-7ad392ce0426a040cc55713691bf6fdbf53c3d31.tar.bz2 libbu++-7ad392ce0426a040cc55713691bf6fdbf53c3d31.tar.xz libbu++-7ad392ce0426a040cc55713691bf6fdbf53c3d31.zip |
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.
Diffstat (limited to 'src/tests/multiserver.cpp')
-rw-r--r-- | src/tests/multiserver.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
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: | |||
19 | 19 | ||
20 | virtual void onNewData( Bu::Client *pClient ) | 20 | virtual void onNewData( Bu::Client *pClient ) |
21 | { | 21 | { |
22 | pClient->write( pClient->getInput() ); | 22 | char buf[1024]; |
23 | pClient->seek( pClient->getInputSize() ); | 23 | while( pClient->hasInput() ) |
24 | { | ||
25 | int iAmnt = pClient->read( buf, 1024 ); | ||
26 | pClient->write( buf, iAmnt ); | ||
27 | } | ||
24 | } | 28 | } |
25 | }; | 29 | }; |
26 | 30 | ||
@@ -34,20 +38,23 @@ public: | |||
34 | 38 | ||
35 | virtual void onNewData( Bu::Client *pClient ) | 39 | virtual void onNewData( Bu::Client *pClient ) |
36 | { | 40 | { |
37 | Bu::FString sTmp = pClient->getInput(); | 41 | while( pClient->hasInput() ) |
38 | for( int j = 0; j < sTmp.getSize(); j++ ) | ||
39 | { | 42 | { |
40 | if( sTmp[j] >= 'a' && sTmp[j] <= 'z' ) | 43 | char sTmp[1024]; |
41 | { | 44 | int iAmnt = pClient->read( sTmp, 1024 ); |
42 | sTmp[j] = ((sTmp[j]-'a'+13)%26) + 'a'; | 45 | for( int j = 0; j < iAmnt; j++ ) |
43 | } | ||
44 | else if( sTmp[j] >= 'A' && sTmp[j] <= 'Z' ) | ||
45 | { | 46 | { |
46 | sTmp[j] = ((sTmp[j]-'A'+13)%26) + 'A'; | 47 | if( sTmp[j] >= 'a' && sTmp[j] <= 'z' ) |
48 | { | ||
49 | sTmp[j] = ((sTmp[j]-'a'+13)%26) + 'a'; | ||
50 | } | ||
51 | else if( sTmp[j] >= 'A' && sTmp[j] <= 'Z' ) | ||
52 | { | ||
53 | sTmp[j] = ((sTmp[j]-'A'+13)%26) + 'A'; | ||
54 | } | ||
47 | } | 55 | } |
56 | pClient->write( sTmp, iAmnt ); | ||
48 | } | 57 | } |
49 | pClient->write( sTmp ); | ||
50 | pClient->seek( pClient->getInputSize() ); | ||
51 | } | 58 | } |
52 | }; | 59 | }; |
53 | 60 | ||