1
This commit is contained in:
@@ -149,11 +149,25 @@ func (t *TcpClient) delConn(key string) {
|
||||
t.Lock()
|
||||
defer t.Unlock()
|
||||
if t.Clients[key].C != nil {
|
||||
globals.SugarLogger.Debugf("-------close2 := %s", key)
|
||||
t.Clients[key].C.Close()
|
||||
}
|
||||
delete(t.Clients, key)
|
||||
}
|
||||
|
||||
func (t *TcpClient) clear(key string) {
|
||||
t.Lock()
|
||||
defer t.Unlock()
|
||||
t.Clients[key].C.Close()
|
||||
globals.SugarLogger.Debugf("-------close3 := %s", key)
|
||||
delete(t.Clients, key)
|
||||
close(t.MsgMap[key])
|
||||
delete(t.MsgMap, key)
|
||||
close(t.CallBackMap[key])
|
||||
delete(t.CallBackMap, key)
|
||||
delete(t.TimeoutMap, key)
|
||||
}
|
||||
|
||||
//添加到连接池中
|
||||
func addConn(c net.Conn, t *TcpClient, key string, status int) {
|
||||
t.Lock()
|
||||
@@ -326,18 +340,6 @@ func (t *TcpClient) GetCallbackChan(key string) string {
|
||||
return <-t.CallBackMap[key]
|
||||
}
|
||||
|
||||
func (t *TcpClient) clear(key string) {
|
||||
t.Lock()
|
||||
defer t.Unlock()
|
||||
t.Clients[key].C.Close()
|
||||
delete(t.Clients, key)
|
||||
close(t.MsgMap[key])
|
||||
delete(t.MsgMap, key)
|
||||
close(t.CallBackMap[key])
|
||||
delete(t.CallBackMap, key)
|
||||
delete(t.TimeoutMap, key)
|
||||
}
|
||||
|
||||
func NewTcpClient() *TcpClient {
|
||||
t := &TcpClient{
|
||||
Clients: make(map[string]*PrintInfo),
|
||||
|
||||
Reference in New Issue
Block a user