Fix delete-session not deleting all cached state
This commit is contained in:
parent
1379e46e1e
commit
f21f57f09f
@ -458,6 +458,7 @@ func (handler *CommandHandler) CommandDeleteSession(ce *CommandEvent) {
|
||||
ce.Reply("Nothing to purge: no session information stored and no active connection.")
|
||||
return
|
||||
}
|
||||
ce.User.removeFromJIDMap()
|
||||
ce.User.SetSession(nil)
|
||||
if ce.User.Conn != nil {
|
||||
_, _ = ce.User.Conn.Disconnect()
|
||||
|
5
user.go
5
user.go
@ -107,7 +107,10 @@ func (user *User) addToJIDMap() {
|
||||
|
||||
func (user *User) removeFromJIDMap() {
|
||||
user.bridge.usersLock.Lock()
|
||||
delete(user.bridge.usersByJID, user.JID)
|
||||
jidUser, ok := user.bridge.usersByJID[user.JID]
|
||||
if ok && user == jidUser {
|
||||
delete(user.bridge.usersByJID, user.JID)
|
||||
}
|
||||
user.bridge.usersLock.Unlock()
|
||||
user.bridge.Metrics.TrackLoginState(user.JID, false)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user