diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-01-15 20:30:06 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-01-15 20:57:31 +0100 |
commit | 929205f7c7e94daf83f6d762ff7614753cfaa712 (patch) | |
tree | cf0d1dbe27bd262636687211760acabff2a1093f /data/rbot/plugins/bash.rb | |
parent | 4a9285ca12580656a8269c16e90e2bcd9374ae74 (diff) |
ircbot: fix reconnect() waiting
The refactored reconnect() method would only wait when the socket was
connected at the time it got called. In case where the socket would have
closed earlier (e.g. because of a network I/O error) it would reconnect
directly, which would for example fail to prevent fast reconnections.
Fix by fencing the wait code with a check for @last_rec (checked before the
optional disconnect) rather than keeping it with the socket connect check,
and always initializing @last_rec on socket connect.
A side effect of this strategy is that reconnect() will only wait if the bot
was previously connect, or if it got disconnected by anything but the
disconnect() method. Callers of disconnect() should take care of waiting
themselves if they plan to reconnect.
Diffstat (limited to 'data/rbot/plugins/bash.rb')
0 files changed, 0 insertions, 0 deletions