Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Znc PING handling #22

Open
hamzadis opened this issue Jul 10, 2017 · 0 comments
Open

Znc PING handling #22

hamzadis opened this issue Jul 10, 2017 · 0 comments

Comments

@hamzadis
Copy link

Now, I'm not sure if I should open this here or on the sIRC fork project, but I guess it's more visible here.

Anyway, this app has an issue with handling incoming PING commands. The issue arises when server time is enabled. The sIRC library checks for PING commands using a simple startsWith("PING") call, which fails to work when server time is enabled since the time tag is sent before the command.

This is a problem for newer versions of Znc and causes disconnects to happen (predictably). Namely, when Znc detects that a client has been silent for a certain amount of time, it starts sending the client PING commands. The PING commands Znc sends out look like this:

@time=2017-07-10T11:00:00.000Z PING :ZNC

If the client ignores these commands for too long, Znc assumes the client is gone and closes the connection. Since qicr enables server time and thereby fails to respond to incoming PING commands, this means that when the phone goes idle, qicr gets disconnected.

Now, I was gonna make a pull request, but it turned out the sIRC library is much messier than I thought. Naturally, since the PING command has a tag, it should now be handled after it has been parsed, so I added the code to IrcParser where commands are handled.
This didn't work because the parsing code in IrcPacket is broken and parses the PING command as an ING command. I fixed that by fixing the off-by-one error in this part of the code and that seemed to work, but it also stripped the colon out of the command.
I then tried testing the changes and tried sending the client a PING command without a colon and that immediately crashed the whole thing.

So it seems the sIRC library is very lacking, doesn't do a lot of error checking and is not too well equipped to handle this case. Not sure then if this should be solved by a hack or some more serious rework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant