Skip to content

Commit

Permalink
fixed on session closed deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
MutsiMutsi committed Jan 9, 2021
1 parent 11d5c40 commit d71f8bc
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions surge/sessionmanager/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,7 @@ func closeSession(address string) {
sessionLockMapLock.Lock()
defer sessionLockMapLock.Unlock()

sessionLockMapLock.Lock()
session, exists := sessionMap[address]
sessionLockMapLock.Unlock()

//Close nkn session, nill out the pointers
if exists {
Expand All @@ -249,9 +247,7 @@ func closeSession(address string) {
session = nil

//Delete from the map
sessionLockMapLock.Lock()
delete(sessionMap, address)
sessionLockMapLock.Unlock()

log.Println("Download Session closed for: ", address)
fmt.Println(string("\033[31m"), "Download Session closed for: ", address, string("\033[0m"))
Expand Down

0 comments on commit d71f8bc

Please sign in to comment.