Minor changes for yamux
This commit is contained in:
parent
0c31ef7331
commit
8b2a8ef3ab
2 changed files with 10 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "libp2p/conn/dialer.h"
|
#include "libp2p/conn/dialer.h"
|
||||||
|
#include "libp2p/identify/identify.h"
|
||||||
#include "libp2p/net/multistream.h"
|
#include "libp2p/net/multistream.h"
|
||||||
#include "libp2p/utils/vector.h"
|
#include "libp2p/utils/vector.h"
|
||||||
#include "libp2p/secio/secio.h"
|
#include "libp2p/secio/secio.h"
|
||||||
|
@ -45,6 +46,8 @@ struct Libp2pVector* ipfs_node_online_build_protocol_handlers(struct IpfsNode* n
|
||||||
libp2p_utils_vector_add(retVal, libp2p_net_multistream_build_protocol_handler(retVal));
|
libp2p_utils_vector_add(retVal, libp2p_net_multistream_build_protocol_handler(retVal));
|
||||||
// yamux
|
// yamux
|
||||||
libp2p_utils_vector_add(retVal, yamux_build_protocol_handler());
|
libp2p_utils_vector_add(retVal, yamux_build_protocol_handler());
|
||||||
|
// identify
|
||||||
|
libp2p_utils_vector_add(retVal, libp2p_identify_build_protocol_handler(retVal));
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
12
core/null.c
12
core/null.c
|
@ -35,7 +35,7 @@
|
||||||
static int null_shutting_down = 0;
|
static int null_shutting_down = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We've received a connection. Find out what they want.
|
* We've received a new connection. Find out what they want.
|
||||||
*
|
*
|
||||||
* @param ptr a pointer to a null_connection_params struct
|
* @param ptr a pointer to a null_connection_params struct
|
||||||
*/
|
*/
|
||||||
|
@ -66,11 +66,13 @@ void ipfs_null_connection (void *ptr) {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
// Read from the network
|
// Read from the network
|
||||||
if (!session->default_stream->read(session, &results, DEFAULT_NETWORK_TIMEOUT)) {
|
if (!session->default_stream->read(session, &results, DEFAULT_NETWORK_TIMEOUT)) {
|
||||||
// problem reading;
|
// problem reading
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
if (results != NULL) {
|
||||||
|
retVal = libp2p_protocol_marshal(results, session, connection_param->local_node->protocol_handlers);
|
||||||
|
libp2p_stream_message_free(results);
|
||||||
}
|
}
|
||||||
retVal = libp2p_protocol_marshal(results, session, connection_param->local_node->protocol_handlers);
|
|
||||||
libp2p_stream_message_free(results);
|
|
||||||
// exit the loop on error (or if they ask us to no longer loop by returning 0)
|
// exit the loop on error (or if they ask us to no longer loop by returning 0)
|
||||||
if (retVal <= 0)
|
if (retVal <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue