Class: Rev::Socket::Connector

Inherits:
Object
  • Object
show all
Defined in:
lib/internethakai/hakairev/monkey.rb

Instance Method Summary collapse

Instance Method Details

#on_writableObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/internethakai/hakairev/monkey.rb', line 44

def on_writable
    evl = evloop
    detach

    if connect_successful?
        #@rev_socket.instance_eval { @_connector = nil }
        @rev_socket.connectornil
        @rev_socket.attach(evl)
        @ruby_socket.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, [1].pack("l"))
        @ruby_socket.setsockopt(::Socket::SOL_SOCKET, ::Socket::SO_KEEPALIVE, true)

        @rev_socket.on_connect
    else
        #@rev_socket.instance_eval { @_failed = true }
        @rev_socket.failedtrue
        @rev_socket.on_connect_failed
    end
end