summaryrefslogtreecommitdiffstats
path: root/matterclient/matterclient.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-12-08 00:07:24 +0100
committerWim <wim@42.be>2016-12-08 00:07:24 +0100
commitadec73f542769b6e8fd9f6a57447c439761c7500 (patch)
tree16a93d2f0e536b37093c01d4dc9fce849393bdad /matterclient/matterclient.go
parentfee159541f60bad245794cda69649fab569c2024 (diff)
downloadmatterbridge-msglm-adec73f542769b6e8fd9f6a57447c439761c7500.tar.gz
matterbridge-msglm-adec73f542769b6e8fd9f6a57447c439761c7500.tar.bz2
matterbridge-msglm-adec73f542769b6e8fd9f6a57447c439761c7500.zip
Check errors only on first connect. Keep retrying after first connection succeeds. (mattermost) Closes #95
Diffstat (limited to 'matterclient/matterclient.go')
-rw-r--r--matterclient/matterclient.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go
index 3ee6fca6..70493693 100644
--- a/matterclient/matterclient.go
+++ b/matterclient/matterclient.go
@@ -80,6 +80,11 @@ func (m *MMClient) SetLogLevel(level string) {
}
func (m *MMClient) Login() error {
+ // check if this is a first connect or a reconnection
+ firstConnection := true
+ if m.WsConnected == true {
+ firstConnection = false
+ }
m.WsConnected = false
if m.WsQuit {
return nil
@@ -125,11 +130,7 @@ func (m *MMClient) Login() error {
if appErr != nil {
d := b.Duration()
m.log.Debug(appErr.DetailedError)
- //TODO more generic fix needed
- if !strings.Contains(appErr.DetailedError, "connection refused") &&
- !strings.Contains(appErr.DetailedError, "invalid character") &&
- !strings.Contains(appErr.DetailedError, "connection reset by peer") &&
- !strings.Contains(appErr.DetailedError, "connection timed out") {
+ if firstConnection {
if appErr.Message == "" {
return errors.New(appErr.DetailedError)
}