Fixed swarm multistream as incoming instead of outgoing connection.

This commit is contained in:
Jose Marcial Vieira Bisneto 2018-10-26 18:50:40 -03:00
parent 6e9c67d121
commit 5e4f3cdb04
No known key found for this signature in database
GPG key ID: 103E935E7E6E831E

View file

@ -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;