From 6d82703f1504bf39a6c6a9eed4a307aa3ca3da7a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 2 Mar 2011 21:05:10 +0000 Subject: 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. --- src/cache.h | 4 ++-- src/client.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cache.h b/src/cache.h index 926556d..d4b1900 100644 --- a/src/cache.h +++ b/src/cache.h @@ -154,12 +154,12 @@ namespace Bu bool operator==( const Ptr &rRhs ) const { - return pData == rRhs.pData; + return pCache == rRhs.pCache && kId == rRhs.kId; } bool operator!=( const Ptr &rRhs ) const { - return pData != rRhs.pData; + return pCache != rRhs.pCache || kId != rRhs.kId; } private: 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 @@ #include "bu/clientlinkfactory.h" /** Read buffer size. */ -#define RBS (1024*2) +#define RBS (1500) // 1500 is the nominal MTU for ethernet, it's a good guess Bu::Client::Client( Bu::TcpSocket *pSocket, class Bu::ClientLinkFactory *pfLink ) : @@ -82,10 +82,10 @@ void Bu::Client::processInput() void Bu::Client::processOutput() { + char buf[RBS]; if( qbWrite.getSize() > 0 ) { int nAmnt = RBS; - char *buf = new char[nAmnt]; nAmnt = qbWrite.peek( buf, nAmnt ); int nReal = pTopStream->write( buf, nAmnt ); qbWrite.seek( nReal ); -- cgit v1.2.3