From 5e4f3cdb0440c06cfb3f442c11574e58ab1f1075 Mon Sep 17 00:00:00 2001 From: Jose Marcial Vieira Bisneto Date: Fri, 26 Oct 2018 18:50:40 -0300 Subject: [PATCH] Fixed swarm multistream as incoming instead of outgoing connection. --- swarm/swarm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/swarm/swarm.c b/swarm/swarm.c index 24c9740..5b99c80 100644 --- a/swarm/swarm.c +++ b/swarm/swarm.c @@ -9,6 +9,7 @@ #include "libp2p/net/connectionstream.h" #include "libp2p/swarm/swarm.h" #include "libp2p/utils/logger.h" +#include "libp2p/net/multistream.h" /** * Helps pass information to a new thread @@ -139,8 +140,8 @@ int libp2p_swarm_add_connection(struct SwarmContext* context, int file_descripto return 0; } session->port = port; - session->insecure_stream = libp2p_net_connection_new(file_descriptor, session->host, session->port, session); - session->default_stream = session->insecure_stream; + session->insecure_stream = libp2p_net_connection_established(file_descriptor, session->host, session->port, session); + session->default_stream = libp2p_net_multistream_stream_new(session->insecure_stream, 0); struct SwarmSession* swarm_session = (struct SwarmSession*) malloc(sizeof(struct SwarmSession)); swarm_session->session_context = session;