Mark Van De Vyver
2008-Jan-05 00:18 UTC
[Eventmachine-talk] EM::reconnect rejects handler that EM::connect
Hi, I have and EM connection line: EM::run { EM::connect("#{SERVER}", PORT, IrcLogger) <... etc ...> } where: class IrcLogger < EM::Connection include EventMachine::Protocols::LineText2 <... etc ...> end In the receive_line method I call: EM::reconnect("#{SERVER}", PORT, IrcLogger) While the connection executes fine, when the reconnection is called I get this error: /usr/lib/ruby/gems/1.8/gems/eventmachine-0.10.0/lib/eventmachine.rb:662:in `reconnect'': invalid handler (RuntimeError) Have I done something wrong? Appreciate any suggestions. Cheers Mark
Francis Cianfrocca
2008-Jan-05 03:17 UTC
[Eventmachine-talk] EM::reconnect rejects handler that
On Jan 5, 2008 3:18 AM, Mark Van De Vyver <mvyver at gmail.com> wrote:> Hi, > I have and EM connection line: > > EM::run { > EM::connect("#{SERVER}", PORT, IrcLogger) > <... etc ...> > } > > where: > class IrcLogger < EM::Connection > include EventMachine::Protocols::LineText2 > <... etc ...> > end > > In the receive_line method I call: > > EM::reconnect("#{SERVER}", PORT, IrcLogger) > > While the connection executes fine, when the reconnection is called I > get this error: > > /usr/lib/ruby/gems/1.8/gems/eventmachine-0.10.0/lib/eventmachine.rb:662:in > `reconnect'': invalid handler (RuntimeError) > > Have I done something wrong? >Rather than saying: EM::reconnect( server, port, IrcLogger) Try this instead: reconnect( server, port ) And tell us if that works. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080105/2e9cb64f/attachment.html
Mark Van De Vyver
2008-Jan-05 04:02 UTC
[Eventmachine-talk] EM::reconnect rejects handler that
Hi Francis - On Jan 5, 2008 10:17 PM, Francis Cianfrocca <garbagecat10 at gmail.com> wrote:> > On Jan 5, 2008 3:18 AM, Mark Van De Vyver <mvyver at gmail.com> wrote: > > > > Hi, > > I have and EM connection line: > > > > EM::run { > > EM::connect("#{SERVER}", PORT, IrcLogger) > > <... etc ...> > > } > > > > where: > > class IrcLogger < EM::Connection > > include EventMachine::Protocols::LineText2 > > <... etc ...> > > end > > > > In the receive_line method I call: > > > > EM::reconnect("#{SERVER}", PORT, IrcLogger) > > > > While the connection executes fine, when the reconnection is called I > > get this error: > > > > /usr/lib/ruby/gems/1.8/gems/eventmachine-0.10.0/lib/eventmachine.rb:662:in > > `reconnect'': invalid handler (RuntimeError) > > > > Have I done something wrong? > > > > > Rather than saying: > EM::reconnect( server, port, IrcLogger) > > Try this instead: > reconnect( server, port ) > > And tell us if that works.It sort of works... I no longer get the RuntimeError, however the connection is not reestablished: unbind gets called (just puts "..."), but I don''t see post_init again - which I should right? Mark