summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/buffer.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2003-12-21 18:04:09 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2003-12-21 18:04:09 +0000
commit4020903675a3a8b04ca739ced056bd39179eeedc (patch)
tree0d0620f0f68bf6b2a4a877dc6f3a3dd49e7551e7 /usr.sbin/bgpd/buffer.c
parentdca1b47971dabaedfe3bc438ba9d3546c1fac147 (diff)
don't try to write out data immediately if there are queued writes.
OK henning@
Diffstat (limited to 'usr.sbin/bgpd/buffer.c')
-rw-r--r--usr.sbin/bgpd/buffer.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/bgpd/buffer.c b/usr.sbin/bgpd/buffer.c
index 81b11dfec93..0d9f25f6f71 100644
--- a/usr.sbin/bgpd/buffer.c
+++ b/usr.sbin/bgpd/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.4 2003/12/21 16:11:33 claudio Exp $ */
+/* $OpenBSD: buffer.c,v 1.5 2003/12/21 18:04:08 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -85,12 +85,14 @@ buf_close(struct buf *buf)
int n;
- if ((n = buf_write(buf)) == -1)
- return (-1);
+ if (buf->peer != NULL && buf->peer->queued_writes == 0) {
+ if ((n = buf_write(buf)) == -1)
+ return (-1);
- if (n == 1) { /* all data written out */
- buf_free(buf);
- return (0);
+ if (n == 1) { /* all data written out */
+ buf_free(buf);
+ return (0);
+ }
}
/* we have to queue */