summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2025-03-28 20:52:48 +0100
committerHimbeer <himbeer@disroot.org>2025-03-28 20:52:48 +0100
commit7b34834724f753b07e72a54f60f364f135654871 (patch)
tree3ac85565cb6861bc18d941ccb3dc76bc16b863ce
parentb2c1ec5b4f2afecf43ccb59a68684e68b8706431 (diff)
Fix rudp.Conn.sendPings being called before the peer ID is received
This commit fixes an issue where pings are sent with PeerIDNil, preventing further reliable packets on channel 0 from being processed by the server.
-rw-r--r--rudp/conn.go1
-rw-r--r--rudp/recv.go2
2 files changed, 2 insertions, 1 deletions
diff --git a/rudp/conn.go b/rudp/conn.go
index 7e241a8..11ffe0d 100644
--- a/rudp/conn.go
+++ b/rudp/conn.go
@@ -149,7 +149,6 @@ func newConn(uc udpConn, id, remoteID PeerID) *Conn {
c.newAckBuf()
- go c.sendPings(c.ping.C)
go c.recvUDPPkts()
return c
diff --git a/rudp/recv.go b/rudp/recv.go
index d8cd7e1..0a9933b 100644
--- a/rudp/recv.go
+++ b/rudp/recv.go
@@ -136,6 +136,8 @@ func (c *Conn) processRawPkt(data []byte, pi PktInfo) (err error) {
c.mu.Unlock()
c.newAckBuf()
+
+ go c.sendPings(c.ping.C)
case ctlPing:
defer errWrap("ping")
case ctlDisco: