mirror of
https://github.com/lwch/natpass.git
synced 2026-10-21 05:22:00 +00:00
修正server端获取链接时错误的逻辑
This commit is contained in:
@@ -86,3 +86,7 @@ func (c *client) closeLink(id string) {
|
||||
delete(c.links, id)
|
||||
c.Unlock()
|
||||
}
|
||||
|
||||
func (c *client) is(id string, idx uint32) bool {
|
||||
return c.parent.id == id && c.idx == idx
|
||||
}
|
||||
|
||||
@@ -99,10 +99,10 @@ func (h *Handler) getClient(linkID, to string, toIdx uint32) *client {
|
||||
pair := h.links[linkID]
|
||||
h.lockLinks.RUnlock()
|
||||
|
||||
if pair[0] != nil && pair[0].idx == toIdx {
|
||||
if pair[0] != nil && pair[0].is(to, toIdx) {
|
||||
return pair[0]
|
||||
}
|
||||
if pair[1] != nil && pair[1].idx == toIdx {
|
||||
if pair[1] != nil && pair[1].is(to, toIdx) {
|
||||
return pair[1]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user