fixing name publish and resolve

This commit is contained in:
jmjatlanta 2017-09-25 13:37:16 -05:00
parent 8e56826b8d
commit abb607c905
4 changed files with 8 additions and 4 deletions

View file

@ -251,7 +251,6 @@ size_t curl_cb(void* ptr, size_t size, size_t nmemb, struct curl_string* str) {
str->ptr[new_len] = '\0'; str->ptr[new_len] = '\0';
str->len = new_len; str->len = new_len;
} }
libp2p_logger_debug("http_request", "curl_cb received %s.\n", str->ptr);
return size * nmemb; return size * nmemb;
} }

View file

@ -98,6 +98,7 @@ void* ipfs_bitswap_engine_peer_request_processor_start(void* ctx) {
size_t buffer_len = 0; size_t buffer_len = 0;
if (current_peer_entry->sessionContext->default_stream->read(current_peer_entry->sessionContext, &buffer, &buffer_len, 1)) { if (current_peer_entry->sessionContext->default_stream->read(current_peer_entry->sessionContext, &buffer, &buffer_len, 1)) {
// handle it // handle it
libp2p_logger_debug("bitswap_engine", "%lu bytes read, result: [%s].\n", buffer_len, buffer);
int retVal = libp2p_protocol_marshal(buffer, buffer_len, current_peer_entry->sessionContext, context->ipfsNode->protocol_handlers); int retVal = libp2p_protocol_marshal(buffer, buffer_len, current_peer_entry->sessionContext, context->ipfsNode->protocol_handlers);
free(buffer); free(buffer);
did_some_processing = 1; did_some_processing = 1;

View file

@ -223,6 +223,7 @@ int ipfs_namesys_publisher_publish(struct IpfsNode* local_node, char* path) {
libp2p_message_free(msg); libp2p_message_free(msg);
return 0; return 0;
} }
msg->message_type = MESSAGE_TYPE_PUT_VALUE;
msg->provider_peer_head = libp2p_utils_linked_list_new(); msg->provider_peer_head = libp2p_utils_linked_list_new();
msg->provider_peer_head->item = libp2p_peer_copy(local_node->identity->peer); msg->provider_peer_head->item = libp2p_peer_copy(local_node->identity->peer);
// msg->Libp2pRecord // msg->Libp2pRecord

View file

@ -12,7 +12,8 @@ int test_core_api_startup_shutdown() {
char* repo_path = "/tmp/ipfs_1"; char* repo_path = "/tmp/ipfs_1";
char* peer_id = NULL; char* peer_id = NULL;
int retVal = 0; int retVal = 0;
pthread_t daemon_thread; pthread_t daemon_thread = 0;
struct IpfsNode* client_node = NULL;
//libp2p_logger_add_class("api"); //libp2p_logger_add_class("api");
@ -24,7 +25,6 @@ int test_core_api_startup_shutdown() {
sleep(3); sleep(3);
// make a client to the api // make a client to the api
struct IpfsNode* client_node = NULL;
if (!ipfs_node_offline_new(repo_path, &client_node)) { if (!ipfs_node_offline_new(repo_path, &client_node)) {
goto exit; goto exit;
} }
@ -234,6 +234,7 @@ int test_core_api_name_resolve_1() {
libp2p_logger_add_class("api"); libp2p_logger_add_class("api");
libp2p_logger_add_class("test_api"); libp2p_logger_add_class("test_api");
libp2p_logger_add_class("protocol");
// repo 1 // repo 1
if (!drop_build_open_repo(ipfs_path1, &fs_repo, config_file1)) { if (!drop_build_open_repo(ipfs_path1, &fs_repo, config_file1)) {
@ -285,12 +286,14 @@ int test_core_api_name_resolve_2() {
char* ipfs_path2 = "/tmp/ipfs_2"; char* ipfs_path2 = "/tmp/ipfs_2";
char* config_file2 = "config.test2.wo_journal"; char* config_file2 = "config.test2.wo_journal";
struct FSRepo* fs_repo = NULL; struct FSRepo* fs_repo = NULL;
char peer_id1[256] = "QmZVoAZGFfinB7MQQiDzB84kWaDPQ95GLuXdemJFM2r9b4"; char peer_id1[256] = "/ipns/QmZVoAZGFfinB7MQQiDzB84kWaDPQ95GLuXdemJFM2r9b4";
char* resolve_args[] = {"ipfs", "--config", ipfs_path2, "name", "resolve", peer_id1 }; char* resolve_args[] = {"ipfs", "--config", ipfs_path2, "name", "resolve", peer_id1 };
struct CliArguments* args = NULL; struct CliArguments* args = NULL;
libp2p_logger_add_class("test_api"); libp2p_logger_add_class("test_api");
libp2p_logger_add_class("api"); libp2p_logger_add_class("api");
libp2p_logger_add_class("bitswap_engine");
libp2p_logger_add_class("dht_protocol");
// build 2 repos... repo 2 // build 2 repos... repo 2
if (!drop_build_open_repo(ipfs_path2, &fs_repo, config_file2)) { if (!drop_build_open_repo(ipfs_path2, &fs_repo, config_file2)) {