]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
better failure to connect behaviour
authorTom Gilbert <tom@linuxbrit.co.uk>
Mon, 5 Sep 2005 12:06:21 +0000 (12:06 +0000)
committerTom Gilbert <tom@linuxbrit.co.uk>
Mon, 5 Sep 2005 12:06:21 +0000 (12:06 +0000)
lib/rbot/ircbot.rb
lib/rbot/ircsocket.rb

index 8e265541410a243f94605eda42521c7d571e3e2a..2443ec95d7ae0865423a2b4a4117245c55cb77ea 100644 (file)
@@ -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
 
index af605e371962eedd69bfd19480751d2153d8d875..7ceba21b91858664c4b2644ccced8c0f7f97f625 100644 (file)
@@ -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