diff options
author | Dmitry Kim <dmitry point kim at gmail point com> | 2007-10-11 22:15:35 +0000 |
---|---|---|
committer | Dmitry Kim <dmitry point kim at gmail point com> | 2007-10-11 22:15:35 +0000 |
commit | 676672a22bec12520e0c39c49e9894fbf7e6cf1b (patch) | |
tree | 31b938dcb229f87bbdcaf7f293810613791be18d | |
parent | a9f009d3bfe01e51d0157583ca942a522c6a552c (diff) |
* (ircsocket) inconsistent socket state after ssl exceptions in connect(), fixed
-rw-r--r-- | lib/rbot/ircsocket.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/rbot/ircsocket.rb b/lib/rbot/ircsocket.rb index 0c669abd..2e6ff452 100644 --- a/lib/rbot/ircsocket.rb +++ b/lib/rbot/ircsocket.rb @@ -310,26 +310,26 @@ module Irc if(@host) begin - @sock=TCPSocket.new(@server_uri.host, @server_uri.port, @host) + sock=TCPSocket.new(@server_uri.host, @server_uri.port, @host) rescue ArgumentError => e error "Your version of ruby does not support binding to a " error "specific local address, please upgrade if you wish " error "to use HOST = foo" error "(this option has been disabled in order to continue)" - @sock=TCPSocket.new(@server_uri.host, @server_uri.port) + sock=TCPSocket.new(@server_uri.host, @server_uri.port) end else - @sock=TCPSocket.new(@server_uri.host, @server_uri.port) + sock=TCPSocket.new(@server_uri.host, @server_uri.port) end if(@ssl) require 'openssl' ssl_context = OpenSSL::SSL::SSLContext.new() ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE - @rawsock = @sock - @sock = OpenSSL::SSL::SSLSocket.new(@rawsock, ssl_context) - @sock.sync_close = true - @sock.connect + sock = OpenSSL::SSL::SSLSocket.new(sock, ssl_context) + sock.sync_close = true + sock.connect end + @sock = sock @last_send = Time.new - @sendq_delay @flood_send = Time.new @last_throttle = Time.new @@ -404,7 +404,6 @@ module Irc rescue Exception => e error "error while shutting down: #{e.pretty_inspect}" end - @rawsock = nil if @ssl @sock = nil @burst = 0 @sendq.clear |