mirror of
https://github.com/lwch/natpass
synced 2025-10-20 19:35:56 +08:00
修正server端的connect_req和connect_rep消息没有保持同一条通路的问题
This commit is contained in:
@@ -159,8 +159,7 @@ func (h *Handler) msgHook(msg *network.Msg, toCli *client) {
|
|||||||
fromCli := h.clients[from]
|
fromCli := h.clients[from]
|
||||||
h.RUnlock()
|
h.RUnlock()
|
||||||
switch msg.GetXType() {
|
switch msg.GetXType() {
|
||||||
case network.Msg_connect_rep:
|
case network.Msg_connect_req:
|
||||||
if msg.GetCrep().GetOk() {
|
|
||||||
id := msg.GetCrep().GetId()
|
id := msg.GetCrep().GetId()
|
||||||
var pair [2]*client
|
var pair [2]*client
|
||||||
if fromCli != nil {
|
if fromCli != nil {
|
||||||
@@ -174,7 +173,6 @@ func (h *Handler) msgHook(msg *network.Msg, toCli *client) {
|
|||||||
h.Lock()
|
h.Lock()
|
||||||
h.links[id] = pair
|
h.links[id] = pair
|
||||||
h.Unlock()
|
h.Unlock()
|
||||||
}
|
|
||||||
case network.Msg_disconnect:
|
case network.Msg_disconnect:
|
||||||
if fromCli != nil {
|
if fromCli != nil {
|
||||||
fromCli.removeLink(msg.GetXDisconnect().GetId())
|
fromCli.removeLink(msg.GetXDisconnect().GetId())
|
||||||
|
Reference in New Issue
Block a user