mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 10:58:35 +08:00
优化
This commit is contained in:
@@ -47,7 +47,7 @@ func handleConnection(conn *net.TCPConn, hs *hook_message_work.HookService) {
|
||||
defer func() {
|
||||
_ = conn.Close()
|
||||
if isAuth {
|
||||
data := netbase.CreateConnectionInfo(message.DisConnectMes, "tcp", conn.RemoteAddr().String(), conn.RemoteAddr().String(), etoken)
|
||||
data := netbase.CreateEvent(message.DisConnectMes, "info", fmt.Sprintf("设备%s断开连接", etoken.Name), etoken)
|
||||
go hs.Queue.Queue(data)
|
||||
}
|
||||
tcpclient.TcpClient.Delete(etoken.DeviceId)
|
||||
@@ -67,7 +67,7 @@ func handleConnection(conn *net.TCPConn, hs *hook_message_work.HookService) {
|
||||
auth := netbase.Auth(token)
|
||||
if auth {
|
||||
global.Log.Infof("TCP协议 设备%s,认证成功", etoken.DeviceId)
|
||||
data := netbase.CreateConnectionInfo(message.ConnectMes, "tcp", conn.RemoteAddr().String(), conn.RemoteAddr().String(), etoken)
|
||||
data := netbase.CreateEvent(message.ConnectMes, "info", fmt.Sprintf("设备%s通过TCP协议连接", etoken.Name), etoken)
|
||||
go hs.Queue.Queue(data)
|
||||
isAuth = true
|
||||
tcpclient.TcpClient.Store(etoken.DeviceId, conn)
|
||||
|
||||
Reference in New Issue
Block a user