Closed mvdan closed 8 years ago
Hi @mvdan
Upon disconnection, ReadLoop
will attempt to reconnect if it's configured to: https://github.com/nickvanw/ircx/blob/master/bot.go#L116
By setting the MaxRetries
to anything above 0, it will automatically reconnect when there is a read error.
I think adding an error return to HandleLoop
may be a good additional step, thoughts?
I see, hadn't noticed you could configure MaxRetries
. That works for me, as I don't need a stricter control over disconnects and retries.
Sure, HandleLoop
could return an error.
So I wasn't closing this issue because I was getting send errors after a reconnet.
Reason: I'm an idiot. This was happening because I had a pointer to Sender
, not to Bot
. So on Reconnect()
, when it called Connect()
again, it would create a new Sender
. I would get stuck with the old sender, which had a disonnected tcp connection.
Before the logs were removed, it showed this before dying:
Now it just dies, as expected.
This is when connected to freenode. This is when using
HandleLoop
like in the example code.I suggest one of two options:
HandleLoop
silently take care of this, either by ignoring the error or by reconnecting. Not sure if a reconnection is necessary.HandleLoop
so that it returnserror
, and makes us decide to re-run it if we wish to, e.g.:(assuming no reconnect is required)