增加server端的from字段改写逻辑

This commit is contained in:
lwch
2021-08-24 16:09:18 +08:00
parent 423208574f
commit 58bd53cb57

View File

@@ -170,13 +170,18 @@ func (h *Handler) msgHook(msg *network.Msg, from, to *client) {
h.links[id] = pair
h.Unlock()
case network.Msg_disconnect:
id := msg.GetXDisconnect().GetId()
if from != nil {
from.removeLink(msg.GetXDisconnect().GetId())
from.removeLink(id)
}
if to != nil {
to.removeLink(msg.GetXDisconnect().GetId())
to.removeLink(id)
}
h.Lock()
delete(h.links, id)
h.Unlock()
}
msg.From = from.trimID
}
// closeAll close all links from client