summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-03-11 01:54:29 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-03-11 01:54:29 +0100
commitfc8a94f8368043f8162e2d2981e6ac6957a863e3 (patch)
tree22e1ca434858352bc9833db31b2f0492583ef2cd /lib
parent2d660d540053c05a300264bee59f6dfd41829bfc (diff)
ircbot: don't die on SocketError during disconnect
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/ircbot.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index 42e3c9b6..f15cb351 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -1042,12 +1042,16 @@ class Bot
def disconnect(message=nil)
message = @lang.get("quit") if (!message || message.empty?)
if @socket.connected?
- debug "Clearing socket"
- @socket.clearq
- debug "Sending quit message"
- @socket.emergency_puts "QUIT :#{message}"
- debug "Flushing socket"
- @socket.flush
+ begin
+ debug "Clearing socket"
+ @socket.clearq
+ debug "Sending quit message"
+ @socket.emergency_puts "QUIT :#{message}"
+ debug "Flushing socket"
+ @socket.flush
+ rescue SocketError => e
+ error "error while disconnecting socket: #{e.pretty_inspect}"
+ end
debug "Shutting down socket"
@socket.shutdown
end