()
| 310 | } |
| 311 | |
| 312 | func (ctl *Control) worker() { |
| 313 | xl := ctl.xl |
| 314 | |
| 315 | go ctl.heartbeatWorker() |
| 316 | go ctl.msgDispatcher.Run() |
| 317 | |
| 318 | <-ctl.msgDispatcher.Done() |
| 319 | ctl.sessionCtx.Conn.Close() |
| 320 | |
| 321 | ctl.mu.Lock() |
| 322 | close(ctl.workConnCh) |
| 323 | for workConn := range ctl.workConnCh { |
| 324 | workConn.Close() |
| 325 | } |
| 326 | proxies := ctl.proxies |
| 327 | ctl.proxies = make(map[string]proxy.Proxy) |
| 328 | ctl.mu.Unlock() |
| 329 | |
| 330 | for _, pxy := range proxies { |
| 331 | ctl.closeProxy(pxy) |
| 332 | } |
| 333 | |
| 334 | metrics.Server.CloseClient() |
| 335 | ctl.sessionCtx.ClientRegistry.MarkOfflineByRunID(ctl.runID) |
| 336 | xl.Infof("client exit success") |
| 337 | close(ctl.doneCh) |
| 338 | } |
| 339 | |
| 340 | func (ctl *Control) registerMsgHandlers() { |
| 341 | ctl.msgDispatcher.RegisterHandler(&msg.NewProxy{}, ctl.handleNewProxy) |
no test coverage detected