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:
parent
91bde5fdf0
commit
5cedf602f2
|
@ -47,7 +47,7 @@ func (s *server) respond(addr net.Addr, rh udp.ResponseHeader, parts ...interfac
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) newConn() (ret udp.ConnectionId) {
|
func (s *server) newConn() (ret udp.ConnectionId) {
|
||||||
ret = rand.Int63()
|
ret = rand.Uint64()
|
||||||
if s.conns == nil {
|
if s.conns == nil {
|
||||||
s.conns = make(map[udp.ConnectionId]struct{})
|
s.conns = make(map[udp.ConnectionId]struct{})
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ const (
|
||||||
|
|
||||||
type TransactionId = int32
|
type TransactionId = int32
|
||||||
|
|
||||||
type ConnectionId = int64
|
type ConnectionId = uint64
|
||||||
|
|
||||||
type ConnectionRequest struct {
|
type ConnectionRequest struct {
|
||||||
ConnectionId ConnectionId
|
ConnectionId ConnectionId
|
||||||
|
|
|
@ -181,7 +181,7 @@ func randomConnectionId() udp.ConnectionId {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
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 {
|
func RunSimple(ctx context.Context, s *Server, pc net.PacketConn, family udp.AddrFamily) error {
|
||||||
|
|
Loading…
Reference in New Issue