From 41bc65da31686f67ef4ad538f1860305a72a690c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Tue, 7 Jul 2020 11:58:40 -0400
Subject: [PATCH] connectionManager: sendRequest should use the good state

on iOS, the default value of an enum is not the first one, this means that
requests for new channel are not working

Change-Id: I190625bc34e94622c2e7d68d936818c204f96413
---
 src/jamidht/connectionmanager.cpp | 1 +
 src/jamidht/multiplexed_socket.h  | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/jamidht/connectionmanager.cpp b/src/jamidht/connectionmanager.cpp
index 375f02b332..17d219ae1c 100644
--- a/src/jamidht/connectionmanager.cpp
+++ b/src/jamidht/connectionmanager.cpp
@@ -384,6 +384,7 @@ ConnectionManager::Impl::sendChannelRequest(std::shared_ptr<MultiplexedSocket>&
     auto channelSock = sock->addChannel(name);
     ChannelRequest val;
     val.name = channelSock->name();
+    val.state = ChannelRequestState::REQUEST;
     val.channel = channelSock->channel();
     std::stringstream ss;
     msgpack::pack(ss, val);
diff --git a/src/jamidht/multiplexed_socket.h b/src/jamidht/multiplexed_socket.h
index 101f50bb51..006adc5c0a 100644
--- a/src/jamidht/multiplexed_socket.h
+++ b/src/jamidht/multiplexed_socket.h
@@ -47,7 +47,7 @@ enum class ChannelRequestState {
 struct ChannelRequest {
     std::string name {};
     uint16_t channel {0};
-    ChannelRequestState state;
+    ChannelRequestState state {ChannelRequestState::REQUEST};
     MSGPACK_DEFINE(name, channel, state)
 };
 
-- 
GitLab