diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-10-20 03:07:18 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-10-20 03:07:18 +0000 |
commit | cd98f1800a0c44620deb120d30c6828354738753 (patch) | |
tree | b2933f1b293550eb0551a0a937f739ccae806b65 | |
parent | a5966c5d23874555161408f0eaf40922fe3ca7d1 (diff) | |
download | gnunet-cd98f1800a0c44620deb120d30c6828354738753.tar.gz gnunet-cd98f1800a0c44620deb120d30c6828354738753.zip |
- add some assertions to make sure the poll mechanism is sane
-rw-r--r-- | src/cadet/gnunet-service-cadet_connection.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 2d030f8af..fdc0ec0fe 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c | |||
@@ -1390,7 +1390,7 @@ connection_poll (void *cls, | |||
1390 | /** | 1390 | /** |
1391 | * Callback called when a queued POLL message is sent. | 1391 | * Callback called when a queued POLL message is sent. |
1392 | * | 1392 | * |
1393 | * @param cls Closure (FC). | 1393 | * @param cls Closure (flow control context). |
1394 | * @param c Connection this message was on. | 1394 | * @param c Connection this message was on. |
1395 | * @param q Queue handler this call invalidates. | 1395 | * @param q Queue handler this call invalidates. |
1396 | * @param type Type of message sent. | 1396 | * @param type Type of message sent. |
@@ -1405,6 +1405,8 @@ poll_sent (void *cls, | |||
1405 | { | 1405 | { |
1406 | struct CadetFlowControl *fc = cls; | 1406 | struct CadetFlowControl *fc = cls; |
1407 | 1407 | ||
1408 | GNUNET_assert (fc->poll_msg == q); | ||
1409 | fc->poll_msg = NULL; | ||
1408 | if (2 == c->destroy) | 1410 | if (2 == c->destroy) |
1409 | { | 1411 | { |
1410 | LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL canceled on shutdown\n"); | 1412 | LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL canceled on shutdown\n"); |
@@ -1412,7 +1414,7 @@ poll_sent (void *cls, | |||
1412 | } | 1414 | } |
1413 | LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL sent for %s, scheduling new one!\n", | 1415 | LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL sent for %s, scheduling new one!\n", |
1414 | GCC_2s (c)); | 1416 | GCC_2s (c)); |
1415 | fc->poll_msg = NULL; | 1417 | GNUNET_assert (NULL == fc->poll_task); |
1416 | fc->poll_time = GNUNET_TIME_STD_BACKOFF (fc->poll_time); | 1418 | fc->poll_time = GNUNET_TIME_STD_BACKOFF (fc->poll_time); |
1417 | fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time, | 1419 | fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time, |
1418 | &connection_poll, | 1420 | &connection_poll, |
@@ -3729,7 +3731,7 @@ GCC_start_poll (struct CadetConnection *c, int fwd) | |||
3729 | GC_f2s (fwd)); | 3731 | GC_f2s (fwd)); |
3730 | if (NULL != fc->poll_task || NULL != fc->poll_msg) | 3732 | if (NULL != fc->poll_task || NULL != fc->poll_msg) |
3731 | { | 3733 | { |
3732 | LOG (GNUNET_ERROR_TYPE_DEBUG, " POLL not needed (%p, %p)\n", | 3734 | LOG (GNUNET_ERROR_TYPE_DEBUG, " POLL already in progress (t: %p, m: %p)\n", |
3733 | fc->poll_task, fc->poll_msg); | 3735 | fc->poll_task, fc->poll_msg); |
3734 | return; | 3736 | return; |
3735 | } | 3737 | } |