Skip to content
26 changes: 2 additions & 24 deletions server/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,9 @@ var baseConnID uint32 = 10000
func NewConn(conn net.Conn, user string, password string, h Handler) (*Conn, error) {
p := NewInMemoryProvider()
p.AddUser(user, password)
server := NewDefaultServer()

var packetConn *packet.Conn
if defaultServer.tlsConfig != nil {
packetConn = packet.NewTLSConn(conn)
} else {
packetConn = packet.NewConn(conn)
}

c := &Conn{
Conn: packetConn,
serverConf: defaultServer,
credentialProvider: p,
h: h,
connectionID: atomic.AddUint32(&baseConnID, 1),
stmts: make(map[uint32]*Stmt),
salt: mysql.RandomBuf(20),
}
c.closed.Store(false)

if err := c.handshake(); err != nil {
c.Close()
return nil, err
}

return c, nil
return NewCustomizedConn(conn, server, p, h)
}

// NewCustomizedConn: create connection with customized server settings
Expand Down
2 changes: 0 additions & 2 deletions server/server_conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"github.com/go-mysql-org/go-mysql/mysql"
)

var defaultServer = NewDefaultServer()

// Defines a basic MySQL server with configs.
//
// We do not aim at implementing the whole MySQL connection suite to have the best compatibilities for the clients.
Expand Down
Loading