mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
fix channel multiple close bug and concurrency bug in the way sessionInfo.close was being called
This commit is contained in:
parent
43bcb9e154
commit
7d58a7ef3e
2 changed files with 6 additions and 3 deletions
|
@ -269,8 +269,11 @@ func (ss *sessions) cleanup() {
|
|||
|
||||
// Closes a session, removing it from sessions maps and killing the worker goroutine.
|
||||
func (sinfo *sessionInfo) close() {
|
||||
delete(sinfo.core.sessions.sinfos, sinfo.myHandle)
|
||||
delete(sinfo.core.sessions.byTheirPerm, sinfo.theirPermPub)
|
||||
if s := sinfo.core.sessions.sinfos[sinfo.myHandle]; s == sinfo {
|
||||
delete(sinfo.core.sessions.sinfos, sinfo.myHandle)
|
||||
delete(sinfo.core.sessions.byTheirPerm, sinfo.theirPermPub)
|
||||
}
|
||||
defer func() { recover() }()
|
||||
close(sinfo.worker)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue