From 36701cafcbb766febe74122cd74306ec51d8e96e Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Mon, 4 May 2015 12:23:23 -0300 Subject: [PATCH] iostream: make close() flush This change is intended to make close() flush the stream before proceeding with the close itself. This improves the situation where we have to guarantee that the stream is flushed before closing it. Signed-off-by: Raphael S. Carvalho --- core/iostream.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/iostream.hh b/core/iostream.hh index 0122d146bf..1594038a96 100644 --- a/core/iostream.hh +++ b/core/iostream.hh @@ -173,7 +173,7 @@ public: future<> write(net::packet p); future<> write(scattered_message msg); future<> flush(); - future<> close() { return _fd.close(); } + future<> close() { return flush().then([this] { return _fd.close(); }); } private: };