This repository was archived by the owner on Jan 28, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,12 @@ func (s *SessionManager) NewSession(conn *mysql.Conn) {
64
64
s .mu .Unlock ()
65
65
}
66
66
67
+ func (s * SessionManager ) session (conn * mysql.Conn ) sql.Session {
68
+ s .mu .Lock ()
69
+ defer s .mu .Unlock ()
70
+ return s .sessions [conn .ConnectionID ]
71
+ }
72
+
67
73
// NewContext creates a new context for the session at the given conn.
68
74
func (s * SessionManager ) NewContext (conn * mysql.Conn ) * sql.Context {
69
75
return s .NewContextWithQuery (conn , "" )
Original file line number Diff line number Diff line change @@ -150,12 +150,11 @@ func (h *Handler) ComQuery(
150
150
// ComQuery callback if the result does not contain any fields,
151
151
// or after the last ComQuery call completes.
152
152
func (h * Handler ) WarningCount (c * mysql.Conn ) uint16 {
153
- sess , ok := h .sm .sessions [c .ConnectionID ]
154
- if ! ok {
155
- return 0
153
+ if sess := h .sm .session (c ); sess != nil {
154
+ return sess .WarningCount ()
156
155
}
157
156
158
- return sess . WarningCount ()
157
+ return 0
159
158
}
160
159
161
160
func (h * Handler ) handleKill (conn * mysql.Conn , query string ) (bool , error ) {
You can’t perform that action at this time.
0 commit comments