more changes for dialer

yamux
jmjatlanta 2017-10-23 16:21:24 -05:00
parent f9bec0ac20
commit 9087c58113
3 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,7 @@
#include <stdlib.h>
#include <pthread.h>
#include "libp2p/conn/dialer.h"
#include "libp2p/net/multistream.h"
#include "libp2p/utils/vector.h"
#include "libp2p/secio/secio.h"
@ -89,6 +90,7 @@ int ipfs_node_online_new(const char* repo_path, struct IpfsNode** node) {
// fill in the node
local_node->repo = fs_repo;
local_node->identity = fs_repo->config->identity;
local_node->dialer = libp2p_conn_dialer_new(local_node->identity->peer, &local_node->identity->private_key);
local_node->peerstore = libp2p_peerstore_new(local_node->identity->peer);
local_node->providerstore = libp2p_providerstore_new(fs_repo->config->datastore, local_node->identity->peer);
local_node->blockstore = ipfs_blockstore_new(fs_repo);
@ -134,6 +136,7 @@ int ipfs_node_offline_new(const char* repo_path, struct IpfsNode** node) {
// fill in the node
local_node->repo = fs_repo;
local_node->identity = fs_repo->config->identity;
local_node->dialer = libp2p_conn_dialer_new(local_node->identity->peer, &local_node->identity->private_key);
local_node->peerstore = libp2p_peerstore_new(local_node->identity->peer);
local_node->providerstore = libp2p_providerstore_new(fs_repo->config->datastore, local_node->identity->peer);
local_node->blockstore = ipfs_blockstore_new(fs_repo);

View File

@ -57,7 +57,7 @@ int test_ping() {
remote_peer->addr_head->item = multiaddress_new_from_string("/ip4/192.168.43.234/tcp/4001/");
// connect using a dialer
dialer = libp2p_conn_dialer_new(fs_repo->config->identity->peer->id, libp2p_crypto_rsa_to_private_key(&fs_repo->config->identity->private_key));
dialer = libp2p_conn_dialer_new(fs_repo->config->identity->peer, &fs_repo->config->identity->private_key);
conn = libp2p_conn_dialer_get_connection(dialer, remote_peer->addr_head->item);
//TODO: Dialer should know the protocol

View File

@ -40,10 +40,12 @@ function body {
#A client of server 2 wants the file at server 1
eval "$IPFS2" cat QmYAXgX8ARiriupMQsbGXtKdDyGzWry1YV3sycKw1qqmgH
check_failure "cat" $?
retVal=$?
check_failure "cat" $retVal
kill -9 $daemon_id_1
kill -9 $daemon_id_2
exit $retVal
}