]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
giuseppe.bilotta's patch: "Fix exception when connection with server times out"
authorChris Gahan <chris@ill-logic.com>
Thu, 1 Jun 2006 06:13:29 +0000 (06:13 +0000)
committerChris Gahan <chris@ill-logic.com>
Thu, 1 Jun 2006 06:13:29 +0000 (06:13 +0000)
lib/rbot/ircsocket.rb

index 7ceba21b91858664c4b2644ccced8c0f7f97f625..df1f4e8ad17856cdb5ee15a6382344ae2dc7e4bc 100644 (file)
@@ -100,11 +100,15 @@ module Irc
 
     # get the next line from the server (blocks)
     def gets
-      reply = @sock.gets
-      @lines_received += 1
-      reply.strip! if reply
-      debug "RECV: #{reply.inspect}"
-      reply
+      begin
+       reply = @sock.gets
+       @lines_received += 1
+       reply.strip! if reply
+       debug "RECV: #{reply.inspect}"
+       return reply
+      rescue
+       return nil
+      end
     end
 
     def queue(msg)