Move to actual closing routine

This commit is contained in:
Harry Cheng 2022-03-03 09:49:10 +08:00
parent 782a7c085a
commit ecff348b78

View File

@ -376,6 +376,20 @@ func (ctl *Control) stoper() {
pxy.Close() pxy.Close()
ctl.pxyManager.Del(pxy.GetName()) ctl.pxyManager.Del(pxy.GetName())
metrics.Server.CloseProxy(pxy.GetName(), pxy.GetConf().GetBaseInfo().ProxyType) metrics.Server.CloseProxy(pxy.GetName(), pxy.GetConf().GetBaseInfo().ProxyType)
notifyContent := &plugin.CloseProxyContent{
User: plugin.UserInfo{
User: ctl.loginMsg.User,
Metas: ctl.loginMsg.Metas,
RunID: ctl.loginMsg.RunID,
},
CloseProxy: msg.CloseProxy{
ProxyName: pxy.GetName(),
},
}
go func() {
ctl.pluginManager.CloseProxy(notifyContent)
}()
} }
ctl.allShutdown.Done() ctl.allShutdown.Done()
@ -453,17 +467,6 @@ func (ctl *Control) manager() {
} }
ctl.sendCh <- resp ctl.sendCh <- resp
case *msg.CloseProxy: case *msg.CloseProxy:
content := &plugin.CloseProxyContent{
User: plugin.UserInfo{
User: ctl.loginMsg.User,
Metas: ctl.loginMsg.Metas,
RunID: ctl.loginMsg.RunID,
},
CloseProxy: *m,
}
ctl.pluginManager.CloseProxy(content)
ctl.CloseProxy(m) ctl.CloseProxy(m)
xl.Info("close proxy [%s] success", m.ProxyName) xl.Info("close proxy [%s] success", m.ProxyName)
case *msg.Ping: case *msg.Ping: