Fixed tests
This commit is contained in:
parent
ef53c886a0
commit
b578e5c13a
3 changed files with 9 additions and 17 deletions
|
@ -206,7 +206,7 @@ void ipfs_null_connection (void *ptr) {
|
||||||
free (connection_param);
|
free (connection_param);
|
||||||
if (retVal != 0) {
|
if (retVal != 0) {
|
||||||
libp2p_logger_debug("null", "%s Freeing session context.\n", connection_param->local_node->identity->peer->id);
|
libp2p_logger_debug("null", "%s Freeing session context.\n", connection_param->local_node->identity->peer->id);
|
||||||
libp2p_session_context_free(session);
|
//libp2p_session_context_free(session);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,12 +265,14 @@ int test_bitswap_retrieve_file_known_remote() {
|
||||||
/***
|
/***
|
||||||
* This assumes a remote server with the hello_world.txt file already in its database
|
* This assumes a remote server with the hello_world.txt file already in its database
|
||||||
*/
|
*/
|
||||||
char* remote_ip = "10.211.55.2";
|
|
||||||
int remote_port = 4001;
|
int remote_port = 4001;
|
||||||
char* remote_peer_id = "QmZVoAZGFfinB7MQQiDzB84kWaDPQ95GLuXdemJFM2r9b4";
|
// mac
|
||||||
|
// char* remote_peer_id = "QmZVoAZGFfinB7MQQiDzB84kWaDPQ95GLuXdemJFM2r9b4";
|
||||||
|
// char* remote_ip = "10.211.55.2";
|
||||||
|
// linux
|
||||||
|
char* remote_peer_id = "QmRKm1d9kSCRpMFtLYpfhhCQ3DKuSSPJa3qn9wWXfwnWnY";
|
||||||
|
char* remote_ip = "10.211.55.4";
|
||||||
char* hello_world_hash = "QmTUFTVgkHT3Qdd9ospVjSLi2upd6VdkeNXZQH66cVmzja";
|
char* hello_world_hash = "QmTUFTVgkHT3Qdd9ospVjSLi2upd6VdkeNXZQH66cVmzja";
|
||||||
pthread_t thread;
|
|
||||||
int thread_started = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
libp2p_logger_add_class("dht_protocol");
|
libp2p_logger_add_class("dht_protocol");
|
||||||
|
@ -306,15 +308,8 @@ int test_bitswap_retrieve_file_known_remote() {
|
||||||
multiaddress_free(ma_peer1);
|
multiaddress_free(ma_peer1);
|
||||||
ipfs_node_online_new(ipfs_path, &ipfs_node2);
|
ipfs_node_online_new(ipfs_path, &ipfs_node2);
|
||||||
|
|
||||||
// start the daemon in a separate thread
|
|
||||||
if (pthread_create(&thread, NULL, test_routing_daemon_start, (void*)ipfs_path) < 0) {
|
|
||||||
libp2p_logger_error("test_bitswap", "Unable to start thread 2\n");
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
thread_started = 1;
|
|
||||||
|
|
||||||
if (!ipfs_cid_decode_hash_from_base58((unsigned char*)hello_world_hash, strlen(hello_world_hash), &cid))
|
if (!ipfs_cid_decode_hash_from_base58((unsigned char*)hello_world_hash, strlen(hello_world_hash), &cid))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
// this does the heavy lifting...
|
// this does the heavy lifting...
|
||||||
if (!ipfs_node2->exchange->GetBlock(ipfs_node2->exchange, cid, &result)) {
|
if (!ipfs_node2->exchange->GetBlock(ipfs_node2->exchange, cid, &result)) {
|
||||||
|
@ -329,9 +324,6 @@ int test_bitswap_retrieve_file_known_remote() {
|
||||||
|
|
||||||
retVal = 1;
|
retVal = 1;
|
||||||
exit:
|
exit:
|
||||||
ipfs_daemon_stop();
|
|
||||||
if (thread_started)
|
|
||||||
pthread_join(thread, NULL);
|
|
||||||
if (peer_id_1 != NULL)
|
if (peer_id_1 != NULL)
|
||||||
free(peer_id_1);
|
free(peer_id_1);
|
||||||
if (peer_id_2 != NULL)
|
if (peer_id_2 != NULL)
|
||||||
|
|
|
@ -162,7 +162,7 @@ char* get_test(int argc, char** argv, int arg_number) {
|
||||||
ptr++;
|
ptr++;
|
||||||
retVal = malloc(strlen(ptr) + 1);
|
retVal = malloc(strlen(ptr) + 1);
|
||||||
strcpy(retVal, ptr);
|
strcpy(retVal, ptr);
|
||||||
ptr = strchr(ptr, '\'');
|
ptr = strchr(retVal, '\'');
|
||||||
if (ptr != NULL)
|
if (ptr != NULL)
|
||||||
ptr[0] = 0;
|
ptr[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue