mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
增加关闭socket function
This commit is contained in:
@@ -152,4 +152,21 @@ func (slf *TcpService) SendMsg(clientid uint64,msg interface{}) error{
|
||||
return err
|
||||
}
|
||||
return client.tcpConn.WriteMsg(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
func (slf *TcpService) Close(clientid uint64) {
|
||||
//
|
||||
slf.mapClientLocker.Lock()
|
||||
defer slf.mapClientLocker.Unlock()
|
||||
|
||||
client,ok := slf.mapClient[clientid]
|
||||
if ok == false{
|
||||
return
|
||||
}
|
||||
|
||||
if client.tcpConn!=nil {
|
||||
client.tcpConn.Close()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user