aboutsummaryrefslogtreecommitdiff
path: root/src/set
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-12-09 23:22:55 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-12-09 23:22:55 +0000
commit4c489827d1da9aea4ae763c4c16c79e02d7f37e8 (patch)
tree4463ca57fad5bf292625d6cd9cc1700ec51fad9e /src/set
parente4ec465b558b0c3a39d5868b0018218f7028030e (diff)
downloadgnunet-4c489827d1da9aea4ae763c4c16c79e02d7f37e8.tar.gz
gnunet-4c489827d1da9aea4ae763c4c16c79e02d7f37e8.zip
- fix #3185 and #3184 in set
Diffstat (limited to 'src/set')
-rw-r--r--src/set/gnunet-service-set.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index 428a9d002..6ea3712d2 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -201,7 +201,11 @@ get_incoming (uint32_t id)
201 201
202 for (op = incoming_head; NULL != op; op = op->next) 202 for (op = incoming_head; NULL != op; op = op->next)
203 if (op->state->suggest_id == id) 203 if (op->state->suggest_id == id)
204 {
205 // FIXME: remove this assertion once the corresponding bug is gone!
206 GNUNET_assert (GNUNET_YES == op->is_incoming);
204 return op; 207 return op;
208 }
205 return NULL; 209 return NULL;
206} 210}
207 211
@@ -441,13 +445,16 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
441static void 445static void
442incoming_destroy (struct Operation *incoming) 446incoming_destroy (struct Operation *incoming)
443{ 447{
448 GNUNET_assert (GNUNET_YES == incoming->is_incoming);
444 GNUNET_CONTAINER_DLL_remove (incoming_head, incoming_tail, incoming); 449 GNUNET_CONTAINER_DLL_remove (incoming_head, incoming_tail, incoming);
445 if (GNUNET_SCHEDULER_NO_TASK != incoming->state->timeout_task) 450 if (GNUNET_SCHEDULER_NO_TASK != incoming->state->timeout_task)
446 { 451 {
447 GNUNET_SCHEDULER_cancel (incoming->state->timeout_task); 452 GNUNET_SCHEDULER_cancel (incoming->state->timeout_task);
448 incoming->state->timeout_task = GNUNET_SCHEDULER_NO_TASK; 453 incoming->state->timeout_task = GNUNET_SCHEDULER_NO_TASK;
449 } 454 }
455 GNUNET_assert (NULL != incoming->state);
450 GNUNET_free (incoming->state); 456 GNUNET_free (incoming->state);
457 incoming->state = NULL;
451} 458}
452 459
453 460
@@ -459,7 +466,9 @@ incoming_destroy (struct Operation *incoming)
459static void 466static void
460incoming_retire (struct Operation *incoming) 467incoming_retire (struct Operation *incoming)
461{ 468{
469 GNUNET_assert (GNUNET_YES == incoming->is_incoming);
462 incoming->is_incoming = GNUNET_NO; 470 incoming->is_incoming = GNUNET_NO;
471 GNUNET_assert (NULL != incoming->state);
463 GNUNET_free (incoming->state); 472 GNUNET_free (incoming->state);
464 incoming->state = NULL; 473 incoming->state = NULL;
465 GNUNET_CONTAINER_DLL_remove (incoming_head, incoming_tail, incoming); 474 GNUNET_CONTAINER_DLL_remove (incoming_head, incoming_tail, incoming);
@@ -505,7 +514,9 @@ incoming_suggest (struct Operation *incoming, struct Listener *listener)
505{ 514{
506 struct GNUNET_MQ_Envelope *mqm; 515 struct GNUNET_MQ_Envelope *mqm;
507 struct GNUNET_SET_RequestMessage *cmsg; 516 struct GNUNET_SET_RequestMessage *cmsg;
508 517
518 GNUNET_assert (GNUNET_YES == incoming->is_incoming);
519 GNUNET_assert (NULL != incoming->state);
509 GNUNET_assert (NULL != incoming->spec); 520 GNUNET_assert (NULL != incoming->spec);
510 GNUNET_assert (0 == incoming->state->suggest_id); 521 GNUNET_assert (0 == incoming->state->suggest_id);
511 incoming->state->suggest_id = suggest_id++; 522 incoming->state->suggest_id = suggest_id++;
@@ -546,6 +557,8 @@ handle_incoming_msg (struct Operation *op,
546 struct Listener *listener; 557 struct Listener *listener;
547 struct OperationSpecification *spec; 558 struct OperationSpecification *spec;
548 559
560 GNUNET_assert (GNUNET_YES == op->is_incoming);
561
549 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got op request\n"); 562 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got op request\n");
550 563
551 if (GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST != ntohs (mh->type)) 564 if (GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST != ntohs (mh->type))
@@ -1180,9 +1193,8 @@ static void
1180handle_incoming_disconnect (struct Operation *op) 1193handle_incoming_disconnect (struct Operation *op)
1181{ 1194{
1182 GNUNET_assert (GNUNET_YES == op->is_incoming); 1195 GNUNET_assert (GNUNET_YES == op->is_incoming);
1183 if (NULL == op->channel)
1184 return;
1185 incoming_destroy (op); 1196 incoming_destroy (op);
1197 op->vt = NULL;
1186} 1198}
1187 1199
1188 1200
@@ -1287,8 +1299,8 @@ channel_end_cb (void *cls,
1287 1299
1288 1300
1289/** 1301/**
1290 * Functions with this signature are called whenever any message is 1302 * Functions with this signature are called whenever a message is
1291 * received via the mesh channel. 1303 * received via a mesh channel.
1292 * 1304 *
1293 * The msg_handler is a virtual table set in initially either when a peer 1305 * The msg_handler is a virtual table set in initially either when a peer
1294 * creates a new channel with us (channel_new_cb), or once we create a new channel 1306 * creates a new channel with us (channel_new_cb), or once we create a new channel