# File lib/rev/socket.rb, line 22 def attach(evloop) raise RuntimeError, "connection failed" if @_failed if @_connector @_connector.attach(evloop) return self end super end
Called upon completion of a socket connection
# File lib/rev/socket.rb, line 34 def on_connect; end
Called if a socket connection failed to complete
# File lib/rev/socket.rb, line 38 def on_connect_failed; end
Called if a hostname failed to resolve when connecting Defaults to calling #on_connect_failed
# File lib/rev/socket.rb, line 43 def on_resolve_failed on_connect_failed end
# File lib/rev/socket.rb, line 12 def self.connect(socket, *args) new(socket, *args).instance_eval do @_connector = Connector.new(self, socket) self end end