MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / NewCustomizedConn

Function NewCustomizedConn

IceFireDB-SQLite/pkg/mysql/server/conn.go:82–108  ·  view source on GitHub ↗

NewCustomizedConn: create connection with customized server settings

(conn net.Conn, serverConf *Server, p CredentialProvider, h Handler)

Source from the content-addressed store, hash-verified

80
81// NewCustomizedConn: create connection with customized server settings
82func NewCustomizedConn(conn net.Conn, serverConf *Server, p CredentialProvider, h Handler) (*Conn, error) {
83 var packetConn *packet.Conn
84 if serverConf.tlsConfig != nil {
85 packetConn = packet.NewTLSConn(conn)
86 } else {
87 packetConn = packet.NewConn(conn)
88 }
89
90 salt, _ := RandomBuf(20)
91 c := &Conn{
92 Conn: packetConn,
93 serverConf: serverConf,
94 credentialProvider: p,
95 h: h,
96 connectionID: atomic.AddUint32(&baseConnID, 1),
97 stmts: make(map[uint32]*Stmt),
98 salt: salt,
99 }
100 c.closed.Set(false)
101
102 if err := c.handshake(); err != nil {
103 c.Close()
104 return nil, err
105 }
106
107 return c, nil
108}
109
110// NewClientConn: create connection with customized server settings
111func NewClientConn(conn net.Conn, serverConf *Server, p CredentialProvider, hp Handler) (*Conn, error) {

Callers

nothing calls this directly

Calls 6

handshakeMethod · 0.95
CloseMethod · 0.95
NewTLSConnFunction · 0.92
NewConnFunction · 0.92
SetMethod · 0.80
RandomBufFunction · 0.50

Tested by

no test coverage detected