Skip to content

Don't rely on RPL_YOURHOST parsing for connectivity checking #239

@osa1

Description

@osa1

I discovered this while reviewing #237 (see my comment). We currently use the server name when sending PINGs to a server to check connectivity, but we can't do that if we don't know the server name, which we currently parse from the RPL_YOURHOST message. When parsing fails servername stays None, and send_ping just returns:

pub(crate) fn send_ping(&self, snd_irc_msg: &mut Sender<String>) {
self.inner.borrow_mut().send_ping(snd_irc_msg)
}

This breaks connectivity checks when we can't parse RPL_YOURHOST for some reason. One example of this happening is when connecting to irc.gitter.im. Gitter's IRC server is not following the standards too closely and caused problems before (#214, #211). Currently RPL_YOURHOST from Gitter looks like this:

Msg { pfx: Some(Server("irc.gitter.im")), cmd: Reply { num: 2, params: ["osa1", " 1.10.0"] } }

This is quite different than how RFC 2812 defines it:

       002    RPL_YOURHOST
              "Your host is <servername>, running version <ver>"

What to do when we can't parse RPL_YOURHOST? I see a few options:

  • Send an empty PING message. The error response will reset the connectivity timer. The problem with this is that we'll see error responses in the server tab. Example: helix.oftc.net: osa1 PING Not enough parameters
  • Send a PING to yourself. This won't work if we're stuck in nick selection (not sure if this can happen). In that case we can fall back to (1). I just tried this on OFTC and it seems to work.
  • Send a HELP message to the server, which doesn't require arguments so will always work. (Note: HELP is ignored by irc.gitter.im)
  • (Other ideas?)

Note that (1) and (2) works on irc.gitter.im, which doesn't seem care about the PING argument at all and always responds with a PONG immediately. (3) doesn't work as it doesn't seem to support HELP message.

cc @trevarj

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions