5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-10 09:50:27 +00:00

Merge pull request #445 from Arceliar/dial

more bugfixes
This commit is contained in:
Arceliar 2019-06-29 17:48:12 -05:00 committed by GitHub
commit 0fb1165b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -256,7 +256,7 @@ func (c *Conn) Close() error {
defer c.mutex.Unlock() defer c.mutex.Unlock()
if c.session != nil { if c.session != nil {
// Close the session, if it hasn't been closed already // Close the session, if it hasn't been closed already
c.session.close() c.core.router.doAdmin(c.session.close)
} }
// This can't fail yet - TODO? // This can't fail yet - TODO?
c.closed = true c.closed = true

View File

@ -269,8 +269,11 @@ func (ss *sessions) cleanup() {
// Closes a session, removing it from sessions maps and killing the worker goroutine. // Closes a session, removing it from sessions maps and killing the worker goroutine.
func (sinfo *sessionInfo) close() { func (sinfo *sessionInfo) close() {
if s := sinfo.core.sessions.sinfos[sinfo.myHandle]; s == sinfo {
delete(sinfo.core.sessions.sinfos, sinfo.myHandle) delete(sinfo.core.sessions.sinfos, sinfo.myHandle)
delete(sinfo.core.sessions.byTheirPerm, sinfo.theirPermPub) delete(sinfo.core.sessions.byTheirPerm, sinfo.theirPermPub)
}
defer func() { recover() }()
close(sinfo.worker) close(sinfo.worker)
} }