Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 26a4d43f12a2cc7ec3f107e575995d2800f0be00 Author: Wim <wim@42.be> Date: Thu Dec 08 00:07:24 2016 +0000 Check errors only on first connect. Keep retrying after first connection succeeds. (mattermost) Closes #95 diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index 3ee6fca..7049369 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -806 +8011 @@ 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 @@ -12511 +1307 @@ 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)   }