From 5af0f0c3d0bc18aa56ca44812d9393f6d802e3ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Sun, 19 Jan 2020 13:37:12 -0500
Subject: [PATCH] proxy server: flush response after all values are sent

---
 src/dht_proxy_server.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp
index 74c571f6..b87ef9f0 100644
--- a/src/dht_proxy_server.cpp
+++ b/src/dht_proxy_server.cpp
@@ -563,10 +563,9 @@ DhtProxyServer::listen(restinio::request_handle_t request,
                 auto jsonVal = value->toJson();
                 if (expired)
                     jsonVal["expired"] = true;
-                auto output = Json::writeString(jsonBuilder_, jsonVal) + "\n";
-                response->append_chunk(output);
-                response->flush();
+                response->append_chunk(Json::writeString(jsonBuilder_, jsonVal) + "\n");
             }
+            response->flush();
             return true;
         });
         return restinio::request_handling_status_t::accepted;
-- 
GitLab