By the way, it took me a fair amount of time to figure out that a
subclass of Rev::SSLSocket must call super() in its overridden
on_connect implementation or SSL will not work--specifically,
Rev::SSLSocket#on_connect does essential SSL setup work by invoking
ssl_client_start or ssl_server_start.
I think this is definitely surprising behavior if not an outright bug,
because one doesn''t ordinarily think of having to call super() in a
callback.
--Young
==============class EchoServerConnection < Rev::SSLSocket
def on_connect
puts "#{remote_addr}:#{remote_port} connected"
super() # MUST have!
end
# ...
end
event_loop = Rev::Loop.default
Rev::TCPServer.new(ADDR, PORT, EchoServerConnection).attach(event_loop)
On Jul 24, 2009, at 4:34 PM, Tony Arcieri wrote:> That''s why there''s on_ssl_connect. Are you doing something > specifically where you need an on_connect event before SSL setup has > completed? If so I can try to find a workaround.No, I don''t need an on_connect for SSL, since there''s on_ssl_connect, as you pointed out. It was just that I had incrementally modified your echo server example to use SSL and hit this unexpected behavior. So it sounds like it''s just an issue of properly documenting this. --Young