0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Flock: fixed some random bugs but there are obviously some more

This commit is contained in:
Maria Matejka 2024-10-02 23:37:14 +02:00
parent 8cc7596e44
commit 20c3706efc
2 changed files with 15 additions and 5 deletions

View File

@ -459,6 +459,12 @@ container_mainloop(int fd)
exit(1); exit(1);
} }
if (sz == 0)
{
log(L_INFO "control socket closing, shutdown");
exit(0);
}
ASSERT_DIE(sz >= 3); ASSERT_DIE(sz >= 3);
ASSERT_DIE(buf[0] == 0xa1); ASSERT_DIE(buf[0] == 0xa1);
switch (buf[1]) { switch (buf[1]) {

View File

@ -40,15 +40,15 @@ hcs_rx(sock *s, uint size)
log(L_INFO "Parsed command."); log(L_INFO "Parsed command.");
/* TODO do something more */ /* TODO do something more */
if (sz < size)
memmove(s->rbuf, s->rbuf + sz, size - sz);
if (!s->rx_hook)
return (sz == size);
hcs_parser_cleanup(s->data); hcs_parser_cleanup(s->data);
s->data = hcs_parser_init(s); s->data = hcs_parser_init(s);
if (sz == size) return (sz < size) ? hcs_rx(s, size - sz) : 1;
return 1;
memmove(s->rbuf, s->rbuf + sz, size - sz);
return hcs_rx(s, size - sz);
} }
static void static void
@ -517,6 +517,10 @@ static void hexp_received_telnet(void *_data)
sk_send(s, cw->pt); sk_send(s, cw->pt);
sk_resume_rx(hcs_loop, s); sk_resume_rx(hcs_loop, s);
hcs_parser_cleanup(s->data);
s->data = hcs_parser_init(s);
rfree(lp); rfree(lp);
} }