diff --git a/lib/em/connection.rb b/lib/em/connection.rb index bbf71c288..47a602cb9 100644 --- a/lib/em/connection.rb +++ b/lib/em/connection.rb @@ -53,9 +53,9 @@ def self.new(sig, *args) #:nodoc: def initialize(*args) #:nodoc: end - def associate_callback_target(sig) #:nodoc: - # no-op for the time being, to match similar no-op in rubymain.cpp - end + # def associate_callback_target(sig) #:nodoc: + # # no-op for the time being, to match similar no-op in rubymain.cpp + # end # EventMachine::Connection#post_init is called by the event loop # immediately after the network connection has been established, diff --git a/lib/em/deferrable.rb b/lib/em/deferrable.rb index 96bb21df8..1cb701861 100644 --- a/lib/em/deferrable.rb +++ b/lib/em/deferrable.rb @@ -42,6 +42,7 @@ module Deferrable # def callback &block return unless block + @deferred_status ||= :unknown if @deferred_status == :succeeded block.call(*@deferred_args) elsif @deferred_status != :failed @@ -59,6 +60,7 @@ def callback &block # def errback &block return unless block + @deferred_status ||= :unknown if @deferred_status == :failed block.call(*@deferred_args) elsif @deferred_status != :succeeded @@ -121,6 +123,8 @@ def errback &block # def set_deferred_status status, *args cancel_timeout + @errbacks ||= nil + @callbacks ||= nil @deferred_status = status @deferred_args = args case @deferred_status @@ -155,6 +159,7 @@ def timeout seconds # Cancels an outstanding timeout if any. Undoes the action of #timeout. # def cancel_timeout + @deferred_timeout ||= nil if @deferred_timeout @deferred_timeout.cancel @deferred_timeout = nil diff --git a/lib/em/delegate_connection.rb b/lib/em/delegate_connection.rb index 4d0764ce5..7ec9cf161 100644 --- a/lib/em/delegate_connection.rb +++ b/lib/em/delegate_connection.rb @@ -33,6 +33,7 @@ class DelegateConnection < Connection def initialize(delegate) @delegate = delegate @delegate.init(self) + @ip, @port = nil, nil end # Retreive the connections ip and port from the reactor. diff --git a/lib/em/protocols/httpclient2.rb b/lib/em/protocols/httpclient2.rb index b8428f431..0ca875d40 100644 --- a/lib/em/protocols/httpclient2.rb +++ b/lib/em/protocols/httpclient2.rb @@ -40,6 +40,12 @@ module Protocols # } class HttpClient2 < Connection include LineText2 + + def initialize + @authorization = nil + @closed = nil + @requests = nil + end class Request # :nodoc: include Deferrable @@ -57,6 +63,8 @@ def initialize conn, args @header_lines = [] @headers = {} @blanks = 0 + @chunk_trailer = nil + @chunking = nil end def send_request diff --git a/lib/em/protocols/line_and_text.rb b/lib/em/protocols/line_and_text.rb index 525421afd..741727879 100644 --- a/lib/em/protocols/line_and_text.rb +++ b/lib/em/protocols/line_and_text.rb @@ -23,7 +23,6 @@ # # # -require File.dirname(__FILE__) + '/../buftok' module EventMachine module Protocols diff --git a/lib/em/protocols/linetext2.rb b/lib/em/protocols/linetext2.rb index 244480ff2..6d4a47fd7 100644 --- a/lib/em/protocols/linetext2.rb +++ b/lib/em/protocols/linetext2.rb @@ -132,6 +132,7 @@ def set_binary_mode size=nil # when in sized text mode. User overrides of #receive_binary_data need to # be aware that they may get a short buffer. def unbind + @lt2_mode ||= nil if @lt2_mode == :text and @lt2_textpos > 0 receive_binary_data @lt2_textbuffer.join end diff --git a/lib/em/protocols/smtpclient.rb b/lib/em/protocols/smtpclient.rb index 56544de03..3bbcba605 100644 --- a/lib/em/protocols/smtpclient.rb +++ b/lib/em/protocols/smtpclient.rb @@ -66,6 +66,13 @@ module Protocols class SmtpClient < Connection include EventMachine::Deferrable include EventMachine::Protocols::LineText2 + + def initialize + @succeeded = nil + @responder = nil + @code = nil + @msg = nil + end # :host => required String # a string containing the IP address or host name of the SMTP server to connect to. diff --git a/lib/em/server.rb b/lib/em/server.rb index 0677c3a79..09086c674 100644 --- a/lib/em/server.rb +++ b/lib/em/server.rb @@ -48,7 +48,7 @@ def set_delegate(delegate) when Module [Class.new(EM::Connection) { include delegate }] when Proc - [Module.new &delegate] + [Module.new(&delegate)] # when nil # TODO # LoggerConnection else diff --git a/lib/em/timers.rb b/lib/em/timers.rb index cdeb12c09..08565ecbd 100644 --- a/lib/em/timers.rb +++ b/lib/em/timers.rb @@ -31,6 +31,7 @@ class PeriodicTimer def initialize interval, callback=nil, &block @interval = interval @code = callback || block + @cancelled = false schedule end diff --git a/lib/eventmachine.rb b/lib/eventmachine.rb index 619a031ca..90f394397 100644 --- a/lib/eventmachine.rb +++ b/lib/eventmachine.rb @@ -191,6 +191,10 @@ class <