Skip to content

Commit

Permalink
Unregistering sessions on acceptor stop
Browse files Browse the repository at this point in the history
  • Loading branch information
SNORRIS721 committed May 3, 2024
1 parent 6659865 commit cf3fb98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions acceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ func (a *Acceptor) Stop() {
session.stop()
}
a.sessionGroup.Wait()

for sessionID := range a.sessions {
err := UnregisterSession(sessionID)
if err != nil {
return
}
}
}

// RemoteAddr gets remote IP address for a given session.
Expand Down
4 changes: 2 additions & 2 deletions initiator.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ func (i *Initiator) Stop() {
}
close(i.stopChan)

i.wg.Wait()

for sessionID := range i.sessionSettings {
err := UnregisterSession(sessionID)
if err != nil {
return
}
}

i.wg.Wait()
}

// NewInitiator creates and initializes a new Initiator.
Expand Down

0 comments on commit cf3fb98

Please sign in to comment.