From 7e120f00a19c27e0b98e27a2eacacdfce9bd3ca2 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 8 Mar 2020 23:15:56 -0400 Subject: Set self.pos before handling the message This intuitively feels wrong, but isn't. Most importantly, handleError immediately exits, but we still need to "consume" that message, otherwise pounce will keep sending it on reconnect. The same goes for any other handler that might cause an exit, such as a require parameter count failure. --- handle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'handle.c') diff --git a/handle.c b/handle.c index 0a1dedb..d0236fd 100644 --- a/handle.c +++ b/handle.c @@ -1018,6 +1018,9 @@ static int compar(const void *cmd, const void *_handler) { void handle(struct Message msg) { if (!msg.cmd) return; + if (msg.tags[TagPos]) { + self.pos = strtoull(msg.tags[TagPos], NULL, 10); + } const struct Handler *handler = bsearch( msg.cmd, Handlers, ARRAY_LEN(Handlers), sizeof(*handler), compar ); @@ -1026,7 +1029,4 @@ void handle(struct Message msg) { } else if (strcmp(msg.cmd, "400") >= 0 && strcmp(msg.cmd, "599") <= 0) { handleErrorGeneric(&msg); } - if (msg.tags[TagPos]) { - self.pos = strtoull(msg.tags[TagPos], NULL, 10); - } } -- cgit 1.4.1