diff --git a/go.mod b/go.mod index 9a90457..0c4d24c 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/klauspost/compress v1.16.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect diff --git a/go.sum b/go.sum index 526f7b8..9b38088 100644 --- a/go.sum +++ b/go.sum @@ -145,6 +145,8 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= diff --git a/protocol/net.go b/protocol/net.go index 7455f17..6a73b02 100644 --- a/protocol/net.go +++ b/protocol/net.go @@ -4,6 +4,7 @@ import ( "context" "crypto/tls" "errors" + "fmt" "net" "net/url" "strings" @@ -12,6 +13,7 @@ import ( "time" "github.com/drpcorg/chotki/utils" + "github.com/google/uuid" "github.com/puzpuzpuz/xsync/v3" ) @@ -101,7 +103,7 @@ func (n *Net) ConnectPool(ctx context.Context, name string, addrs []string) (err n.wg.Add(1) go func() { - n.KeepConnecting(ctx, name, addrs) + n.KeepConnecting(ctx, fmt.Sprintf("connect:%s", name), addrs) n.wg.Done() }() @@ -218,7 +220,7 @@ func (n *Net) KeepListening(ctx context.Context, addr string) { n.wg.Add(1) go func() { - n.keepPeer(ctx, remoteAddr, conn) + n.keepPeer(ctx, fmt.Sprintf("listen:%s:%s", uuid.Must(uuid.NewV7()).String(), remoteAddr), conn) defer n.wg.Done() }() }