From 60bec77f0a10d4ab2787fc81fe0cd997a6c61069 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Tue, 22 Sep 2020 14:53:57 +0300 Subject: [PATCH] remove unnecessary locking Fixes #2717 --- client.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/client.go b/client.go index aa59a9e3f..3663cf887 100644 --- a/client.go +++ b/client.go @@ -7,7 +7,6 @@ import ( "fmt" "net" "strings" - "sync" "github.com/lucas-clemente/quic-go/internal/protocol" "github.com/lucas-clemente/quic-go/internal/utils" @@ -15,8 +14,6 @@ import ( ) type client struct { - mutex sync.Mutex - conn sendConn // If the client is created with DialAddr, we create a packet conn. // If it is started with Dial, we take a packet conn as a parameter. @@ -252,7 +249,6 @@ func (c *client) dial(ctx context.Context) error { c.tracer.StartedConnection(c.conn.LocalAddr(), c.conn.RemoteAddr(), c.version, c.srcConnID, c.destConnID) } - c.mutex.Lock() c.session = newClientSession( c.conn, c.packetHandlers, @@ -268,7 +264,6 @@ func (c *client) dial(ctx context.Context) error { c.logger, c.version, ) - c.mutex.Unlock() c.packetHandlers.Add(c.srcConnID, c.session) errorChan := make(chan error, 1)