aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxrs <xrs@mail36.net>2017-03-01 19:24:17 +0100
committerxrs <xrs@mail36.net>2017-03-01 19:24:17 +0100
commit9528dcc4b739041f51ed0c8791fe34902525fac2 (patch)
tree84fb225f260e013e855daace41e9c10478022a1b /src
parentf82b3a27df765f4a31548ae4efe66dc3dbc42cef (diff)
parent13b340c41157eb7d1d37e2d16058ce791a7c768e (diff)
downloadgnunet-9528dcc4b739041f51ed0c8791fe34902525fac2.tar.gz
gnunet-9528dcc4b739041f51ed0c8791fe34902525fac2.zip
Merge branch 'master' of ssh://gnunet.org/gnunet
Diffstat (limited to 'src')
-rw-r--r--src/consensus/gnunet-service-consensus.c30
-rw-r--r--src/set/gnunet-service-set.c4
-rw-r--r--src/set/gnunet-service-set_union.c13
-rw-r--r--src/set/set_api.c6
-rw-r--r--src/topology/friends.c18
5 files changed, 62 insertions, 9 deletions
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c
index b934f468f..ba84f64a2 100644
--- a/src/consensus/gnunet-service-consensus.c
+++ b/src/consensus/gnunet-service-consensus.c
@@ -393,6 +393,14 @@ struct DiffEntry
393 struct GNUNET_CONTAINER_MultiHashMap *changes; 393 struct GNUNET_CONTAINER_MultiHashMap *changes;
394}; 394};
395 395
396struct SetHandle
397{
398 struct SetHandle *prev;
399 struct SetHandle *next;
400
401 struct GNUNET_SET_Handle *h;
402};
403
396 404
397 405
398/** 406/**
@@ -499,6 +507,9 @@ struct ConsensusSession
499 * Bounded Eppstein lower bound. 507 * Bounded Eppstein lower bound.
500 */ 508 */
501 uint64_t lower_bound; 509 uint64_t lower_bound;
510
511 struct SetHandle *set_handles_head;
512 struct SetHandle *set_handles_tail;
502}; 513};
503 514
504/** 515/**
@@ -1663,6 +1674,12 @@ set_copy_cb (void *cls, struct GNUNET_SET_Handle *copy)
1663 struct TaskEntry *task = scc->task; 1674 struct TaskEntry *task = scc->task;
1664 struct SetKey dst_set_key = scc->dst_set_key; 1675 struct SetKey dst_set_key = scc->dst_set_key;
1665 struct SetEntry *set; 1676 struct SetEntry *set;
1677 struct SetHandle *sh = GNUNET_new (struct SetHandle);
1678
1679 sh->h = copy;
1680 GNUNET_CONTAINER_DLL_insert (task->step->session->set_handles_head,
1681 task->step->session->set_handles_tail,
1682 sh);
1666 1683
1667 GNUNET_free (scc); 1684 GNUNET_free (scc);
1668 set = GNUNET_new (struct SetEntry); 1685 set = GNUNET_new (struct SetEntry);
@@ -3152,6 +3169,11 @@ handle_client_join (void *cls,
3152 client_set = GNUNET_new (struct SetEntry); 3169 client_set = GNUNET_new (struct SetEntry);
3153 client_set->h = GNUNET_SET_create (cfg, 3170 client_set->h = GNUNET_SET_create (cfg,
3154 GNUNET_SET_OPERATION_UNION); 3171 GNUNET_SET_OPERATION_UNION);
3172 struct SetHandle *sh = GNUNET_new (struct SetHandle);
3173 sh->h = client_set->h;
3174 GNUNET_CONTAINER_DLL_insert (session->set_handles_head,
3175 session->set_handles_tail,
3176 sh);
3155 client_set->key = ((struct SetKey) { SET_KIND_CURRENT, 0, 0 }); 3177 client_set->key = ((struct SetKey) { SET_KIND_CURRENT, 0, 0 });
3156 put_set (session, 3178 put_set (session,
3157 client_set); 3179 client_set);
@@ -3370,6 +3392,14 @@ client_disconnect_cb (void *cls,
3370 GNUNET_CONTAINER_DLL_remove (sessions_head, 3392 GNUNET_CONTAINER_DLL_remove (sessions_head,
3371 sessions_tail, 3393 sessions_tail,
3372 session); 3394 session);
3395
3396 while (session->set_handles_head)
3397 {
3398 struct SetHandle *sh = session->set_handles_head;
3399 session->set_handles_head = sh->next;
3400 GNUNET_SET_destroy (sh->h);
3401 GNUNET_free (sh);
3402 }
3373 GNUNET_free (session); 3403 GNUNET_free (session);
3374} 3404}
3375 3405
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index b0f8b2091..454ad9784 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -672,11 +672,12 @@ client_disconnect_cb (void *cls,
672 "Client's set destroyed\n"); 672 "Client's set destroyed\n");
673 } 673 }
674 struct Listener *listener = listener_get (client); 674 struct Listener *listener = listener_get (client);
675 struct Operation *op = incoming_head;
676 if (NULL != listener) 675 if (NULL != listener)
677 { 676 {
678 /* destroy all incoming operations whose client just 677 /* destroy all incoming operations whose client just
679 * got destroyed */ 678 * got destroyed */
679 //struct Operation *op = incoming_head;
680 /*
680 while (NULL != op) 681 while (NULL != op)
681 { 682 {
682 struct Operation *curr = op; 683 struct Operation *curr = op;
@@ -685,6 +686,7 @@ client_disconnect_cb (void *cls,
685 (curr->listener == listener) ) 686 (curr->listener == listener) )
686 incoming_destroy (curr); 687 incoming_destroy (curr);
687 } 688 }
689 */
688 listener->client = NULL; 690 listener->client = NULL;
689 listener_destroy (listener); 691 listener_destroy (listener);
690 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 692 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index f46713c31..b5b602074 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -877,6 +877,8 @@ handle_p2p_strata_estimator (void *cls,
877 if (diff > 200) 877 if (diff > 200)
878 diff = diff * 3 / 2; 878 diff = diff * 3 / 2;
879 879
880
881
880 strata_estimator_destroy (remote_se); 882 strata_estimator_destroy (remote_se);
881 strata_estimator_destroy (op->state->se); 883 strata_estimator_destroy (op->state->se);
882 op->state->se = NULL; 884 op->state->se = NULL;
@@ -885,6 +887,17 @@ handle_p2p_strata_estimator (void *cls,
885 diff, 887 diff,
886 1<<get_order_from_difference (diff)); 888 1<<get_order_from_difference (diff));
887 889
890 {
891 char *set_debug;
892 set_debug = getenv ("GNUNET_SET_BENCHMARK");
893 if ( (NULL != set_debug) && (0 == strcmp (set_debug, "1")) )
894 {
895 FILE *f = fopen ("set.log", "a");
896 fprintf (f, "%llu\n", (unsigned long long) diff);
897 fclose (f);
898 }
899 }
900
888 if ((GNUNET_YES == op->spec->byzantine) && (other_size < op->spec->byzantine_lower_bound)) 901 if ((GNUNET_YES == op->spec->byzantine) && (other_size < op->spec->byzantine_lower_bound))
889 { 902 {
890 GNUNET_break (0); 903 GNUNET_break (0);
diff --git a/src/set/set_api.c b/src/set/set_api.c
index 5b5b1b8ee..04a4e4910 100644
--- a/src/set/set_api.c
+++ b/src/set/set_api.c
@@ -349,6 +349,9 @@ handle_iter_done (void *cls,
349 set->iteration_id++; 349 set->iteration_id++;
350 iter (set->iterator_cls, 350 iter (set->iterator_cls,
351 NULL); 351 NULL);
352
353 if (GNUNET_YES == set->destroy_requested)
354 GNUNET_SET_destroy (set);
352} 355}
353 356
354 357
@@ -733,8 +736,7 @@ GNUNET_SET_destroy (struct GNUNET_SET_Handle *set)
733 /* destroying set while iterator is active is currently 736 /* destroying set while iterator is active is currently
734 not supported; we should expand the API to allow 737 not supported; we should expand the API to allow
735 clients to explicitly cancel the iteration! */ 738 clients to explicitly cancel the iteration! */
736 GNUNET_assert (NULL == set->iterator); 739 if ( (NULL != set->ops_head) || (NULL != set->iterator) )
737 if (NULL != set->ops_head)
738 { 740 {
739 LOG (GNUNET_ERROR_TYPE_DEBUG, 741 LOG (GNUNET_ERROR_TYPE_DEBUG,
740 "Set operations are pending, delaying set destruction\n"); 742 "Set operations are pending, delaying set destruction\n");
diff --git a/src/topology/friends.c b/src/topology/friends.c
index 59c70e4b0..a960fad17 100644
--- a/src/topology/friends.c
+++ b/src/topology/friends.c
@@ -58,14 +58,20 @@ GNUNET_FRIENDS_parse (const struct GNUNET_CONFIGURATION_Handle *cfg,
58 return GNUNET_SYSERR; 58 return GNUNET_SYSERR;
59 } 59 }
60 if ( (GNUNET_OK != GNUNET_DISK_file_test (fn)) && 60 if ( (GNUNET_OK != GNUNET_DISK_file_test (fn)) &&
61 (GNUNET_OK != GNUNET_DISK_fn_write (fn, NULL, 0, 61 (GNUNET_OK != GNUNET_DISK_fn_write (fn,
62 NULL,
63 0,
62 GNUNET_DISK_PERM_USER_READ | 64 GNUNET_DISK_PERM_USER_READ |
63 GNUNET_DISK_PERM_USER_WRITE)) ) 65 GNUNET_DISK_PERM_USER_WRITE |
64 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "write", fn); 66 GNUNET_DISK_OPEN_CREATE)) )
67 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
68 "write",
69 fn);
65 if ( (GNUNET_OK != 70 if ( (GNUNET_OK !=
66 GNUNET_DISK_file_size (fn, 71 GNUNET_DISK_file_size (fn,
67 &fsize, 72 &fsize,
68 GNUNET_NO, GNUNET_YES)) || 73 GNUNET_NO,
74 GNUNET_YES)) ||
69 (0 == fsize) ) 75 (0 == fsize) )
70 { 76 {
71 GNUNET_free (fn); 77 GNUNET_free (fn);
@@ -93,8 +99,8 @@ GNUNET_FRIENDS_parse (const struct GNUNET_CONFIGURATION_Handle *cfg,
93 pos++; 99 pos++;
94 if (GNUNET_OK != 100 if (GNUNET_OK !=
95 GNUNET_CRYPTO_eddsa_public_key_from_string (&data[start], 101 GNUNET_CRYPTO_eddsa_public_key_from_string (&data[start],
96 pos - start, 102 pos - start,
97 &pid.public_key)) 103 &pid.public_key))
98 { 104 {
99 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 105 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
100 _("Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n"), 106 _("Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n"),