aboutsummaryrefslogtreecommitdiff
path: root/src/dht/dht_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/dht_api.c')
-rw-r--r--src/dht/dht_api.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c
index 35d9580e9..b5ae2f8ce 100644
--- a/src/dht/dht_api.c
+++ b/src/dht/dht_api.c
@@ -362,7 +362,7 @@ struct GNUNET_DHT_Handle
362 * Did we start our receive loop yet? 362 * Did we start our receive loop yet?
363 */ 363 */
364 int in_receive; 364 int in_receive;
365 365
366#if ENABLE_MALICIOUS 366#if ENABLE_MALICIOUS
367 /** 367 /**
368 * Handle of act malicious request. 368 * Handle of act malicious request.
@@ -496,11 +496,9 @@ process_pending_messages (struct GNUNET_DHT_Handle *handle);
496 * Try reconnecting to the dht service. 496 * Try reconnecting to the dht service.
497 * 497 *
498 * @param cls a `struct GNUNET_DHT_Handle` 498 * @param cls a `struct GNUNET_DHT_Handle`
499 * @param tc scheduler context
500 */ 499 */
501static void 500static void
502try_reconnect (void *cls, 501try_reconnect (void *cls)
503 const struct GNUNET_SCHEDULER_TaskContext *tc)
504{ 502{
505 struct GNUNET_DHT_Handle *handle = cls; 503 struct GNUNET_DHT_Handle *handle = cls;
506 504
@@ -650,7 +648,7 @@ transmit_pending (void *cls,
650 head->in_pending_queue = GNUNET_NO; 648 head->in_pending_queue = GNUNET_NO;
651 if (NULL != head->cont) 649 if (NULL != head->cont)
652 { 650 {
653 head->cont (head->cont_cls, NULL); 651 head->cont (head->cont_cls);
654 head->cont = NULL; 652 head->cont = NULL;
655 head->cont_cls = NULL; 653 head->cont_cls = NULL;
656 } 654 }
@@ -663,7 +661,7 @@ transmit_pending (void *cls,
663 { 661 {
664 LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting to process replies from DHT\n"); 662 LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting to process replies from DHT\n");
665 handle->in_receive = GNUNET_YES; 663 handle->in_receive = GNUNET_YES;
666 664
667 GNUNET_CLIENT_receive (handle->client, &service_message_handler, handle, 665 GNUNET_CLIENT_receive (handle->client, &service_message_handler, handle,
668 GNUNET_TIME_UNIT_FOREVER_REL); 666 GNUNET_TIME_UNIT_FOREVER_REL);
669 } 667 }
@@ -899,7 +897,7 @@ process_act_malicious_confirmation_message (struct GNUNET_DHT_Handle *handle,
899 struct GNUNET_DHT_ActMaliciousHandle *mh; 897 struct GNUNET_DHT_ActMaliciousHandle *mh;
900 GNUNET_DHT_PutContinuation cont; 898 GNUNET_DHT_PutContinuation cont;
901 void *cont_cls; 899 void *cont_cls;
902 900
903 mh = handle->mh; 901 mh = handle->mh;
904 if (NULL == mh) 902 if (NULL == mh)
905 return GNUNET_OK; 903 return GNUNET_OK;
@@ -907,7 +905,7 @@ process_act_malicious_confirmation_message (struct GNUNET_DHT_Handle *handle,
907 cont_cls = mh->cont_cls; 905 cont_cls = mh->cont_cls;
908 if (NULL != cont) 906 if (NULL != cont)
909 cont (cont_cls, GNUNET_OK); 907 cont (cont_cls, GNUNET_OK);
910 908
911 return GNUNET_OK; 909 return GNUNET_OK;
912} 910}
913#endif 911#endif
@@ -1110,7 +1108,7 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle)
1110 pm->in_pending_queue = GNUNET_NO; 1108 pm->in_pending_queue = GNUNET_NO;
1111 GNUNET_assert (GNUNET_YES == pm->free_on_send); 1109 GNUNET_assert (GNUNET_YES == pm->free_on_send);
1112 if (NULL != pm->cont) 1110 if (NULL != pm->cont)
1113 pm->cont (pm->cont_cls, NULL); 1111 pm->cont (pm->cont_cls);
1114 GNUNET_free (pm); 1112 GNUNET_free (pm);
1115 } 1113 }
1116 while (NULL != (ph = handle->put_head)) 1114 while (NULL != (ph = handle->put_head))
@@ -1137,11 +1135,9 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle)
1137 * Timeout for the transmission of a fire&forget-request. Clean it up. 1135 * Timeout for the transmission of a fire&forget-request. Clean it up.
1138 * 1136 *
1139 * @param cls the `struct GNUNET_DHT_PutHandle *` 1137 * @param cls the `struct GNUNET_DHT_PutHandle *`
1140 * @param tc scheduler context
1141 */ 1138 */
1142static void 1139static void
1143timeout_put_request (void *cls, 1140timeout_put_request (void *cls)
1144 const struct GNUNET_SCHEDULER_TaskContext *tc)
1145{ 1141{
1146 struct GNUNET_DHT_PutHandle *ph = cls; 1142 struct GNUNET_DHT_PutHandle *ph = cls;
1147 struct GNUNET_DHT_Handle *handle = ph->dht_handle; 1143 struct GNUNET_DHT_Handle *handle = ph->dht_handle;
@@ -1168,11 +1164,9 @@ timeout_put_request (void *cls,
1168 * the message pointer in the put handle to NULL. 1164 * the message pointer in the put handle to NULL.
1169 * 1165 *
1170 * @param cls the `struct GNUNET_DHT_PutHandle` 1166 * @param cls the `struct GNUNET_DHT_PutHandle`
1171 * @param tc unused
1172 */ 1167 */
1173static void 1168static void
1174mark_put_message_gone (void *cls, 1169mark_put_message_gone (void *cls)
1175 const struct GNUNET_SCHEDULER_TaskContext *tc)
1176{ 1170{
1177 struct GNUNET_DHT_PutHandle *ph = cls; 1171 struct GNUNET_DHT_PutHandle *ph = cls;
1178 1172
@@ -1570,10 +1564,10 @@ GNUNET_DHT_monitor_stop (struct GNUNET_DHT_MonitorHandle *handle)
1570 * @param handle the DHT handle 1564 * @param handle the DHT handle
1571 * @param action 1 to make the service malicious; 0 to make it benign 1565 * @param action 1 to make the service malicious; 0 to make it benign
1572 * @param cont continuation to call when done (transmitting request to service) 1566 * @param cont continuation to call when done (transmitting request to service)
1573 * @param cont_cls closure for @a cont 1567 * @param cont_cls closure for @a cont
1574 */ 1568 */
1575struct GNUNET_DHT_ActMaliciousHandle * 1569struct GNUNET_DHT_ActMaliciousHandle *
1576GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle, 1570GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle,
1577 unsigned int action, 1571 unsigned int action,
1578 GNUNET_DHT_PutContinuation cont, 1572 GNUNET_DHT_PutContinuation cont,
1579 void *cont_cls) 1573 void *cont_cls)
@@ -1582,7 +1576,7 @@ GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle,
1582 struct GNUNET_DHT_ActMaliciousHandle *mh; 1576 struct GNUNET_DHT_ActMaliciousHandle *mh;
1583 struct PendingMessage *pending; 1577 struct PendingMessage *pending;
1584 size_t msize; 1578 size_t msize;
1585 1579
1586 msize = sizeof(struct GNUNET_DHT_ActMaliciousMessage); 1580 msize = sizeof(struct GNUNET_DHT_ActMaliciousMessage);
1587 if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 1581 if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
1588 { 1582 {