summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 10f31fd)
raw | patch | inline | side by side (parent: 10f31fd)
author | Stas'M <x86corez@gmail.com> | |
Sat, 14 Mar 2020 19:50:40 +0000 (22:50 +0300) | ||
committer | Stas'M <x86corez@gmail.com> | |
Sat, 14 Mar 2020 19:50:40 +0000 (22:50 +0300) |
src/game/g_net.pas | patch | blob | history |
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 07d9713477ed7da1251d54bfffac53b3cfd5d9b7..7dad24c613d1a30243f263f945b77e714f783353 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
NetAddr.host := IPAddr;
NetAddr.port := Port;
- if NetForwardPorts then NetPortThread := BeginThread(ForwardThread);
-
NetHost := enet_host_create(@NetAddr, NET_MAXCLIENTS, NET_CHANS, 0, 0);
if (NetHost = nil) then
Exit;
end;
+ if NetForwardPorts then NetPortThread := BeginThread(ForwardThread);
+
NetPongSock := enet_socket_create(ENET_SOCKET_TYPE_DATAGRAM);
if NetPongSock <> ENET_SOCKET_NULL then
begin
Ping: array [0..9] of Byte;
NPl: Byte;
begin
- if NetPongSock = ENET_SOCKET_NULL then Exit;
+ if (NetPongSock = ENET_SOCKET_NULL) or (NetHost = nil) then Exit;
Buf.data := Addr(Ping[0]);
Buf.dataLength := 2+8;
begin
Result := False;
+ if NetHost = nil then
+ exit;
+
if NetPortForwarded = NetHost.address.port then
begin
Result := True;