From 5b10c8716c630ce0640895a7559802953b44a25d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Mon, 29 Mar 2021 19:18:24 -0400
Subject: [PATCH] mxsock: preallocate buffer

Change-Id: I337c6e440d85fb3c4c33b023766d5241e88e9977
---
 src/jamidht/multiplexed_socket.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/jamidht/multiplexed_socket.cpp b/src/jamidht/multiplexed_socket.cpp
index 0eacdff5da..deda80be18 100644
--- a/src/jamidht/multiplexed_socket.cpp
+++ b/src/jamidht/multiplexed_socket.cpp
@@ -462,7 +462,7 @@ MultiplexedSocket::write(const uint16_t& channel,
         ec = std::make_error_code(std::errc::message_size);
         return -1;
     }
-    msgpack::sbuffer buffer;
+    msgpack::sbuffer buffer(len + 16);
     msgpack::packer<msgpack::sbuffer> pk(&buffer);
     pk.pack_array(2);
     pk.pack(channel);
-- 
GitLab