Disconnect clients when stopping bridge

This commit is contained in:
Tulir Asokan 2019-05-23 19:16:29 +03:00
parent d7b36d55d7
commit 94ba2244b0

View file

@ -197,6 +197,15 @@ func (bridge *Bridge) StartUsers() {
func (bridge *Bridge) Stop() { func (bridge *Bridge) Stop() {
bridge.AS.Stop() bridge.AS.Stop()
bridge.EventProcessor.Stop() bridge.EventProcessor.Stop()
for _, user := range bridge.usersByJID {
bridge.Log.Debugln("Disconnecting", user.MXID)
sess, err := user.Conn.Disconnect()
if err != nil {
bridge.Log.Errorfln("Error while disconnecting %s: %v", user.MXID, err)
} else {
user.SetSession(&sess)
}
}
err := bridge.StateStore.Save() err := bridge.StateStore.Save()
if err != nil { if err != nil {
bridge.Log.Warnln("Failed to save state store:", err) bridge.Log.Warnln("Failed to save state store:", err)