From: Brendan Hansen Date: Sat, 2 Apr 2022 17:38:45 +0000 (-0500) Subject: bugfixes with peer addressing X-Git-Tag: v0.0.1~6 X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=a2d18b53533d1a0a9f6b1fd9e40b7bfd2a4b9321;p=onyx_net.git bugfixes with peer addressing --- diff --git a/src/host.onyx b/src/host.onyx index 538da4a..3ab8264 100644 --- a/src/host.onyx +++ b/src/host.onyx @@ -218,7 +218,7 @@ host_handle_incoming_commands :: (host: ^Host) -> bool { } if peer != null { - peer.addr = host.received_addr; + if peer.addr.port != host.received_addr.port do return false; } string.advance(^current_data, sizeof typeof *header); diff --git a/src/peer.onyx b/src/peer.onyx index 80a2732..fb3535a 100644 --- a/src/peer.onyx +++ b/src/peer.onyx @@ -250,6 +250,14 @@ peer_send_acknowledgements :: (peer: ^Peer) { } peer_send_ping :: (peer: ^Peer) { + for peer.sent_reliable_commands { + if command_get_effective(it.command.command) == .Ping do return; + } + + for peer.outgoing_commands { + if command_get_effective(it.command.command) == .Ping do return; + } + ping := new(Protocol_Ping); ping.command = .Ping; ping.command |= .Flag_Acknowledge;