From 43495a17ef5e263efda04b81755c18a8d26571a9 Mon Sep 17 00:00:00 2001 From: Liam Stanley Date: Sat, 11 Feb 2017 18:06:08 -0500 Subject: [PATCH] don't panic if reconnect() is called internally --- client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 6c361ef..f1149e7 100644 --- a/client.go +++ b/client.go @@ -392,7 +392,7 @@ func (c *Client) connectMessages() (events []*Event) { // to the server. func (c *Client) reconnect(remoteInvoked bool) (err error) { if c.stopped { - panic(ErrCalledAfterStop) + return nil } if c.state.reconnecting { @@ -443,6 +443,10 @@ func (c *Client) reconnect(remoteInvoked bool) (err error) { // reconnect checks to make sure we want to, and then attempts to reconnect // to the server. func (c *Client) Reconnect() error { + if c.stopped { + panic(ErrCalledAfterStop) + } + return c.reconnect(true) }