Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unneeded mutex in the client #2798

Merged
merged 1 commit into from
Sep 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import (
"fmt"
"net"
"strings"
"sync"

"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/utils"
"github.com/lucas-clemente/quic-go/logging"
)

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.
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down