Issue #30 wontfix pings out

Anonymous created an issue

If you play around with irccat long enough, it will eventually ping timeout.

Comments (1)

  1. Jason R. Coombs repo owner

    irccat (and other scripts in the examples directories) aren't designed to be production-class scripts. Instead, they're designed to help the developer gain a familiarity with the system.

    As a result, the example is very simple and doesn't account for higher-level behaviors (like ping timeouts, or processing incoming messages at all for that matter).

    The way the irc library handles asynchronous I/O is through callbacks, so it's important that the process_once be called periodically to handle incoming messages (pings) and respond accordingly.

    You might try calling process_once in the loop, which may cause the "ping-ponger" to respond to pings:

    C:\Users\jaraco\projects\irc [default ~1 master tip]> hg diff
    diff -r af0a10dde638 scripts/
    --- a/scripts/ Sun Sep 22 18:09:50 2013 -0400
    +++ b/scripts/ Sun Oct 20 15:52:03 2013 -0400
    @@ -34,6 +34,7 @@
         for line in itertools.takewhile(bool, get_lines()):
             connection.privmsg(target, line)
    +        connection.irclibobj.process_once()
     def on_disconnect(connection, event):

    However, even that isn't necessarily going to work if input from stdin isn't received frequently enough to trigger the ping responses.

    Your other option would be to create a separate thread or other asynchronous technique to ensure that 'process_once' is called periodically even when input isn't received on stdin.

  2. Log in to comment