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.master
parent
5c167e4181
commit
7e120f00a1
6
handle.c
6
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue