summaryrefslogtreecommitdiff
path: root/lib/rbot/ircsocket.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbot/ircsocket.rb')
-rw-r--r--lib/rbot/ircsocket.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rbot/ircsocket.rb b/lib/rbot/ircsocket.rb
index 7b4175de..6ff93725 100644
--- a/lib/rbot/ircsocket.rb
+++ b/lib/rbot/ircsocket.rb
@@ -49,9 +49,15 @@ module Irc
end
end
+ def connected?
+ !@sock.nil?
+ end
+
# open a TCP connection to the server
def connect
- @sock = nil
+ if connected?
+ shutdown
+ end
if(@host)
begin
@sock=TCPSocket.new(@server, @port, @host)