diff --git a/tracker/udp-server_test.go b/tracker/udp-server_test.go index b32fe853..7308ed0d 100644 --- a/tracker/udp-server_test.go +++ b/tracker/udp-server_test.go @@ -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{}) } diff --git a/tracker/udp/protocol.go b/tracker/udp/protocol.go index f6beb4c6..653d013e 100644 --- a/tracker/udp/protocol.go +++ b/tracker/udp/protocol.go @@ -26,7 +26,7 @@ const ( type TransactionId = int32 -type ConnectionId = int64 +type ConnectionId = uint64 type ConnectionRequest struct { ConnectionId ConnectionId diff --git a/tracker/udp/server/server.go b/tracker/udp/server/server.go index dfcc6500..20e827b9 100644 --- a/tracker/udp/server/server.go +++ b/tracker/udp/server/server.go @@ -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 {