summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-03-08 23:15:56 -0400
committerJune McEnroe <june@causal.agency>2020-03-08 23:15:56 -0400
commit7e120f00a19c27e0b98e27a2eacacdfce9bd3ca2 (patch)
tree868dee59354b1b1f8c80bcd447f253fbb2c4a145
parentPrevent entering commands in <debug> if restricted (diff)
downloadcatgirl-7e120f00a19c27e0b98e27a2eacacdfce9bd3ca2.tar.gz
catgirl-7e120f00a19c27e0b98e27a2eacacdfce9bd3ca2.zip
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.
-rw-r--r--handle.c6
1 files changed, 3 insertions, 3 deletions
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);
-	}
 }
/pounce/commit/bounce.c?h=2.1&id=d20bda982a9cedfcdfeb677a436ec8a730364650&follow=1'>Call clientConsume before clientRecvJune McEnroe This might reduce the frequency of a client getting its own message back because it was behind in the ring when it sent it. 2019-11-06Use -l:filename in Linux.mkJune McEnroe 2019-11-06Fix compat.h for #defined strlcpyJune McEnroe 2019-11-06Allow unsetting LIBRESSL_PREFIXJune McEnroe 2019-11-06Document calico service configurationJune McEnroe 2019-11-06Document SASL EXTERNAL configuration in more detailJune McEnroe 2019-11-06Document pounce service configurationJune McEnroe 2019-11-06Mention Darwin and GNU/Linux in READMEJune McEnroe 2019-11-06Assume LibreSSL from brew on DarwinJune McEnroe 2019-11-06Remove -DNO_EXPLICIT_BZERO from Darwin.mkJune McEnroe 2019-11-06Don't install rc scripts or dirs on LinuxJune McEnroe