Minor changes for yamux

This commit is contained in:
John Jones 2017-11-06 13:37:48 -05:00
parent 0c31ef7331
commit 8b2a8ef3ab
2 changed files with 10 additions and 5 deletions

View file

@ -2,6 +2,7 @@
#include <pthread.h>
#include "libp2p/conn/dialer.h"
#include "libp2p/identify/identify.h"
#include "libp2p/net/multistream.h"
#include "libp2p/utils/vector.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));
// yamux
libp2p_utils_vector_add(retVal, yamux_build_protocol_handler());
// identify
libp2p_utils_vector_add(retVal, libp2p_identify_build_protocol_handler(retVal));
}
return retVal;
}

View file

@ -35,7 +35,7 @@
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
*/
@ -66,11 +66,13 @@ void ipfs_null_connection (void *ptr) {
for(;;) {
// Read from the network
if (!session->default_stream->read(session, &results, DEFAULT_NETWORK_TIMEOUT)) {
// problem reading;
break;
// problem reading
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)
if (retVal <= 0)
break;