Cleanup and note more work

This commit is contained in:
Nate Brown
2025-04-16 21:56:53 -05:00
parent f3e1ad64cd
commit 2f48529e8b
5 changed files with 19 additions and 15 deletions

View File

@@ -71,15 +71,14 @@ type rawMessage struct {
Len uint32
}
func (u *GenericConn) ListenOut(r EncReader) {
func (u *GenericConn) ListenOut(r EncReader) error {
buffer := make([]byte, MTU)
for {
// Just read one packet at a time
n, rua, err := u.ReadFromUDPAddrPort(buffer)
if err != nil {
u.l.WithError(err).Debug("udp socket is closed, exiting read loop")
return
return err
}
r(netip.AddrPortFrom(rua.Addr().Unmap(), rua.Port()), buffer[:n])