From b0d02923149f8f42d5e339d9f49a442571b02ce2 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Wed, 11 Feb 2009 18:45:22 +0000 Subject: [PATCH] removed test code --- src/client.cpp | 38 +++++++------------------------------- src/client.h | 14 +++++++++----- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index f5cd6e75..985e0c89 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -436,15 +436,9 @@ void CClient::UpdateTimeResponseMeasurement() void CClient::UpdateSocketBufferSize() { - -// TEST -static double test = 4; - // just update the socket buffer size if auto setting is enabled, otherwise - // do nothing - - - //if ( bDoAutoSockBufSize ) + // do nothing + if ( bDoAutoSockBufSize ) { // we use the time response measurement for the automatic setting // Assumptions: @@ -459,24 +453,13 @@ static double test = 4; // - only use time response measurement results if averaging buffer is // completely filled const double dHysteresis = 0.3; - - - //if ( RespTimeMoAvBuf.IsInitialized() ) + if ( RespTimeMoAvBuf.IsInitialized() ) { // calculate current buffer setting - // TODO 2* seems not give optimal results, maybe use 3*? - - //const double dEstCurBufSet = 2 * GetTimingStdDev(); - - - // TEST - test = test + 0.01 * (2*LlconMath().round ( (double)rand()/RAND_MAX )-1); - if ( test < 0.5 ) test = 0.5; - if ( test > 10 ) test = 10; - const double dEstCurBufSet = test; - +// TEST add 2 buffers + const double dEstCurBufSet = 2 * GetTimingStdDev() + 2; // upper/lower hysteresis decision const int iUpperHystDec = LlconMath().round ( dEstCurBufSet - dHysteresis ); @@ -484,8 +467,7 @@ static double test = 4; // if both decisions are equal than use the result if ( iUpperHystDec == iLowerHystDec ) - { - + { SetSockBufSize ( iUpperHystDec ); } else @@ -500,12 +482,6 @@ static double test = 4; SetSockBufSize ( iUpperHystDec ); } } - } - -static FILE* pFile = fopen("test.dat", "w"); -fprintf(pFile, "%e %d\n",test,GetSockBufSize()); -fflush(pFile); - - + } } } diff --git a/src/client.h b/src/client.h index f04b09b8..4b89105e 100755 --- a/src/client.h +++ b/src/client.h @@ -97,12 +97,16 @@ public: void SetSockBufSize ( const int iNumBlocks ) { if ( Channel.GetSockBufSize() != iNumBlocks ) - { - // set the new socket size - Channel.SetSockBufSize ( iNumBlocks ); + { + // check for valid values + if ( ( iNumBlocks >= 0 ) && ( iNumBlocks <= MAX_NET_BUF_SIZE_NUM_BL ) ) + { + // set the new socket size + Channel.SetSockBufSize ( iNumBlocks ); - // tell the server that size has changed - Channel.CreateJitBufMes ( iNumBlocks ); + // tell the server that size has changed + Channel.CreateJitBufMes ( iNumBlocks ); + } } } int GetSockBufSize() { return Channel.GetSockBufSize(); }