Fix udp address resolve (#624)

* тест для udp + фикс udp

* fix udp addresses resolve

* update SocketUdpConnection::connect

* update SocketUdpServer::sendTo

* update udp test

* revert

* test

* test

* test

* test

* test

* test?

* update test

* cleanup

* cleanup

* update test

* update

* revert

* cleanup

* update test

* update test

* update

* fix test

* additional error handling

* update Network.cpp

* update Network.cpp 2

* fix the test

* cleanup Network.cpp

* revert network_tcp.lua extra changes

---------

Co-authored-by: Xertis <118364459+Xertis@users.noreply.github.com>
This commit is contained in:
MihailRis
2025-09-25 17:02:42 +03:00
committed by GitHub
co-authored by Xertis
parent 370c95c14f
commit 3a40162f1e
4 changed files with 80 additions and 20 deletions
+13 -3
View File
@@ -144,7 +144,11 @@ network.udp_connect = function (address, port, datagramHandler, openCallback)
socket.id = network.__connect_udp(address, port)
_udp_client_datagram_callbacks[socket.id] = datagramHandler
_udp_client_open_callbacks[socket.id] = openCallback
if openCallback then
_udp_client_open_callbacks[socket.id] = function()
openCallback(socket)
end
end
return socket
end
@@ -254,9 +258,15 @@ network.__process_events = function()
end
elseif etype == DATAGRAM then
if side == ON_CLIENT then
_udp_client_datagram_callbacks[cid](data)
local callback = _udp_client_datagram_callbacks[cid]
if callback then
callback(data)
end
elseif side == ON_SERVER then
_udp_server_callbacks[sid](addr, port, data)
local callback = _udp_server_callbacks[sid]
if callback then
callback(addr, port, data)
end
end
elseif etype == RESPONSE then
if event[2] / 100 == 2 then