From 95fac548bbedb541b1b6d383b2053e7a06a7d8d2 Mon Sep 17 00:00:00 2001
From: Wim <wim@42.be>
Date: Wed, 2 Nov 2016 20:00:00 +0100
Subject: [PATCH] Reconnect on connection reset by peer (mattermost). Fixes #69

---
 matterclient/matterclient.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go
index 37530480..aa944a18 100644
--- a/matterclient/matterclient.go
+++ b/matterclient/matterclient.go
@@ -126,7 +126,8 @@ func (m *MMClient) Login() error {
 			d := b.Duration()
 			m.log.Debug(appErr.DetailedError)
 			if !strings.Contains(appErr.DetailedError, "connection refused") &&
-				!strings.Contains(appErr.DetailedError, "invalid character") {
+				!strings.Contains(appErr.DetailedError, "invalid character") &&
+				!strings.Contains(appErr.DetailedError, "connection reset by peer") {
 				if appErr.Message == "" {
 					return errors.New(appErr.DetailedError)
 				}