mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Break deadlock by creating session recv queue when session is created instead of repointing at search completion, also make expired atomic
This commit is contained in:
parent
5a02e2ff44
commit
47eb2fc47f
3 changed files with 32 additions and 44 deletions
|
@ -321,6 +321,7 @@ func (ss *sessions) createSession(theirPermKey *crypto.BoxPubKey) *sessionInfo {
|
|||
sinfo.theirAddr = *address.AddrForNodeID(crypto.GetNodeID(&sinfo.theirPermPub))
|
||||
sinfo.theirSubnet = *address.SubnetForNodeID(crypto.GetNodeID(&sinfo.theirPermPub))
|
||||
sinfo.worker = make(chan func(), 1)
|
||||
sinfo.recv = make(chan *wire_trafficPacket, 32)
|
||||
ss.sinfos[sinfo.myHandle] = &sinfo
|
||||
ss.byMySes[sinfo.mySesPub] = &sinfo.myHandle
|
||||
ss.byTheirPerm[sinfo.theirPermPub] = &sinfo.myHandle
|
||||
|
@ -480,12 +481,11 @@ func (ss *sessions) handlePing(ping *sessionPing) {
|
|||
mutex: &sync.RWMutex{},
|
||||
nodeID: crypto.GetNodeID(&sinfo.theirPermPub),
|
||||
nodeMask: &crypto.NodeID{},
|
||||
recv: make(chan *wire_trafficPacket, 32),
|
||||
recv: sinfo.recv,
|
||||
}
|
||||
for i := range conn.nodeMask {
|
||||
conn.nodeMask[i] = 0xFF
|
||||
}
|
||||
sinfo.recv = conn.recv
|
||||
ss.listener.conn <- conn
|
||||
} else {
|
||||
ss.core.log.Debugln("Received new session but there is no listener, ignoring")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue