diff options
author | Alex Auvolat <alex@adnab.me> | 2020-02-26 23:01:34 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-02-26 23:01:34 +0100 |
commit | 717606a54dee2367cc3aa8c4cee19b0e62c442c5 (patch) | |
tree | 1b23a4c6c1b49a3a7054354a5ea06ccccc7056af | |
parent | 8a5ed3f507d37c52e2a68a23ced6942cc752221d (diff) | |
download | easybridge-717606a54dee2367cc3aa8c4cee19b0e62c442c5.tar.gz easybridge-717606a54dee2367cc3aa8c4cee19b0e62c442c5.zip |
Fix maintenance of connected status
-rw-r--r-- | account.go | 6 | ||||
-rw-r--r-- | connector/irc/irc.go | 1 | ||||
-rw-r--r-- | connector/xmpp/xmpp.go | 1 |
3 files changed, 5 insertions, 3 deletions
@@ -34,13 +34,13 @@ func SetAccount(mxid string, name string, protocol string, config map[string]str accounts := registeredAccounts[mxid] if prev_acct, ok := accounts[name]; ok { - prev_acct.Conn.Close() - prev_acct.JoinedRooms = map[RoomID]bool{} - if protocol != prev_acct.Protocol { return fmt.Errorf("Wrong protocol") } if !reflect.DeepEqual(config, prev_acct.Config) { + prev_acct.Conn.Close() + prev_acct.JoinedRooms = map[RoomID]bool{} + prev_acct.Config = config go prev_acct.connect() } diff --git a/connector/irc/irc.go b/connector/irc/irc.go index d69884e..977b71d 100644 --- a/connector/irc/irc.go +++ b/connector/irc/irc.go @@ -251,6 +251,7 @@ func (irc *IRC) Send(event *Event) error { func (irc *IRC) Close() { conn := irc.conn irc.conn = nil + irc.connected = false if conn != nil { conn.Close() } diff --git a/connector/xmpp/xmpp.go b/connector/xmpp/xmpp.go index f1a75b2..4af016c 100644 --- a/connector/xmpp/xmpp.go +++ b/connector/xmpp/xmpp.go @@ -351,4 +351,5 @@ func (xm *XMPP) Close() { } xm.conn = nil xm.connectorLoopNum += 1 + xm.connected = false } |