Make UDP tracker connection ID unsigned

This is more appropriate for logging and its use as a byte blob elsewhere.
This commit is contained in:
Matt Joiner 2022-12-08 15:06:59 +11:00
parent 91bde5fdf0
commit 5cedf602f2
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
3 changed files with 3 additions and 3 deletions

View File

@ -47,7 +47,7 @@ func (s *server) respond(addr net.Addr, rh udp.ResponseHeader, parts ...interfac
}
func (s *server) newConn() (ret udp.ConnectionId) {
ret = rand.Int63()
ret = rand.Uint64()
if s.conns == nil {
s.conns = make(map[udp.ConnectionId]struct{})
}

View File

@ -26,7 +26,7 @@ const (
type TransactionId = int32
type ConnectionId = int64
type ConnectionId = uint64
type ConnectionRequest struct {
ConnectionId ConnectionId

View File

@ -181,7 +181,7 @@ func randomConnectionId() udp.ConnectionId {
if err != nil {
panic(err)
}
return int64(binary.BigEndian.Uint64(b[:]))
return binary.BigEndian.Uint64(b[:])
}
func RunSimple(ctx context.Context, s *Server, pc net.PacketConn, family udp.AddrFamily) error {