Use ConnectionId type alias

This commit is contained in:
Matt Joiner 2022-12-08 15:06:05 +11:00
parent acb09fcf79
commit 91bde5fdf0
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
1 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ type torrent struct {
type server struct {
pc net.PacketConn
conns map[int64]struct{}
conns map[udp.ConnectionId]struct{}
t map[[20]byte]torrent
}
@ -46,10 +46,10 @@ func (s *server) respond(addr net.Addr, rh udp.ResponseHeader, parts ...interfac
return
}
func (s *server) newConn() (ret int64) {
func (s *server) newConn() (ret udp.ConnectionId) {
ret = rand.Int63()
if s.conns == nil {
s.conns = make(map[int64]struct{})
s.conns = make(map[udp.ConnectionId]struct{})
}
s.conns[ret] = struct{}{}
return