don't panic if reconnect() is called internally

This commit is contained in:
Liam Stanley 2017-02-11 18:06:08 -05:00
parent fb8b55718d
commit 43495a17ef

View File

@ -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)
}