aboutsummaryrefslogtreecommitdiff
path: root/src/set
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-11-24 14:17:09 +0000
committerChristian Grothoff <christian@grothoff.org>2014-11-24 14:17:09 +0000
commit9448d15d50430f13bf61c86a617037964209df15 (patch)
tree830099058dd7944875f7958453a37d62210c2bef /src/set
parentee9b6d883dfab70149543c96f8d950374429876a (diff)
downloadgnunet-9448d15d50430f13bf61c86a617037964209df15.tar.gz
gnunet-9448d15d50430f13bf61c86a617037964209df15.zip
-indent
Diffstat (limited to 'src/set')
-rw-r--r--src/set/gnunet-service-set.c60
1 files changed, 37 insertions, 23 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index db377bfcf..488038f81 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -537,26 +537,24 @@ listener_get_by_target (enum GNUNET_SET_OperationType op,
537 struct Listener *l; 537 struct Listener *l;
538 538
539 for (l = listeners_head; NULL != l; l = l->next) 539 for (l = listeners_head; NULL != l; l = l->next)
540 { 540 if ( (l->operation == op) &&
541 if (l->operation != op) 541 (0 == GNUNET_CRYPTO_hash_cmp (app_id, &l->app_id)) )
542 continue; 542 return l;
543 if (0 != GNUNET_CRYPTO_hash_cmp (app_id, &l->app_id))
544 continue;
545 return l;
546 }
547 return NULL; 543 return NULL;
548} 544}
549 545
550 546
547// ----------------------
551/** 548/**
552 * Suggest the given request to the listener. The listening client can then 549 * Suggest the given request to the listener. The listening client can
553 * accept or reject the remote request. 550 * then accept or reject the remote request.
554 * 551 *
555 * @param incoming the incoming peer with the request to suggest 552 * @param incoming the incoming peer with the request to suggest
556 * @param listener the listener to suggest the request to 553 * @param listener the listener to suggest the request to
557 */ 554 */
558static void 555static void
559incoming_suggest (struct Operation *incoming, struct Listener *listener) 556incoming_suggest (struct Operation *incoming,
557 struct Listener *listener)
560{ 558{
561 struct GNUNET_MQ_Envelope *mqm; 559 struct GNUNET_MQ_Envelope *mqm;
562 struct GNUNET_SET_RequestMessage *cmsg; 560 struct GNUNET_SET_RequestMessage *cmsg;
@@ -605,7 +603,8 @@ handle_incoming_msg (struct Operation *op,
605 603
606 GNUNET_assert (GNUNET_YES == op->is_incoming); 604 GNUNET_assert (GNUNET_YES == op->is_incoming);
607 605
608 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got op request\n"); 606 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
607 "got op request\n");
609 608
610 if (GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST != ntohs (mh->type)) 609 if (GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST != ntohs (mh->type))
611 { 610 {
@@ -640,9 +639,12 @@ handle_incoming_msg (struct Operation *op,
640 return GNUNET_SYSERR; 639 return GNUNET_SYSERR;
641 } 640 }
642 641
643 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "received P2P operation request (op %u, app %s)\n", 642 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
644 ntohl (msg->operation), GNUNET_h2s (&msg->app_id)); 643 "received P2P operation request (op %u, app %s)\n",
645 listener = listener_get_by_target (ntohl (msg->operation), &msg->app_id); 644 ntohl (msg->operation),
645 GNUNET_h2s (&msg->app_id));
646 listener = listener_get_by_target (ntohl (msg->operation),
647 &msg->app_id);
646 if (NULL == listener) 648 if (NULL == listener)
647 { 649 {
648 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 650 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -670,7 +672,9 @@ send_client_element (struct Set *set)
670 struct GNUNET_MQ_Envelope *ev; 672 struct GNUNET_MQ_Envelope *ev;
671 673
672 GNUNET_assert (NULL != set->iter); 674 GNUNET_assert (NULL != set->iter);
673 ret = GNUNET_CONTAINER_multihashmap_iterator_next (set->iter, NULL, (const void **) &ee); 675 ret = GNUNET_CONTAINER_multihashmap_iterator_next (set->iter,
676 NULL,
677 (const void **) &ee);
674 if (GNUNET_NO == ret) 678 if (GNUNET_NO == ret)
675 { 679 {
676 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_ITER_DONE); 680 ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SET_ITER_DONE);
@@ -682,7 +686,9 @@ send_client_element (struct Set *set)
682 struct GNUNET_SET_IterResponseMessage *msg; 686 struct GNUNET_SET_IterResponseMessage *msg;
683 687
684 GNUNET_assert (NULL != ee); 688 GNUNET_assert (NULL != ee);
685 ev = GNUNET_MQ_msg_extra (msg, ee->element.size, GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT); 689 ev = GNUNET_MQ_msg_extra (msg,
690 ee->element.size,
691 GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT);
686 memcpy (&msg[1], ee->element.data, ee->element.size); 692 memcpy (&msg[1], ee->element.data, ee->element.size);
687 msg->element_type = ee->element.type; 693 msg->element_type = ee->element.type;
688 } 694 }
@@ -812,7 +818,9 @@ handle_client_listen (void *cls,
812 listener->client_mq = GNUNET_MQ_queue_for_server_client (client); 818 listener->client_mq = GNUNET_MQ_queue_for_server_client (client);
813 listener->app_id = msg->app_id; 819 listener->app_id = msg->app_id;
814 listener->operation = ntohl (msg->operation); 820 listener->operation = ntohl (msg->operation);
815 GNUNET_CONTAINER_DLL_insert_tail (listeners_head, listeners_tail, listener); 821 GNUNET_CONTAINER_DLL_insert_tail (listeners_head,
822 listeners_tail,
823 listener);
816 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 824 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
817 "new listener created (op %u, app %s)\n", 825 "new listener created (op %u, app %s)\n",
818 listener->operation, 826 listener->operation,
@@ -1032,8 +1040,8 @@ handle_client_evaluate (void *cls,
1032 */ 1040 */
1033static void 1041static void
1034handle_client_iter_ack (void *cls, 1042handle_client_iter_ack (void *cls,
1035 struct GNUNET_SERVER_Client *client, 1043 struct GNUNET_SERVER_Client *client,
1036 const struct GNUNET_MessageHeader *m) 1044 const struct GNUNET_MessageHeader *m)
1037{ 1045{
1038 struct Set *set; 1046 struct Set *set;
1039 1047
@@ -1185,7 +1193,9 @@ handle_client_accept (void *cls,
1185 GNUNET_assert (NULL != op->spec->set); 1193 GNUNET_assert (NULL != op->spec->set);
1186 GNUNET_assert (NULL != op->spec->set->vt); 1194 GNUNET_assert (NULL != op->spec->set->vt);
1187 1195
1188 GNUNET_CONTAINER_DLL_insert (set->ops_head, set->ops_tail, op); 1196 GNUNET_CONTAINER_DLL_insert (set->ops_head,
1197 set->ops_tail,
1198 op);
1189 1199
1190 op->spec->client_request_id = ntohl (msg->request_id); 1200 op->spec->client_request_id = ntohl (msg->request_id);
1191 op->spec->result_mode = ntohs (msg->result_mode); 1201 op->spec->result_mode = ntohs (msg->result_mode);
@@ -1321,8 +1331,11 @@ channel_new_cb (void *cls,
1321 incoming->vt = &incoming_vt; 1331 incoming->vt = &incoming_vt;
1322 incoming->state->timeout_task = 1332 incoming->state->timeout_task =
1323 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, 1333 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
1324 &incoming_timeout_cb, incoming); 1334 &incoming_timeout_cb,
1325 GNUNET_CONTAINER_DLL_insert_tail (incoming_head, incoming_tail, incoming); 1335 incoming);
1336 GNUNET_CONTAINER_DLL_insert_tail (incoming_head,
1337 incoming_tail,
1338 incoming);
1326 1339
1327 return incoming; 1340 return incoming;
1328} 1341}
@@ -1347,7 +1360,8 @@ channel_new_cb (void *cls,
1347 */ 1360 */
1348static void 1361static void
1349channel_end_cb (void *cls, 1362channel_end_cb (void *cls,
1350 const struct GNUNET_CADET_Channel *channel, void *channel_ctx) 1363 const struct GNUNET_CADET_Channel *channel,
1364 void *channel_ctx)
1351{ 1365{
1352 struct Operation *op = channel_ctx; 1366 struct Operation *op = channel_ctx;
1353 1367