瀏覽代碼

[ENet] Explicitely destroy hosts on close

To ensure we free up the UDP port even if a script is holding a
reference to the underlying host, we need to explicitly destroy it on
close.
Fabio Alessandrelli 8 月之前
父節點
當前提交
062413fb30
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      modules/enet/enet_multiplayer_peer.cpp

+ 1 - 0
modules/enet/enet_multiplayer_peer.cpp

@@ -301,6 +301,7 @@ void ENetMultiplayerPeer::close() {
 	}
 	}
 	for (KeyValue<int, Ref<ENetConnection>> &E : hosts) {
 	for (KeyValue<int, Ref<ENetConnection>> &E : hosts) {
 		E.value->flush();
 		E.value->flush();
+		E.value->destroy();
 	}
 	}
 
 
 	active_mode = MODE_NONE;
 	active_mode = MODE_NONE;