summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-12-23 15:15:56 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-12-23 15:15:56 +0000
commit15714073687d484a6fc6da8772b8a802ef3beab1 (patch)
tree459128b80bdad2a0d443226aaa08b4bb9a71c0ad /usr.sbin
parent45dcf3deef81b749cfb074b4ad1b77c0cf7ade0f (diff)
lower latency by processing no more than 25 messages at once for each peer
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/session.c6
-rw-r--r--usr.sbin/bgpd/session.h3
2 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index e881f05c45a..6fab38bfd8e 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.209 2004/12/07 17:19:09 henning Exp $ */
+/* $OpenBSD: session.c,v 1.210 2004/12/23 15:15:55 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -1421,7 +1421,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p)
{
ssize_t n, rpos, av, left;
socklen_t len;
- int error;
+ int error, processed = 0;
u_int16_t msglen;
u_int8_t msgtype;
@@ -1537,6 +1537,8 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p)
"unknown type %u", msgtype);
}
rpos += msglen;
+ if (++processed > MSG_PROCESS_LIMIT)
+ break;
}
if (p->rbuf == NULL)
return (1);
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index 9488f495af0..103dc5fc368 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.73 2004/12/23 15:08:43 henning Exp $ */
+/* $OpenBSD: session.h,v 1.74 2004/12/23 15:15:55 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -34,6 +34,7 @@
#define MSGSIZE_UPDATE_MIN 23
#define MSGSIZE_KEEPALIVE MSGSIZE_HEADER
#define MSGSIZE_RREFRESH MSGSIZE_HEADER + 4
+#define MSG_PROCESS_LIMIT 25
enum session_state {
STATE_NONE,