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

Method onConn

IceFireDB-SQLite/internal/mysql/proxy.go:26–55  ·  view source on GitHub ↗
(c net.Conn)

Source from the content-addressed store, hash-verified

24}
25
26func (m *mysqlProxy) onConn(c net.Conn) {
27 conn, err := server.NewClientConn(c, m.server, m.credential, m)
28 if err != nil {
29 return
30 }
31 defer func() {
32 err := recover()
33 if err != nil {
34 const size = 4096
35 buf := make([]byte, size)
36 buf = buf[:runtime.Stack(buf, false)]
37 logrus.Errorf("panic: %s", string(buf))
38 }
39 if !conn.Closed() {
40 conn.Close()
41 }
42 }()
43
44 for {
45 err = conn.HandleCommand()
46 if err != nil {
47 if errors.Is(err, net.ErrClosed) {
48 err = nil
49 return
50 }
51 logrus.Warningf("command error: %v", err)
52 return
53 }
54 }
55}

Callers 1

RunMethod · 0.95

Calls 4

NewClientConnFunction · 0.92
CloseMethod · 0.65
ClosedMethod · 0.45
HandleCommandMethod · 0.45

Tested by

no test coverage detected