aboutsummaryrefslogtreecommitdiff
path: root/src/experimentation
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-01 07:46:18 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-01 07:46:18 +0000
commit15e69b2c40795016f3365ec2e75d3368a23d6013 (patch)
treec089d28b91676d62bfa89c22ec785bda26963123 /src/experimentation
parentb7365c9a57b357d6f19f4f8101d3177e142a235c (diff)
downloadgnunet-15e69b2c40795016f3365ec2e75d3368a23d6013.tar.gz
gnunet-15e69b2c40795016f3365ec2e75d3368a23d6013.zip
-just indentation
Diffstat (limited to 'src/experimentation')
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_experiments.c191
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_nodes.c125
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_scheduler.c1
3 files changed, 165 insertions, 152 deletions
diff --git a/src/experimentation/gnunet-daemon-experimentation_experiments.c b/src/experimentation/gnunet-daemon-experimentation_experiments.c
index c787c3416..5ca81393f 100644
--- a/src/experimentation/gnunet-daemon-experimentation_experiments.c
+++ b/src/experimentation/gnunet-daemon-experimentation_experiments.c
@@ -25,20 +25,18 @@
25 * @author Matthias Wachs 25 * @author Matthias Wachs
26 */ 26 */
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_getopt_lib.h"
29#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
30#include "gnunet_core_service.h" 29#include "gnunet_core_service.h"
31#include "gnunet_statistics_service.h" 30#include "gnunet_statistics_service.h"
32#include "gnunet-daemon-experimentation.h" 31#include "gnunet-daemon-experimentation.h"
33 32
34 33
35
36/** 34/**
37 * Struct to store information about an experiment issuer 35 * Struct to store information about an experiment issuer
38 */ 36 */
39struct Issuer 37struct Issuer
40{ 38{
41 struct GNUNET_CRYPTO_EccPublicSignKey pubkey; 39 struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
42}; 40};
43 41
44 42
@@ -47,14 +45,13 @@ struct Issuer
47 */ 45 */
48static struct GNUNET_CONTAINER_MultiHashMap *valid_issuers; 46static struct GNUNET_CONTAINER_MultiHashMap *valid_issuers;
49 47
50
51/** 48/**
52 * Hashmap containing valid experiments 49 * Hashmap containing valid experiments
53 */ 50 */
54static struct GNUNET_CONTAINER_MultiHashMap *experiments; 51static struct GNUNET_CONTAINER_MultiHashMap *experiments;
55 52
56 53
57uint32_t GSE_my_issuer_count; 54static uint32_t GSE_my_issuer_count;
58 55
59/** 56/**
60 * Valid experiment issuer for this daemon 57 * Valid experiment issuer for this daemon
@@ -74,23 +71,26 @@ struct Experimentation_Issuer *GSE_my_issuer;
74int 71int
75experiment_verify (struct Issuer *i, struct Experiment *e) 72experiment_verify (struct Issuer *i, struct Experiment *e)
76{ 73{
77 GNUNET_assert (NULL != i); 74 GNUNET_assert (NULL != i);
78 GNUNET_assert (NULL != e); 75 GNUNET_assert (NULL != e);
79 76
80 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Verification: to be implemented\n"); 77 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
81 return GNUNET_OK; 78 "Verification: to be implemented\n");
79 return GNUNET_OK;
82} 80}
83 81
84int free_experiment (void *cls, 82int
85 const struct GNUNET_HashCode * key, 83free_experiment (void *cls,
86 void *value) 84 const struct GNUNET_HashCode * key,
85 void *value)
87{ 86{
88 struct Experiment *e = value; 87 struct Experiment *e = value;
89 GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (experiments, key, value)); 88
90 GNUNET_free_non_null (e->description); 89 GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (experiments, key, value));
91 GNUNET_free_non_null (e->name); 90 GNUNET_free_non_null (e->description);
92 GNUNET_free (e); 91 GNUNET_free_non_null (e->name);
93 return GNUNET_OK; 92 GNUNET_free (e);
93 return GNUNET_OK;
94} 94}
95 95
96 96
@@ -102,27 +102,31 @@ int free_experiment (void *cls,
102 * @param value the issuer element to free 102 * @param value the issuer element to free
103 * @return GNUNET_OK to continue 103 * @return GNUNET_OK to continue
104 */ 104 */
105int free_issuer (void *cls, 105int
106 const struct GNUNET_HashCode * key, 106free_issuer (void *cls,
107 void *value) 107 const struct GNUNET_HashCode * key,
108 void *value)
108{ 109{
109 struct Issuer *i = value; 110 struct Issuer *i = value;
110 GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (valid_issuers, key, value)); 111
111 GNUNET_free (i); 112 GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (valid_issuers, key, value));
112 return GNUNET_OK; 113 GNUNET_free (i);
114 return GNUNET_OK;
113} 115}
114 116
115int create_issuer (void *cls,
116 const struct GNUNET_HashCode * key,
117 void *value)
118{
119 static int i = 0;
120 GNUNET_assert (i < GSE_my_issuer_count);
121 GSE_my_issuer[i].issuer_id.hashPubKey = *key;
122 117
123 i++; 118int
124 return GNUNET_OK; 119create_issuer (void *cls,
120 const struct GNUNET_HashCode * key,
121 void *value)
122{
123 static int i = 0;
125 124
125 GNUNET_assert (i < GSE_my_issuer_count);
126 GSE_my_issuer[i].issuer_id.hashPubKey = *key;
127
128 i++;
129 return GNUNET_OK;
126} 130}
127 131
128 132
@@ -135,34 +139,36 @@ int create_issuer (void *cls,
135int 139int
136GED_experiments_issuer_accepted (struct GNUNET_PeerIdentity *issuer_ID) 140GED_experiments_issuer_accepted (struct GNUNET_PeerIdentity *issuer_ID)
137{ 141{
138 if (GNUNET_CONTAINER_multihashmap_contains (valid_issuers, &issuer_ID->hashPubKey)) 142 if (GNUNET_CONTAINER_multihashmap_contains (valid_issuers, &issuer_ID->hashPubKey))
139 return GNUNET_YES; 143 return GNUNET_YES;
140 else 144 else
141 return GNUNET_NO; 145 return GNUNET_NO;
142} 146}
143 147
148
144struct FindCtx 149struct FindCtx
145{ 150{
146 const char *name; 151 const char *name;
147 struct GNUNET_TIME_Absolute version; 152 struct GNUNET_TIME_Absolute version;
148 struct Experiment *res; 153 struct Experiment *res;
149}; 154};
150 155
156
151static int 157static int
152find_it (void *cls, 158find_it (void *cls,
153 const struct GNUNET_HashCode * key, 159 const struct GNUNET_HashCode * key,
154 void *value) 160 void *value)
155{ 161{
156 struct FindCtx *find_ctx = cls; 162 struct FindCtx *find_ctx = cls;
157 struct Experiment *e = (struct Experiment *) value; 163 struct Experiment *e = (struct Experiment *) value;
158 164
159 if (0 != strcmp(e->name, find_ctx->name)) 165 if (0 != strcmp(e->name, find_ctx->name))
160 return GNUNET_OK; 166 return GNUNET_OK;
161 if (e->version.abs_value_us != find_ctx->version.abs_value_us) 167 if (e->version.abs_value_us != find_ctx->version.abs_value_us)
162 return GNUNET_OK; 168 return GNUNET_OK;
163 169
164 find_ctx->res = e; 170 find_ctx->res = e;
165 return GNUNET_NO; 171 return GNUNET_NO;
166} 172}
167 173
168 174
@@ -176,44 +182,47 @@ find_it (void *cls,
176 */ 182 */
177struct Experiment * 183struct Experiment *
178GED_experiments_find (const struct GNUNET_PeerIdentity *issuer, 184GED_experiments_find (const struct GNUNET_PeerIdentity *issuer,
179 const char *name, 185 const char *name,
180 const struct GNUNET_TIME_Absolute version) 186 const struct GNUNET_TIME_Absolute version)
181{ 187{
182 struct FindCtx find_ctx; 188 struct FindCtx find_ctx;
183 189
184 find_ctx.name = name; 190 find_ctx.name = name;
185 find_ctx.version = version; 191 find_ctx.version = version;
186 find_ctx.res = NULL; 192 find_ctx.res = NULL;
187 193
188 GNUNET_CONTAINER_multihashmap_get_multiple (experiments, 194 GNUNET_CONTAINER_multihashmap_get_multiple (experiments,
189 &issuer->hashPubKey, &find_it, &find_ctx); 195 &issuer->hashPubKey,
190 return find_ctx.res; 196 &find_it, &find_ctx);
197 return find_ctx.res;
191} 198}
192 199
200
193struct GetCtx 201struct GetCtx
194{ 202{
195 struct Node *n; 203 struct Node *n;
196 GNUNET_EXPERIMENTATION_experiments_get_cb get_cb; 204 GNUNET_EXPERIMENTATION_experiments_get_cb get_cb;
197}; 205};
198 206
199 207
200static int 208static int
201get_it (void *cls, 209get_it (void *cls,
202 const struct GNUNET_HashCode * key, 210 const struct GNUNET_HashCode * key,
203 void *value) 211 void *value)
204{ 212{
205 struct GetCtx *get_ctx = cls; 213 struct GetCtx *get_ctx = cls;
206 struct Experiment *e = value; 214 struct Experiment *e = value;
207 215
208 get_ctx->get_cb (get_ctx->n, e); 216 get_ctx->get_cb (get_ctx->n, e);
209 217
210 return GNUNET_OK; 218 return GNUNET_OK;
211} 219}
212 220
221
213void 222void
214GED_experiments_get (struct Node *n, 223GED_experiments_get (struct Node *n,
215 struct GNUNET_PeerIdentity *issuer, 224 struct GNUNET_PeerIdentity *issuer,
216 GNUNET_EXPERIMENTATION_experiments_get_cb get_cb) 225 GNUNET_EXPERIMENTATION_experiments_get_cb get_cb)
217{ 226{
218 struct GetCtx get_ctx; 227 struct GetCtx get_ctx;
219 228
@@ -230,22 +239,25 @@ GED_experiments_get (struct Node *n,
230 get_cb (n, NULL); 239 get_cb (n, NULL);
231} 240}
232 241
242
233/** 243/**
234 * Add a new experiment 244 * Add a new experiment
235 */ 245 */
236int GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i, 246int
237 const char *name, 247GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i,
238 struct GNUNET_PeerIdentity issuer_id, 248 const char *name,
239 struct GNUNET_TIME_Absolute version, 249 struct GNUNET_PeerIdentity issuer_id,
240 char *description, 250 struct GNUNET_TIME_Absolute version,
241 uint32_t required_capabilities, 251 char *description,
242 struct GNUNET_TIME_Absolute start, 252 uint32_t required_capabilities,
243 struct GNUNET_TIME_Relative frequency, 253 struct GNUNET_TIME_Absolute start,
244 struct GNUNET_TIME_Relative duration, 254 struct GNUNET_TIME_Relative frequency,
245 struct GNUNET_TIME_Absolute stop) 255 struct GNUNET_TIME_Relative duration,
256 struct GNUNET_TIME_Absolute stop)
246{ 257{
247 struct Experiment *e; 258 struct Experiment *e;
248 e = GNUNET_malloc (sizeof (struct Experiment)); 259
260 e = GNUNET_new (struct Experiment);
249 261
250 e->name = GNUNET_strdup (name); 262 e->name = GNUNET_strdup (name);
251 e->issuer = issuer_id; 263 e->issuer = issuer_id;
@@ -287,8 +299,9 @@ int GNUNET_EXPERIMENTATION_experiments_add (struct Issuer *i,
287 * @param cls configuration handle 299 * @param cls configuration handle
288 * @param name section name 300 * @param name section name
289 */ 301 */
290void exp_file_iterator (void *cls, 302void
291 const char *name) 303exp_file_iterator (void *cls,
304 const char *name)
292{ 305{
293 struct GNUNET_CONFIGURATION_Handle *exp = cls; 306 struct GNUNET_CONFIGURATION_Handle *exp = cls;
294 struct Issuer *i; 307 struct Issuer *i;
diff --git a/src/experimentation/gnunet-daemon-experimentation_nodes.c b/src/experimentation/gnunet-daemon-experimentation_nodes.c
index d13330b3f..cf278c3ec 100644
--- a/src/experimentation/gnunet-daemon-experimentation_nodes.c
+++ b/src/experimentation/gnunet-daemon-experimentation_nodes.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009 Christian Grothoff (and other contributing authors) 3 (C) 2012-2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -32,35 +32,33 @@
32 32
33 33
34#define FAST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) 34#define FAST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
35
35/** 36/**
36 * Core handle 37 * Core handle
37 */ 38 */
38static struct GNUNET_CORE_Handle *ch; 39static struct GNUNET_CORE_Handle *ch;
39 40
40
41/** 41/**
42 * Peer's own identity 42 * Peer's own identity
43 */ 43 */
44static struct GNUNET_PeerIdentity me; 44static struct GNUNET_PeerIdentity me;
45 45
46
47/** 46/**
48 * Nodes with a pending request 47 * Nodes with a pending request
49 */ 48 */
50struct GNUNET_CONTAINER_MultiHashMap *nodes_requested; 49static struct GNUNET_CONTAINER_MultiPeerMap *nodes_requested;
51
52 50
53/** 51/**
54 * Active experimentation nodes 52 * Active experimentation nodes
55 */ 53 */
56struct GNUNET_CONTAINER_MultiHashMap *nodes_active; 54static struct GNUNET_CONTAINER_MultiPeerMap *nodes_active;
57
58 55
59/** 56/**
60 * Inactive experimentation nodes 57 * Inactive experimentation nodes
61 * To be excluded from future requests 58 * To be excluded from future requests
62 */ 59 */
63struct GNUNET_CONTAINER_MultiHashMap *nodes_inactive; 60static struct GNUNET_CONTAINER_MultiPeerMap *nodes_inactive;
61
64 62
65struct NodeComCtx 63struct NodeComCtx
66{ 64{
@@ -79,9 +77,10 @@ struct NodeComCtx
79/** 77/**
80 * Update statistics 78 * Update statistics
81 * 79 *
82 * @param m hashmap to update values from 80 * @param m peermap to update values from
83 */ 81 */
84static void update_stats (struct GNUNET_CONTAINER_MultiHashMap *m) 82static void
83update_stats (struct GNUNET_CONTAINER_MultiPeerMap *m)
85{ 84{
86 GNUNET_assert (NULL != m); 85 GNUNET_assert (NULL != m);
87 GNUNET_assert (NULL != GED_stats); 86 GNUNET_assert (NULL != GED_stats);
@@ -89,17 +88,17 @@ static void update_stats (struct GNUNET_CONTAINER_MultiHashMap *m)
89 if (m == nodes_active) 88 if (m == nodes_active)
90 { 89 {
91 GNUNET_STATISTICS_set (GED_stats, "# nodes active", 90 GNUNET_STATISTICS_set (GED_stats, "# nodes active",
92 GNUNET_CONTAINER_multihashmap_size(m), GNUNET_NO); 91 GNUNET_CONTAINER_multipeermap_size(m), GNUNET_NO);
93 } 92 }
94 else if (m == nodes_inactive) 93 else if (m == nodes_inactive)
95 { 94 {
96 GNUNET_STATISTICS_set (GED_stats, "# nodes inactive", 95 GNUNET_STATISTICS_set (GED_stats, "# nodes inactive",
97 GNUNET_CONTAINER_multihashmap_size(m), GNUNET_NO); 96 GNUNET_CONTAINER_multipeermap_size(m), GNUNET_NO);
98 } 97 }
99 else if (m == nodes_requested) 98 else if (m == nodes_requested)
100 { 99 {
101 GNUNET_STATISTICS_set (GED_stats, "# nodes requested", 100 GNUNET_STATISTICS_set (GED_stats, "# nodes requested",
102 GNUNET_CONTAINER_multihashmap_size(m), GNUNET_NO); 101 GNUNET_CONTAINER_multipeermap_size(m), GNUNET_NO);
103 } 102 }
104 else 103 else
105 GNUNET_break (0); 104 GNUNET_break (0);
@@ -110,20 +109,20 @@ static void update_stats (struct GNUNET_CONTAINER_MultiHashMap *m)
110/** 109/**
111 * Clean up node 110 * Clean up node
112 * 111 *
113 * @param cls the hashmap to clean up 112 * @param cls the peermap to clean up
114 * @param key key of the current node 113 * @param key key of the current node
115 * @param value related node object 114 * @param value related node object
116 * @return always GNUNET_OK 115 * @return always #GNUNET_OK
117 */ 116 */
118static int 117static int
119cleanup_node (void *cls, 118cleanup_node (void *cls,
120 const struct GNUNET_HashCode * key, 119 const struct GNUNET_PeerIdentity * key,
121 void *value) 120 void *value)
122{ 121{
123 struct Node *n; 122 struct Node *n;
124 struct NodeComCtx *e_cur; 123 struct NodeComCtx *e_cur;
125 struct NodeComCtx *e_next; 124 struct NodeComCtx *e_next;
126 struct GNUNET_CONTAINER_MultiHashMap *cur = cls; 125 struct GNUNET_CONTAINER_MultiPeerMap *cur = cls;
127 126
128 n = value; 127 n = value;
129 if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task) 128 if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task)
@@ -147,7 +146,7 @@ cleanup_node (void *cls,
147 146
148 GNUNET_free_non_null (n->issuer_id); 147 GNUNET_free_non_null (n->issuer_id);
149 148
150 GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (cur, key, value)); 149 GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (cur, key, value));
151 GNUNET_free (value); 150 GNUNET_free (value);
152 return GNUNET_OK; 151 return GNUNET_OK;
153} 152}
@@ -159,14 +158,16 @@ cleanup_node (void *cls,
159 * @param id the id to check 158 * @param id the id to check
160 * @return GNUNET_YES or GNUNET_NO 159 * @return GNUNET_YES or GNUNET_NO
161 */ 160 */
162static int is_me (const struct GNUNET_PeerIdentity *id) 161static int
162is_me (const struct GNUNET_PeerIdentity *id)
163{ 163{
164 if (0 == memcmp (&me, id, sizeof (me))) 164 if (0 == memcmp (&me, id, sizeof (me)))
165 return GNUNET_YES; 165 return GNUNET_YES;
166 else 166 else
167 return GNUNET_NO; 167 return GNUNET_NO;
168} 168}
169 169
170
170/** 171/**
171 * Core startup callback 172 * Core startup callback
172 * 173 *
@@ -239,11 +240,11 @@ remove_request (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
239 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing request for peer %s due to timeout\n", 240 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing request for peer %s due to timeout\n",
240 GNUNET_i2s (&n->id)); 241 GNUNET_i2s (&n->id));
241 242
242 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (nodes_requested, &n->id.hashPubKey)) 243 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, &n->id))
243 { 244 {
244 GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (nodes_requested, &n->id.hashPubKey, n)); 245 GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_requested, &n->id, n));
245 update_stats (nodes_requested); 246 update_stats (nodes_requested);
246 GNUNET_CONTAINER_multihashmap_put (nodes_inactive, &n->id.hashPubKey, n, 247 GNUNET_CONTAINER_multipeermap_put (nodes_inactive, &n->id, n,
247 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 248 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
248 update_stats (nodes_inactive); 249 update_stats (nodes_inactive);
249 } 250 }
@@ -325,8 +326,8 @@ send_experimentation_request (const struct GNUNET_PeerIdentity *peer)
325 GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx); 326 GNUNET_CONTAINER_DLL_insert_tail(n->e_req_head, n->e_req_tail, e_ctx);
326 schedule_transmisson (e_ctx); 327 schedule_transmisson (e_ctx);
327 328
328 GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (nodes_requested, 329 GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multipeermap_put (nodes_requested,
329 &peer->hashPubKey, n, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); 330 peer, n, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
330 update_stats (nodes_requested); 331 update_stats (nodes_requested);
331} 332}
332 333
@@ -389,17 +390,17 @@ get_node (const struct GNUNET_PeerIdentity *id)
389 390
390 res = NULL; 391 res = NULL;
391 tmp = NULL; 392 tmp = NULL;
392 tmp = GNUNET_CONTAINER_multihashmap_get (nodes_active, &id->hashPubKey); 393 tmp = GNUNET_CONTAINER_multipeermap_get (nodes_active, id);
393 if (res == NULL) 394 if (res == NULL)
394 res = tmp; 395 res = tmp;
395 396
396 tmp = GNUNET_CONTAINER_multihashmap_get (nodes_inactive, &id->hashPubKey); 397 tmp = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, id);
397 if (res == NULL) 398 if (res == NULL)
398 res = tmp; 399 res = tmp;
399 else 400 else
400 GNUNET_break (0); /* Multiple instances */ 401 GNUNET_break (0); /* Multiple instances */
401 402
402 tmp = GNUNET_CONTAINER_multihashmap_get (nodes_requested, &id->hashPubKey); 403 tmp = GNUNET_CONTAINER_multipeermap_get (nodes_requested, id);
403 if (res == NULL) 404 if (res == NULL)
404 res = tmp; 405 res = tmp;
405 else 406 else
@@ -417,8 +418,8 @@ get_node (const struct GNUNET_PeerIdentity *id)
417static void node_make_active (struct Node *n) 418static void node_make_active (struct Node *n)
418{ 419{
419 int c1; 420 int c1;
420 GNUNET_CONTAINER_multihashmap_put (nodes_active, 421 GNUNET_CONTAINER_multipeermap_put (nodes_active,
421 &n->id.hashPubKey, n, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 422 &n->id, n, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
422 update_stats (nodes_active); 423 update_stats (nodes_active);
423 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Added peer `%s' as active node\n"), 424 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Added peer `%s' as active node\n"),
424 GNUNET_i2s (&n->id)); 425 GNUNET_i2s (&n->id));
@@ -463,13 +464,13 @@ static void handle_request (const struct GNUNET_PeerIdentity *peer,
463 } 464 }
464 465
465 make_active = GNUNET_NO; 466 make_active = GNUNET_NO;
466 if (NULL != (n = GNUNET_CONTAINER_multihashmap_get (nodes_active, &peer->hashPubKey))) 467 if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer)))
467 { 468 {
468 /* Nothing to do */ 469 /* Nothing to do */
469 } 470 }
470 else if (NULL != (n = GNUNET_CONTAINER_multihashmap_get (nodes_requested, &peer->hashPubKey))) 471 else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_requested, peer)))
471 { 472 {
472 GNUNET_CONTAINER_multihashmap_remove (nodes_requested, &peer->hashPubKey, n); 473 GNUNET_CONTAINER_multipeermap_remove (nodes_requested, peer, n);
473 if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task) 474 if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task)
474 { 475 {
475 GNUNET_SCHEDULER_cancel (n->timeout_task); 476 GNUNET_SCHEDULER_cancel (n->timeout_task);
@@ -478,9 +479,9 @@ static void handle_request (const struct GNUNET_PeerIdentity *peer,
478 update_stats (nodes_requested); 479 update_stats (nodes_requested);
479 make_active = GNUNET_YES; 480 make_active = GNUNET_YES;
480 } 481 }
481 else if (NULL != (n = GNUNET_CONTAINER_multihashmap_get (nodes_inactive, &peer->hashPubKey))) 482 else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, peer)))
482 { 483 {
483 GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (nodes_inactive, &peer->hashPubKey, n)); 484 GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_inactive, peer, n));
484 update_stats (nodes_inactive); 485 update_stats (nodes_inactive);
485 make_active = GNUNET_YES; 486 make_active = GNUNET_YES;
486 } 487 }
@@ -565,16 +566,16 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer,
565 } 566 }
566 567
567 make_active = GNUNET_NO; 568 make_active = GNUNET_NO;
568 if (NULL != (n = GNUNET_CONTAINER_multihashmap_get (nodes_active, &peer->hashPubKey))) 569 if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer)))
569 { 570 {
570 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s from %s peer `%s'\n", 571 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s from %s peer `%s'\n",
571 "RESPONSE", "active", GNUNET_i2s (peer)); 572 "RESPONSE", "active", GNUNET_i2s (peer));
572 } 573 }
573 else if (NULL != (n = GNUNET_CONTAINER_multihashmap_get (nodes_requested, &peer->hashPubKey))) 574 else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_requested, peer)))
574 { 575 {
575 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s from %s peer `%s'\n", 576 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s from %s peer `%s'\n",
576 "RESPONSE", "requested", GNUNET_i2s (peer)); 577 "RESPONSE", "requested", GNUNET_i2s (peer));
577 GNUNET_CONTAINER_multihashmap_remove (nodes_requested, &peer->hashPubKey, n); 578 GNUNET_CONTAINER_multipeermap_remove (nodes_requested, peer, n);
578 if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task) 579 if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task)
579 { 580 {
580 GNUNET_SCHEDULER_cancel (n->timeout_task); 581 GNUNET_SCHEDULER_cancel (n->timeout_task);
@@ -583,11 +584,11 @@ static void handle_response (const struct GNUNET_PeerIdentity *peer,
583 update_stats (nodes_requested); 584 update_stats (nodes_requested);
584 make_active = GNUNET_YES; 585 make_active = GNUNET_YES;
585 } 586 }
586 else if (NULL != (n = GNUNET_CONTAINER_multihashmap_get (nodes_inactive, &peer->hashPubKey))) 587 else if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, peer)))
587 { 588 {
588 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s from peer `%s'\n", 589 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s from peer `%s'\n",
589 "RESPONSE", "inactive", GNUNET_i2s (peer)); 590 "RESPONSE", "inactive", GNUNET_i2s (peer));
590 GNUNET_break (0 == GNUNET_CONTAINER_multihashmap_remove (nodes_inactive, &peer->hashPubKey, n)); 591 GNUNET_break (0 == GNUNET_CONTAINER_multipeermap_remove (nodes_inactive, peer, n));
591 update_stats (nodes_inactive); 592 update_stats (nodes_inactive);
592 make_active = GNUNET_YES; 593 make_active = GNUNET_YES;
593 } 594 }
@@ -850,13 +851,13 @@ void core_connect_handler (void *cls,
850 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to peer %s\n"), 851 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Connected to peer %s\n"),
851 GNUNET_i2s (peer)); 852 GNUNET_i2s (peer));
852 853
853 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (nodes_requested, &peer->hashPubKey)) 854 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_requested, peer))
854 return; /* We already sent a request */ 855 return; /* We already sent a request */
855 856
856 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (nodes_active, &peer->hashPubKey)) 857 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_active, peer))
857 return; /* This peer is known as active */ 858 return; /* This peer is known as active */
858 859
859 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (nodes_inactive, &peer->hashPubKey)) 860 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (nodes_inactive, peer))
860 return; /* This peer is known as inactive */ 861 return; /* This peer is known as inactive */
861 862
862 send_experimentation_request (peer); 863 send_experimentation_request (peer);
@@ -879,14 +880,14 @@ void core_disconnect_handler (void *cls,
879 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Disconnected from peer %s\n"), 880 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Disconnected from peer %s\n"),
880 GNUNET_i2s (peer)); 881 GNUNET_i2s (peer));
881 882
882 if (NULL != (n = GNUNET_CONTAINER_multihashmap_get (nodes_requested, &peer->hashPubKey))) 883 if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_requested, peer)))
883 cleanup_node (nodes_requested, &peer->hashPubKey, n); 884 cleanup_node (nodes_requested, peer, n);
884 885
885 if (NULL != (n = GNUNET_CONTAINER_multihashmap_get (nodes_active, &peer->hashPubKey))) 886 if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_active, peer)))
886 cleanup_node (nodes_active, &peer->hashPubKey, n); 887 cleanup_node (nodes_active, peer, n);
887 888
888 if (NULL != (n = GNUNET_CONTAINER_multihashmap_get (nodes_inactive, &peer->hashPubKey))) 889 if (NULL != (n = GNUNET_CONTAINER_multipeermap_get (nodes_inactive, peer)))
889 cleanup_node (nodes_inactive, &peer->hashPubKey, n); 890 cleanup_node (nodes_inactive, peer, n);
890} 891}
891 892
892 893
@@ -1060,9 +1061,9 @@ GED_nodes_start ()
1060 return; 1061 return;
1061 } 1062 }
1062 1063
1063 nodes_requested = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); 1064 nodes_requested = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
1064 nodes_active = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); 1065 nodes_active = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
1065 nodes_inactive = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); 1066 nodes_inactive = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
1066} 1067}
1067 1068
1068 1069
@@ -1080,31 +1081,31 @@ GED_nodes_stop ()
1080 1081
1081 if (NULL != nodes_requested) 1082 if (NULL != nodes_requested)
1082 { 1083 {
1083 GNUNET_CONTAINER_multihashmap_iterate (nodes_requested, 1084 GNUNET_CONTAINER_multipeermap_iterate (nodes_requested,
1084 &cleanup_node, 1085 &cleanup_node,
1085 nodes_requested); 1086 nodes_requested);
1086 update_stats (nodes_requested); 1087 update_stats (nodes_requested);
1087 GNUNET_CONTAINER_multihashmap_destroy (nodes_requested); 1088 GNUNET_CONTAINER_multipeermap_destroy (nodes_requested);
1088 nodes_requested = NULL; 1089 nodes_requested = NULL;
1089 } 1090 }
1090 1091
1091 if (NULL != nodes_active) 1092 if (NULL != nodes_active)
1092 { 1093 {
1093 GNUNET_CONTAINER_multihashmap_iterate (nodes_active, 1094 GNUNET_CONTAINER_multipeermap_iterate (nodes_active,
1094 &cleanup_node, 1095 &cleanup_node,
1095 nodes_active); 1096 nodes_active);
1096 update_stats (nodes_active); 1097 update_stats (nodes_active);
1097 GNUNET_CONTAINER_multihashmap_destroy (nodes_active); 1098 GNUNET_CONTAINER_multipeermap_destroy (nodes_active);
1098 nodes_active = NULL; 1099 nodes_active = NULL;
1099 } 1100 }
1100 1101
1101 if (NULL != nodes_inactive) 1102 if (NULL != nodes_inactive)
1102 { 1103 {
1103 GNUNET_CONTAINER_multihashmap_iterate (nodes_inactive, 1104 GNUNET_CONTAINER_multipeermap_iterate (nodes_inactive,
1104 &cleanup_node, 1105 &cleanup_node,
1105 nodes_inactive); 1106 nodes_inactive);
1106 update_stats (nodes_inactive); 1107 update_stats (nodes_inactive);
1107 GNUNET_CONTAINER_multihashmap_destroy (nodes_inactive); 1108 GNUNET_CONTAINER_multipeermap_destroy (nodes_inactive);
1108 nodes_inactive = NULL; 1109 nodes_inactive = NULL;
1109 } 1110 }
1110} 1111}
diff --git a/src/experimentation/gnunet-daemon-experimentation_scheduler.c b/src/experimentation/gnunet-daemon-experimentation_scheduler.c
index aef97ee48..a203fe4a5 100644
--- a/src/experimentation/gnunet-daemon-experimentation_scheduler.c
+++ b/src/experimentation/gnunet-daemon-experimentation_scheduler.c
@@ -25,7 +25,6 @@
25 * @author Matthias Wachs 25 * @author Matthias Wachs
26 */ 26 */
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_getopt_lib.h"
29#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
30#include "gnunet_core_service.h" 29#include "gnunet_core_service.h"
31#include "gnunet_statistics_service.h" 30#include "gnunet_statistics_service.h"