From 07fd825349e8b7e86f8afb3843cb8e2c2afc7c74 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 25 Mar 2017 20:45:10 +0100 Subject: Update vendor --- vendor/github.com/sromku/go-gitter/stream.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'vendor/github.com/sromku') diff --git a/vendor/github.com/sromku/go-gitter/stream.go b/vendor/github.com/sromku/go-gitter/stream.go index 4a5a3c68..67a907cf 100644 --- a/vendor/github.com/sromku/go-gitter/stream.go +++ b/vendor/github.com/sromku/go-gitter/stream.go @@ -47,13 +47,13 @@ Loop: } break Loop } - + resp := stream.getResponse() if resp.StatusCode != 200 { gitter.log(fmt.Sprintf("Unexpected response code %v", resp.StatusCode)) continue } - + //"The JSON stream returns messages as JSON objects that are delimited by carriage return (\r)" <- Not true crap it's (\n) only reader = bufio.NewReader(resp.Body) line, err := reader.ReadBytes('\n') @@ -112,6 +112,7 @@ type Stream struct { func (stream *Stream) destroy() { close(stream.Event) + stream.streamConnection.currentRetries = 0 } type Event struct { @@ -135,10 +136,8 @@ func (stream *Stream) connect() { } res, err := stream.gitter.getResponse(stream.url, stream) - if stream.streamConnection.canceled { - // do nothing - } else if err != nil || res.StatusCode != 200 { - stream.gitter.log("Failed to get response, trying reconnect ") + if err != nil || res.StatusCode != 200 { + stream.gitter.log(fmt.Sprintf("Failed to get response, trying reconnect (Status code: %v)", res.StatusCode)) stream.gitter.log(err) // sleep and wait @@ -161,9 +160,6 @@ type streamConnection struct { // connection was closed closed bool - // canceled - canceled bool - // wait time till next try wait time.Duration @@ -192,13 +188,10 @@ func (stream *Stream) Close() { stream.gitter.log("Stream connection close request") switch transport := stream.gitter.config.client.Transport.(type) { case *httpclient.Transport: - stream.streamConnection.canceled = true transport.CancelRequest(conn.request) default: } - } - conn.currentRetries = 0 } func (stream *Stream) isClosed() bool { -- cgit v1.2.3