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 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/connection.cpp') 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 ) { -- cgit v1.2.3