检测 eventmachine 断开连接并测试重新连接
我正在尝试在事件机器之上构建一个系统,该系统将检测 TCP 连接何时失败,并测试是否可以触发重新连接。我已经浏览了所有的 eventmachine 代码,但似乎无法找到连接超时或重新连接时的连接回调。尽管我已经在代码中设置了时间,但挂起的连接上没有回调,并且如果我尝试重新启动重新连接,我不会收到有关连接是否成功或失败的反馈。我正在使用它来有效地连接到 telnet 接口。
EventMachine.run do
c = EventMachine.connect "10.8.1.99",5000,ConnectInterface
c.pending_connect_timeout = 10
如有
任何帮助,我们将不胜感激。
I'm trying to build a system ontop of event machine that will detect when a TCP connection has failed and will test to see if a reconnect can be fired. I've gone through all of the eventmachine code but can't seem to find where there is a callback for the connection either timing out in action or in reconnection. Even though I've set the times in the code, there is no callback on the pending connect, and if I try to re fire reconnect I get no feedback as to whether the connection has succeeded or failed. I'm using it to connect to effectively a telnet interface.
EventMachine.run do
c = EventMachine.connect "10.8.1.99",5000,ConnectInterface
c.pending_connect_timeout = 10
end
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
EventMachine 为此提供了 unbind 方法:
请注意,无论您是否触发了断开连接,都会在断开连接时调用 unbind 方法。
EventMachine provide the unbind method for this:
be aware The unbind method will get called on disconnect whether you triggered the disconnect or not.