Browse Source

Merge pull request #4 from nxrighthere/patch-1

Reset metrics after successful connection
Vladyslav Hrytsenko 5 years ago
parent
commit
7eb575d80d
1 changed files with 4 additions and 0 deletions
  1. 4 0
      include/enet.h

+ 4 - 0
include/enet.h

@@ -1524,6 +1524,10 @@ extern "C" {
         if (event != NULL) {
             enet_protocol_change_state(host, peer, ENET_PEER_STATE_CONNECTED);
 
+            peer->totalDataSent = 0;
+            peer->totalDataReceived = 0;
+            peer->totalPacketsSent = 0;
+            peer->totalPacketsLost = 0;
             event->type = ENET_EVENT_TYPE_CONNECT;
             event->peer = peer;
             event->data = peer->eventData;