summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rbot/ircbot.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index 0cfc3f12..aebb7db4 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -490,12 +490,14 @@ class IrcBot
# @registry.close
debug "Cleaning up the db environment"
DBTree.cleanup_env
- debug "Sending quit message"
- @socket.puts "QUIT :#{message}"
- debug "Flushing socket"
- @socket.flush
- debug "Shutting down socket"
- @socket.shutdown
+ if @socket.connected?
+ debug "Sending quit message"
+ @socket.puts "QUIT :#{message}"
+ debug "Flushing socket"
+ @socket.flush
+ debug "Shutting down socket"
+ @socket.shutdown
+ end
puts "rbot quit (#{message})"
end