Unverified Commit f6c81725 authored by Eric_Lee's avatar Eric_Lee Committed by GitHub

[Update] add session terminated log (#189)

parent 6f1e6812
...@@ -46,6 +46,7 @@ func (s *DBSwitchSession) Terminate() { ...@@ -46,6 +46,7 @@ func (s *DBSwitchSession) Terminate() {
default: default:
} }
s.cancel() s.cancel()
logger.Infof("DBSession %s: receive terminate from admin", s.ID)
} }
func (s *DBSwitchSession) SessionID() string { func (s *DBSwitchSession) SessionID() string {
...@@ -154,6 +155,7 @@ func (s *DBSwitchSession) Bridge(userConn UserConnection, srvConn srvconn.Server ...@@ -154,6 +155,7 @@ func (s *DBSwitchSession) Bridge(userConn UserConnection, srvConn srvconn.Server
case <-s.ctx.Done(): case <-s.ctx.Done():
msg := i18n.T("Database connection terminated by administrator") msg := i18n.T("Database connection terminated by administrator")
msg = utils.WrapperWarn(msg) msg = utils.WrapperWarn(msg)
logger.Infof("DBSession %s: %s", s.ID, msg)
utils.IgnoreErrWriteString(userConn, "\n\r"+msg) utils.IgnoreErrWriteString(userConn, "\n\r"+msg)
return return
// 监控窗口大小变化 // 监控窗口大小变化
......
...@@ -55,6 +55,7 @@ func (s *SwitchSession) Terminate() { ...@@ -55,6 +55,7 @@ func (s *SwitchSession) Terminate() {
default: default:
} }
s.cancel() s.cancel()
logger.Infof("Session %s: receive terminate from admin", s.ID)
} }
func (s *SwitchSession) SessionID() string { func (s *SwitchSession) SessionID() string {
...@@ -179,6 +180,7 @@ func (s *SwitchSession) Bridge(userConn UserConnection, srvConn srvconn.ServerCo ...@@ -179,6 +180,7 @@ func (s *SwitchSession) Bridge(userConn UserConnection, srvConn srvconn.ServerCo
case <-s.ctx.Done(): case <-s.ctx.Done():
msg := i18n.T("Terminated by administrator") msg := i18n.T("Terminated by administrator")
msg = utils.WrapperWarn(msg) msg = utils.WrapperWarn(msg)
logger.Infof("Session %s: %s", s.ID, msg)
utils.IgnoreErrWriteString(userConn, "\n\r"+msg) utils.IgnoreErrWriteString(userConn, "\n\r"+msg)
return return
// 监控窗口大小变化 // 监控窗口大小变化
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment