From 57191021fe365eb8d448a9f2a66002a59e2ab065 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 27 Mar 2007 19:20:57 +0000 Subject: Fixed a const issue in the fstring. --- src/connection.cpp | 15 +++++++++------ src/fstring.h | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/connection.cpp b/src/connection.cpp index f382d82..a5fac5b 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -13,6 +13,9 @@ #include #include "exceptions.h" +// Read buffer size...maybe fix wierd issues... +#define RBS (1024*10) + Connection::Connection() { nSocket = -1; @@ -201,15 +204,15 @@ bool Connection::open( const char *sAddr, int nPort ) int Connection::readInput() { - char buffer[2048]; + char buffer[RBS]; int nbytes; int nTotalRead=0; for(;;) { - //memset( buffer, 0, 2048 ); + //memset( buffer, 0, RBS ); - nbytes = read( nSocket, buffer, 2048 ); + nbytes = read( nSocket, buffer, RBS ); if( nbytes < 0 && errno != 0 && errno != EAGAIN ) { printf("errno: %d, %s\n", errno, strerror( errno ) ); @@ -224,12 +227,12 @@ int Connection::readInput() nTotalRead += nbytes; appendInput( buffer, nbytes ); /* Data read. */ - if( nbytes < 2048 ) + if( nbytes < RBS ) { break; } - /* New test, if data is divisible by 2048 bytes on some libs the + /* New test, if data is divisible by RBS bytes on some libs the * read could block, this keeps it from happening. */ { @@ -358,7 +361,7 @@ bool Connection::clearInput() bool Connection::writeOutput() { - //int nBytes = TEMP_FAILURE_RETRY( write( nSocket, xOutputBuf.getData(), min( 2048, xOutputBuf.getLength() ) ) ); + //int nBytes = TEMP_FAILURE_RETRY( write( nSocket, xOutputBuf.getData(), min( RBS, xOutputBuf.getLength() ) ) ); int nBytes = TEMP_FAILURE_RETRY( write( nSocket, xOutputBuf.getData(), xOutputBuf.getLength() ) ); if( nBytes < 0 ) { diff --git a/src/fstring.h b/src/fstring.h index f0462cb..c5397cc 100644 --- a/src/fstring.h +++ b/src/fstring.h @@ -170,7 +170,7 @@ public: nLength = nNewSize; } - long getSize() + long getSize() const { return nLength; } -- cgit v1.2.3