]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socketengine.cpp
fix a warning. I am on a warning zapping crusade today.
[user/henk/code/inspircd.git] / src / socketengine.cpp
index 90d25e0604eaea1d5e392c364487d620e583a423..c7188b55a1dad76572c8e6c4efb6cbc651d0e4f8 100644 (file)
  * ---------------------------------------------------
  */
 
-/* $Core: libIRCDsocketengine */
+/* $Core */
 
 /*********        DEFAULTS       **********/
+
 /* $ExtraSources: socketengines/socketengine_select.cpp */
 /* $ExtraObjects: socketengine_select.o */
 
+/* $If: USE_POLL */
+/* $ExtraSources: socketengines/socketengine_poll.cpp */
+/* $ExtraObjects: socketengine_poll.o */
+/* $EndIf */
+
 /* $If: USE_KQUEUE */
 /* $ExtraSources: socketengines/socketengine_kqueue.cpp */
 /* $ExtraObjects: socketengine_kqueue.o */
@@ -229,7 +235,7 @@ void SocketEngine::RecoverFromFork()
 
 void SocketEngine::UpdateStats(size_t len_in, size_t len_out)
 {
-       if (lastempty + 1 > time(NULL))
+       if (lastempty != time(NULL))
        {
                lastempty = time(NULL);
                indata = outdata = 0;
@@ -240,9 +246,10 @@ void SocketEngine::UpdateStats(size_t len_in, size_t len_out)
 
 void SocketEngine::GetStats(float &kbitpersec_in, float &kbitpersec_out, float &kbitpersec_total)
 {
+       UpdateStats(0, 0); /* Forces emptying of the values if its been more than a second */
        float in_kbit = indata * 8;
        float out_kbit = outdata * 8;
-       kbitpersec_total = ((in_kbit + out_kbit)) / 1024);
+       kbitpersec_total = ((in_kbit + out_kbit) / 1024);
        kbitpersec_in = in_kbit / 1024;
        kbitpersec_out = out_kbit / 1024;
 }