Explorar o código

duplicated disconnect packet fixes

eihrul %!s(int64=16) %!d(string=hai) anos
pai
achega
08836d86b3
Modificáronse 2 ficheiros con 4 adicións e 0 borrados
  1. 1 0
      peer.c
  2. 3 0
      protocol.c

+ 1 - 0
peer.c

@@ -422,6 +422,7 @@ enet_peer_disconnect (ENetPeer * peer, enet_uint32 data)
 
     if (peer -> state == ENET_PEER_STATE_DISCONNECTING ||
         peer -> state == ENET_PEER_STATE_DISCONNECTED ||
+        peer -> state == ENET_PEER_STATE_ACKNOWLEDING_DISCONNECT ||
         peer -> state == ENET_PEER_STATE_ZOMBIE)
       return;
 

+ 3 - 0
protocol.c

@@ -629,6 +629,9 @@ enet_protocol_handle_throttle_configure (ENetHost * host, ENetPeer * peer, const
 static int
 enet_protocol_handle_disconnect (ENetHost * host, ENetPeer * peer, const ENetProtocol * command)
 {
+    if (peer -> state == ENET_PEER_STATE_ZOMBIE || peer -> state == ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT)
+      return 0;
+
     enet_peer_reset_queues (peer);
 
     if (peer -> state == ENET_PEER_STATE_CONNECTION_SUCCEEDED)