DEADSOFTWARE

net: log connection attempts
authorfgsfds <pvt.fgsfds@gmail.com>
Mon, 21 Mar 2022 15:56:07 +0000 (18:56 +0300)
committerfgsfds <pvt.fgsfds@gmail.com>
Mon, 21 Mar 2022 15:56:07 +0000 (18:56 +0300)
src/game/g_net.pas

index 249ef8a05f51eca4269c778fd56e03f6987b3779..d8fc0046f58eaa49addd1c9d4bf228f78508a985 100644 (file)
@@ -1678,11 +1678,14 @@ begin
         Port := NetEvent.Peer^.address.port;
         g_Console_Add(_lc[I_NET_MSG] +
           Format(_lc[I_NET_MSG_HOST_CONN], [IP, Port]));
+        e_WriteLog('NET: Connection request from ' + IP + '.', TMsgType.Notify);
 
         if (NetEvent.data <> NET_PROTOCOL_VER) then
         begin
           g_Console_Add(_lc[I_NET_MSG] + _lc[I_NET_MSG_HOST_REJECT] +
             _lc[I_NET_DISC_PROTOCOL]);
+          e_WriteLog('NET: Connection request from ' + IP + ' rejected: version mismatch',
+            TMsgType.Notify);
           NetEvent.peer^.data := GetMemory(SizeOf(Byte));
           Byte(NetEvent.peer^.data^) := 255;
           enet_peer_disconnect(NetEvent.peer, NET_DISC_PROTOCOL);
@@ -1694,6 +1697,8 @@ begin
         begin
           g_Console_Add(_lc[I_NET_MSG] + _lc[I_NET_MSG_HOST_REJECT] +
             _lc[I_NET_DISC_BAN]);
+          e_WriteLog('NET: Connection request from ' + IP + ' rejected: banned',
+            TMsgType.Notify);
           NetEvent.peer^.data := GetMemory(SizeOf(Byte));
           Byte(NetEvent.peer^.data^) := 255;
           enet_peer_disconnect(NetEvent.Peer, NET_DISC_BAN);
@@ -1707,6 +1712,8 @@ begin
         begin
           g_Console_Add(_lc[I_NET_MSG] + _lc[I_NET_MSG_HOST_REJECT] +
             _lc[I_NET_DISC_FULL]);
+          e_WriteLog('NET: Connection request from ' + IP + ' rejected: server full',
+            TMsgType.Notify);
           NetEvent.Peer^.data := GetMemory(SizeOf(Byte));
           Byte(NetEvent.peer^.data^) := 255;
           enet_peer_disconnect(NetEvent.peer, NET_DISC_FULL);