From: Keith F. <ven...@us...> - 2004-07-10 17:17:06
|
Update of /cvsroot/planeshift/planeshift/src/common/net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27457/common/net Modified Files: connection.cpp Log Message: Fixed math errors in bandwidth calculations that must have been there forever. Index: connection.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/common/net/connection.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** connection.cpp 13 Mar 2004 08:58:02 -0000 1.8 --- connection.cpp 10 Jul 2004 17:16:58 -0000 1.9 *************** *** 151,192 **** float kbpsout = 0; float kbpsin = 0; ! while ( true ) { ! psSleep(100); ! if (!ready || !server) ! continue; - ProcessNetwork (); - currentticks = csGetTicks(); ! if (currentticks - lastlinkcheck > LINKCHECK) ! { ! lastlinkcheck = currentticks; ! CheckLinkDead (currentticks); ! } ! if (currentticks - lastresendcheck > RESENDCHECK) ! { ! lastresendcheck = currentticks; ! CheckResendPkts (); CheckFragmentTimeouts(); ! } if (currentticks - laststatdisplay > STATDISPLAYCHECK) { ! kbpsin = (float)(totaltransferin - lasttotaltransferin) / (float)STATDISPLAYCHECK; lasttotaltransferin = totaltransferin; ! kbpsout = (float)(totaltransferout - lasttotaltransferout) / (float)STATDISPLAYCHECK; lasttotaltransferout = totaltransferout; laststatdisplay = currentticks; ! if (pslog::disp_flag[LOG_LOAD]) { printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); ! printf("+ Currently using %1.2fKbps upstream, %1.2fkbps downstream...\n", ! kbpsout, kbpsin); ! printf("+ Packages out %ld , in %ld...\n",totalcountout-lasttotalcountout,totalcountin-lasttotalcountin); printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); } --- 151,192 ---- float kbpsout = 0; float kbpsin = 0; ! while ( true ) { ! psSleep(50); ! if (!ready || !server) ! continue; ! ! ProcessNetwork (); currentticks = csGetTicks(); ! if (currentticks - lastlinkcheck > LINKCHECK) ! { ! lastlinkcheck = currentticks; ! CheckLinkDead (currentticks); ! } ! if (currentticks - lastresendcheck > RESENDCHECK) ! { ! lastresendcheck = currentticks; ! CheckResendPkts (); CheckFragmentTimeouts(); ! } if (currentticks - laststatdisplay > STATDISPLAYCHECK) { ! kbpsin = (float)(totaltransferin - lasttotaltransferin) / (float)(currentticks - laststatdisplay); lasttotaltransferin = totaltransferin; ! kbpsout = (float)(totaltransferout - lasttotaltransferout) / (float)(currentticks - laststatdisplay); lasttotaltransferout = totaltransferout; laststatdisplay = currentticks; ! if (pslog::disp_flag[LOG_LOAD]) { printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); ! printf("+ Currently using %1.2fKbps out, %1.2fkbps in...\n", ! kbpsout, kbpsin); ! printf("+ Packets: %ld out , %ld in\n",totalcountout-lasttotalcountout,totalcountin-lasttotalcountin); printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); } |