aboutsummaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-03-02 21:05:10 +0000
committerMike Buland <eichlan@xagasoft.com>2011-03-02 21:05:10 +0000
commit6d82703f1504bf39a6c6a9eed4a307aa3ca3da7a (patch)
tree192fa6d1e86285b0842b275e902aaa9d509e36ad /src/client.cpp
parent66669b2b9d392f6ae8f2c2a6acf7752bc0b6bc7e (diff)
downloadlibbu++-6d82703f1504bf39a6c6a9eed4a307aa3ca3da7a.tar.gz
libbu++-6d82703f1504bf39a6c6a9eed4a307aa3ca3da7a.tar.bz2
libbu++-6d82703f1504bf39a6c6a9eed4a307aa3ca3da7a.tar.xz
libbu++-6d82703f1504bf39a6c6a9eed4a307aa3ca3da7a.zip
Corrected a memory leak in Bu::Client, and hopefully sped up transmission some,
there's one more fix I can make later to really speed up transmission, but it's a little more delicate. Also, Cache::Ptr objects are now camparable even when unbound.
Diffstat (limited to '')
-rw-r--r--src/client.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 02e51de..795e09b 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -14,7 +14,7 @@
14#include "bu/clientlinkfactory.h" 14#include "bu/clientlinkfactory.h"
15 15
16/** Read buffer size. */ 16/** Read buffer size. */
17#define RBS (1024*2) 17#define RBS (1500) // 1500 is the nominal MTU for ethernet, it's a good guess
18 18
19Bu::Client::Client( Bu::TcpSocket *pSocket, 19Bu::Client::Client( Bu::TcpSocket *pSocket,
20 class Bu::ClientLinkFactory *pfLink ) : 20 class Bu::ClientLinkFactory *pfLink ) :
@@ -82,10 +82,10 @@ void Bu::Client::processInput()
82 82
83void Bu::Client::processOutput() 83void Bu::Client::processOutput()
84{ 84{
85 char buf[RBS];
85 if( qbWrite.getSize() > 0 ) 86 if( qbWrite.getSize() > 0 )
86 { 87 {
87 int nAmnt = RBS; 88 int nAmnt = RBS;
88 char *buf = new char[nAmnt];
89 nAmnt = qbWrite.peek( buf, nAmnt ); 89 nAmnt = qbWrite.peek( buf, nAmnt );
90 int nReal = pTopStream->write( buf, nAmnt ); 90 int nReal = pTopStream->write( buf, nAmnt );
91 qbWrite.seek( nReal ); 91 qbWrite.seek( nReal );