aboutsummaryrefslogtreecommitdiff
path: root/src/experimentation
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-25 21:42:11 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-25 21:42:11 +0000
commit78ad97319349e9881653684f276dd620a0a423e9 (patch)
treecded8f0063f6848429706a36bd51174e62417b7e /src/experimentation
parentb968c5926b205c3cdd467474753746ef21522b32 (diff)
downloadgnunet-78ad97319349e9881653684f276dd620a0a423e9.tar.gz
gnunet-78ad97319349e9881653684f276dd620a0a423e9.zip
-misc fixes based on cppcheck
Diffstat (limited to 'src/experimentation')
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_nodes.c24
-rw-r--r--src/experimentation/gnunet-daemon-experimentation_scheduler.c25
2 files changed, 25 insertions, 24 deletions
diff --git a/src/experimentation/gnunet-daemon-experimentation_nodes.c b/src/experimentation/gnunet-daemon-experimentation_nodes.c
index a4da92d50..37b0eba45 100644
--- a/src/experimentation/gnunet-daemon-experimentation_nodes.c
+++ b/src/experimentation/gnunet-daemon-experimentation_nodes.c
@@ -260,17 +260,17 @@ remove_request (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
260 * @param buf the buffer to copy to 260 * @param buf the buffer to copy to
261 * @return bytes passed 261 * @return bytes passed
262 */ 262 */
263size_t send_experimentation_request_cb (void *cls, size_t bufsize, void *buf) 263static size_t
264send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
264{ 265{
265 struct Node *n = cls; 266 struct Node *n = cls;
266 struct Experimentation_Request msg; 267 struct Experimentation_Request msg;
267 size_t msg_size = sizeof (msg); 268 size_t msg_size = sizeof (msg);
268 size_t ri_size = sizeof (struct Experimentation_Issuer) * GSE_my_issuer_count; 269 size_t ri_size = sizeof (struct Experimentation_Issuer) * GSE_my_issuer_count;
269 size_t total_size = msg_size + ri_size; 270 size_t total_size = msg_size + ri_size;
270 271
271 memset (buf, '\0', bufsize); 272 n->cth = NULL;
272 n->cth = NULL; 273 if (NULL == buf)
273 if (buf == NULL)
274 { 274 {
275 /* client disconnected */ 275 /* client disconnected */
276 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client disconnected\n"); 276 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client disconnected\n");
@@ -279,6 +279,7 @@ size_t send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
279 GNUNET_SCHEDULER_add_now (&remove_request, n); 279 GNUNET_SCHEDULER_add_now (&remove_request, n);
280 return 0; 280 return 0;
281 } 281 }
282 memset (buf, '\0', bufsize);
282 GNUNET_assert (bufsize >= total_size); 283 GNUNET_assert (bufsize >= total_size);
283 284
284 msg.msg.size = htons (total_size); 285 msg.msg.size = htons (total_size);
@@ -299,7 +300,8 @@ size_t send_experimentation_request_cb (void *cls, size_t bufsize, void *buf)
299 * 300 *
300 * @param peer the peer to send to 301 * @param peer the peer to send to
301 */ 302 */
302static void send_experimentation_request (const struct GNUNET_PeerIdentity *peer) 303static void
304send_experimentation_request (const struct GNUNET_PeerIdentity *peer)
303{ 305{
304 struct Node *n; 306 struct Node *n;
305 struct NodeComCtx *e_ctx; 307 struct NodeComCtx *e_ctx;
diff --git a/src/experimentation/gnunet-daemon-experimentation_scheduler.c b/src/experimentation/gnunet-daemon-experimentation_scheduler.c
index 34142fabb..aef97ee48 100644
--- a/src/experimentation/gnunet-daemon-experimentation_scheduler.c
+++ b/src/experimentation/gnunet-daemon-experimentation_scheduler.c
@@ -227,21 +227,20 @@ static void run_experiment_outbound (void *cls,const struct GNUNET_SCHEDULER_Tas
227void 227void
228GED_scheduler_handle_start (struct Node *n, struct Experiment *e) 228GED_scheduler_handle_start (struct Node *n, struct Experiment *e)
229{ 229{
230 struct ScheduledExperiment *se; 230 if ((NULL != find_experiment (waiting_in_head, waiting_in_tail, n, e, GNUNET_NO)) ||
231 231 (NULL != find_experiment (running_in_head, running_in_tail, n, e, GNUNET_NO)))
232 if ((NULL != (se = find_experiment (waiting_in_head, waiting_in_tail, n, e, GNUNET_NO))) || 232 {
233 (NULL != (se = find_experiment (running_in_head, running_in_tail, n, e, GNUNET_NO)))) 233 GNUNET_break_op (0);
234 { 234 return;
235 GNUNET_break_op (0); 235 }
236 return; 236
237 } 237 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
238 238 "Received %s message from peer %s for experiment `%s'\n",
239 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %s message from peer %s for experiment `%s'\n", 239 "START", GNUNET_i2s (&n->id), e->name);
240 "START", GNUNET_i2s (&n->id), e->name); 240 GED_scheduler_add (n, e, GNUNET_NO);
241
242 GED_scheduler_add (n, e, GNUNET_NO);
243} 241}
244 242
243
245/** 244/**
246 * Handle a START_ACK message from a remote node 245 * Handle a START_ACK message from a remote node
247 * 246 *