summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/buffer.c
diff options
context:
space:
mode:
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 */