[ovs-dev] [PATCH 03/10] netlink: Drain sockets with separate ofpbuf.
Joe Stringer
joestringer at nicira.com
Fri Jan 10 19:43:08 UTC 2014
The 'buffer' member in 'struct nl_dump' will be going away, so this
patch ensures that nl_dump_done() no longer uses it to drain the
nl_sock.
Signed-off-by: Joe Stringer <joestringer at nicira.com>
---
lib/netlink-socket.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index c7973bf..fce360d 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -784,18 +784,21 @@ nl_dump_next(struct nl_dump *dump, struct ofpbuf *reply, struct ofpbuf *buffer)
int
nl_dump_done(struct nl_dump *dump)
{
+ struct ofpbuf buf;
+
/* Drain any remaining messages that the client didn't read. Otherwise the
* kernel will continue to queue them up and waste buffer space.
*
* XXX We could just destroy and discard the socket in this case. */
+ ofpbuf_init(&buf, 4096);
while (!dump->status) {
struct ofpbuf reply;
- if (!nl_dump_next(dump, &reply, &dump->buffer)) {
+ if (!nl_dump_next(dump, &reply, &buf)) {
ovs_assert(dump->status);
}
}
+ ofpbuf_uninit(&buf);
nl_pool_release(dump->sock);
- ofpbuf_uninit(&dump->buffer);
return dump->status == EOF ? 0 : dump->status;
}
--
1.7.9.5
More information about the dev
mailing list