diff options
author | Chris Gahan <chris@ill-logic.com> | 2006-06-01 06:13:29 +0000 |
---|---|---|
committer | Chris Gahan <chris@ill-logic.com> | 2006-06-01 06:13:29 +0000 |
commit | 044b659e50c0c3f90f1de2b48a482a48b0668918 (patch) | |
tree | f0c09c28f313fc444d65e4b09ace23061ae38ac0 | |
parent | 8836539ba33a7507c23af1f410dbf78d36503148 (diff) |
giuseppe.bilotta's patch: "Fix exception when connection with server times out"
-rw-r--r-- | lib/rbot/ircsocket.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/rbot/ircsocket.rb b/lib/rbot/ircsocket.rb index 7ceba21b..df1f4e8a 100644 --- a/lib/rbot/ircsocket.rb +++ b/lib/rbot/ircsocket.rb @@ -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) |