Remove unnecessary mux

This commit is contained in:
Jack Christensen 2019-04-19 16:23:06 -05:00
parent 2978a7440a
commit 427cfe1c16

10
conn.go
View File

@ -7,7 +7,6 @@ import (
"net" "net"
"reflect" "reflect"
"strings" "strings"
"sync"
"time" "time"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -45,7 +44,6 @@ type Conn struct {
poolResetCount int poolResetCount int
preallocatedRows []connRows preallocatedRows []connRows
mux sync.Mutex
causeOfDeath error causeOfDeath error
lastStmtSent bool lastStmtSent bool
@ -190,9 +188,6 @@ func (c *Conn) LocalAddr() (net.Addr, error) {
// Close closes a connection. It is safe to call Close on a already closed // Close closes a connection. It is safe to call Close on a already closed
// connection. // connection.
func (c *Conn) Close(ctx context.Context) error { func (c *Conn) Close(ctx context.Context) error {
c.mux.Lock()
defer c.mux.Unlock()
if !c.IsAlive() { if !c.IsAlive() {
return nil return nil
} }
@ -303,8 +298,6 @@ func (c *Conn) IsAlive() bool {
} }
func (c *Conn) CauseOfDeath() error { func (c *Conn) CauseOfDeath() error {
c.mux.Lock()
defer c.mux.Unlock()
return c.causeOfDeath return c.causeOfDeath
} }
@ -352,9 +345,6 @@ func (c *Conn) rxErrorResponse(msg *pgproto3.ErrorResponse) *pgconn.PgError {
} }
func (c *Conn) die(err error) { func (c *Conn) die(err error) {
c.mux.Lock()
defer c.mux.Unlock()
if !c.IsAlive() { if !c.IsAlive() {
return return
} }