mirror of
https://github.com/lwch/natpass
synced 2025-10-24 12:53:06 +08:00
修正没有数据的client会被断开连接的问题
This commit is contained in:
@@ -83,9 +83,6 @@ func (h *Handler) readHandshake(c *network.Conn) (string, error) {
|
|||||||
|
|
||||||
// onMessage forward message
|
// onMessage forward message
|
||||||
func (h *Handler) onMessage(msg *network.Msg) {
|
func (h *Handler) onMessage(msg *network.Msg) {
|
||||||
if msg.GetXType() == network.Msg_keepalive {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
to := msg.GetTo()
|
to := msg.GetTo()
|
||||||
h.RLock()
|
h.RLock()
|
||||||
cli := h.clients[to]
|
cli := h.clients[to]
|
||||||
@@ -95,6 +92,9 @@ func (h *Handler) onMessage(msg *network.Msg) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
cli.updated = time.Now()
|
cli.updated = time.Now()
|
||||||
|
if msg.GetXType() == network.Msg_keepalive {
|
||||||
|
return
|
||||||
|
}
|
||||||
h.msgHook(msg)
|
h.msgHook(msg)
|
||||||
cli.writeMessage(msg)
|
cli.writeMessage(msg)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user