Download raw body.
bgpd: throttle reads from the peer socket
Right now the session socket is always ready to read more data. At the same time only MSG_PROCESS_LIMIT messages are pulled of the msgbuf read queue. As a result the SE may buffer a lot of messages. This throttles the POLLIN event by checking that no more than MSG_PROCESS_LIMIT are ready. If more are queued the POLLIN is skipped. The code will still run session_process_msg on every poll round and so the queue len will shrink by MSG_PROCESS_LIMIT. This is now possible that the ibuf API includes msgbuf_readlen. -- :wq Claudio Index: session.c =================================================================== RCS file: /cvs/src/usr.sbin/bgpd/session.c,v diff -u -p -r1.540 session.c --- session.c 24 Jul 2026 05:01:01 -0000 1.540 +++ session.c 10 Sep 2026 18:45:59 -0000 @@ -414,7 +414,9 @@ session_main(int debug, int verbose) } /* are we waiting for a write? */ - events = POLLIN; + events = 0; + if (msgbuf_readlen(p->wbuf) < MSG_PROCESS_LIMIT) + events |= POLLIN; if (msgbuf_queuelen(p->wbuf) > 0 || p->state == STATE_CONNECT) events |= POLLOUT;
bgpd: throttle reads from the peer socket