X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fdht%2Fdht_api.c;h=66eaf10647dad7e6a424e3440593f030603d4c46;hb=5b32752cd7b02adcb8e6fec7798637638c6f63a0;hp=de1043ca95655844b7b93a3432da4d18c7c99eb7;hpb=021e5d47b4ac2fd2088cee65e551fd7e6114e99b;p=oweals%2Fgnunet.git diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index de1043ca9..66eaf1064 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c @@ -291,7 +291,7 @@ send_get (struct GNUNET_DHT_GetHandle *gh) get_msg->type = htonl (gh->type); get_msg->key = gh->key; get_msg->unique_id = gh->unique_id; - memcpy (&get_msg[1], + GNUNET_memcpy (&get_msg[1], &gh[1], gh->xquery_size); GNUNET_MQ_send (h->mq, @@ -332,7 +332,7 @@ send_get_known_results (struct GNUNET_DHT_GetHandle *gh, GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN); msg->key = gh->key; msg->unique_id = gh->unique_id; - memcpy (&msg[1], + GNUNET_memcpy (&msg[1], &gh->seen_results[transmission_offset], sizeof (struct GNUNET_HashCode) * delta); GNUNET_MQ_send (h->mq, @@ -842,32 +842,32 @@ handle_put_confirmation (void *cls, static int try_connect (struct GNUNET_DHT_Handle *h) { - GNUNET_MQ_hd_var_size (monitor_get, - GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET, - struct GNUNET_DHT_MonitorGetMessage); - GNUNET_MQ_hd_var_size (monitor_get_resp, - GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP, - struct GNUNET_DHT_MonitorGetRespMessage); - GNUNET_MQ_hd_var_size (monitor_put, - GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT, - struct GNUNET_DHT_MonitorPutMessage); - GNUNET_MQ_hd_var_size (client_result, - GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT, - struct GNUNET_DHT_ClientResultMessage); - GNUNET_MQ_hd_fixed_size (put_confirmation, - GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT_OK, - struct GNUNET_DHT_ClientPutConfirmationMessage); struct GNUNET_MQ_MessageHandler handlers[] = { - make_monitor_get_handler (h), - make_monitor_get_resp_handler (h), - make_monitor_put_handler (h), - make_client_result_handler (h), - make_put_confirmation_handler (h), + GNUNET_MQ_hd_var_size (monitor_get, + GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET, + struct GNUNET_DHT_MonitorGetMessage, + h), + GNUNET_MQ_hd_var_size (monitor_get_resp, + GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP, + struct GNUNET_DHT_MonitorGetRespMessage, + h), + GNUNET_MQ_hd_var_size (monitor_put, + GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT, + struct GNUNET_DHT_MonitorPutMessage, + h), + GNUNET_MQ_hd_var_size (client_result, + GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT, + struct GNUNET_DHT_ClientResultMessage, + h), + GNUNET_MQ_hd_fixed_size (put_confirmation, + GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT_OK, + struct GNUNET_DHT_ClientPutConfirmationMessage, + h), GNUNET_MQ_handler_end () }; if (NULL != h->mq) return GNUNET_OK; - h->mq = GNUNET_CLIENT_connecT (h->cfg, + h->mq = GNUNET_CLIENT_connect (h->cfg, "dht", handlers, &mq_error_handler, @@ -993,6 +993,10 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, } if (NULL == handle->mq) return NULL; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Sending PUT for %s to DHT via %p\n", + GNUNET_h2s (key), + handle); ph = GNUNET_new (struct GNUNET_DHT_PutHandle); ph->dht_handle = handle; ph->cont = cont; @@ -1010,7 +1014,7 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, put_msg->unique_id = ph->unique_id; put_msg->expiration = GNUNET_TIME_absolute_hton (exp); put_msg->key = *key; - memcpy (&put_msg[1], + GNUNET_memcpy (&put_msg[1], data, size); GNUNET_MQ_send (handle->mq, @@ -1094,7 +1098,7 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, gh->desired_replication_level = desired_replication_level; gh->type = type; gh->options = options; - memcpy (&gh[1], + GNUNET_memcpy (&gh[1], xquery, xquery_size); GNUNET_CONTAINER_multihashmap_put (handle->active_requests, @@ -1131,7 +1135,7 @@ GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle, GNUNET_array_grow (get_handle->seen_results, get_handle->seen_results_size, needed); - memcpy (&get_handle->seen_results[get_handle->seen_results_end], + GNUNET_memcpy (&get_handle->seen_results[get_handle->seen_results_end], results, num_results * sizeof (struct GNUNET_HashCode)); get_handle->seen_results_end += num_results;