From 5a06676cdec9d4b43767f39ef2dea3b735a964a5 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Mon, 5 Sep 2005 12:06:21 +0000 Subject: [PATCH 1/1] better failure to connect behaviour --- lib/rbot/ircbot.rb | 3 --- lib/rbot/ircsocket.rb | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 8e265541..2443ec95 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -51,9 +51,6 @@ class IrcBot # bot's Language data attr_reader :lang - # bot's configured addressing prefixes - attr_reader :addressing_prefixes - # channel info for channels the bot is in attr_reader :channels diff --git a/lib/rbot/ircsocket.rb b/lib/rbot/ircsocket.rb index af605e37..7ceba21b 100644 --- a/lib/rbot/ircsocket.rb +++ b/lib/rbot/ircsocket.rb @@ -31,6 +31,7 @@ module Irc @server = server.dup @port = port.to_i @host = host + @sock = nil @spooler = false @lines_sent = 0 @lines_received = 0 @@ -50,6 +51,7 @@ module Irc # open a TCP connection to the server def connect + @sock = nil if(@host) begin @sock=TCPSocket.new(@server, @port, @host) @@ -165,7 +167,8 @@ module Irc # shutdown the connection to the server def shutdown(how=2) - @sock.shutdown(how) + @sock.shutdown(how) unless @sock.nil? + @sock = nil end private -- 2.39.2