[Twisted-Python] IRCClient method naming advice
jonathan+twisted at jsphere.com
Sat Jan 28 04:20:23 EST 2012
On Sat, Jan 28, 2012 at 07:51, Matthew Pounsett <matt at conundrum.com> wrote:
> I've found that the IRCClient protocol doesn't deal well with having its connection interrupted. If the TCP session goes away due to timeout or some other interruption, it doesn't appear to notice. As a result, I'm looking at adding appropriate methods to allow a client to initiate its own pings to the server so that it can detect when the connection is lost. I'll submit all this back via Trac when I can get in there.
> This will need IRCClient.irc_PONG(), which looks fairly straightforward to write, and the obvious method for the outgoing ping would be IRCClient.ping(), but that seems to have been taken up for DCC PING instead.
> Presumably it would upset people if backward compatibility was broken and that was changed to IRCClient.dccPing() to match the rest of the outgoing DCC methods. Does anyone have any opinion on what other method name would make sense and still be close to maintaining consistency with the rest of the outgoing method names?
"Heartbeat" functionality was implemented in IRCClient and released in
Twisted 11.1.0, see ticket #5047
<http://twistedmatrix.com/trac/ticket/5047>, by default it sends a
PING every 120 seconds.
You don't actually need to acknowledge the PONG for the purpose of
keeping the client alive and active, writing any data to the transport
is enough to trigger connectionLost if the connection is genuinely
Hope this helps.
More information about the Twisted-Python