diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-29 13:09:48 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-29 13:09:48 +0100 |
commit | ae117b6b4a7d98948b9fabbe961abbc45f00f6bd (patch) | |
tree | afc184441ac0f8797963c278d7bf6217b39da983 /src/cadet | |
parent | f61c5da9a44126edcbdfd66712ae1879e39a623d (diff) | |
download | gnunet-ae117b6b4a7d98948b9fabbe961abbc45f00f6bd.tar.gz gnunet-ae117b6b4a7d98948b9fabbe961abbc45f00f6bd.zip |
provide stricter assurances about when we call ready_cb, avoiding supurious calls that merely reinforce what tunnel already knows about the connection state
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/gnunet-service-cadet-new_connection.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/cadet/gnunet-service-cadet-new_connection.c b/src/cadet/gnunet-service-cadet-new_connection.c index 11044d9e6..b894c26f2 100644 --- a/src/cadet/gnunet-service-cadet-new_connection.c +++ b/src/cadet/gnunet-service-cadet-new_connection.c | |||
@@ -345,6 +345,8 @@ GCC_handle_connection_create_ack (struct CadetConnection *cc) | |||
345 | GCC_2s (cc), | 345 | GCC_2s (cc), |
346 | cc->state, | 346 | cc->state, |
347 | (GNUNET_YES == cc->mqm_ready) ? "MQM ready" : "MQM busy"); | 347 | (GNUNET_YES == cc->mqm_ready) ? "MQM ready" : "MQM busy"); |
348 | if (CADET_CONNECTION_READY == cc->state) | ||
349 | return; /* Duplicate ACK, ignore */ | ||
348 | if (NULL != cc->task) | 350 | if (NULL != cc->task) |
349 | { | 351 | { |
350 | GNUNET_SCHEDULER_cancel (cc->task); | 352 | GNUNET_SCHEDULER_cancel (cc->task); |
@@ -522,8 +524,9 @@ GCC_handle_duplicate_create (struct CadetConnection *cc) | |||
522 | (GNUNET_YES == cc->mqm_ready) ? "MQM ready" : "MQM busy"); | 524 | (GNUNET_YES == cc->mqm_ready) ? "MQM ready" : "MQM busy"); |
523 | /* Tell tunnel that we are not ready for transmission anymore | 525 | /* Tell tunnel that we are not ready for transmission anymore |
524 | (until CREATE_ACK is done) */ | 526 | (until CREATE_ACK is done) */ |
525 | cc->ready_cb (cc->ready_cb_cls, | 527 | if (CADET_CONNECTION_READY == cc->state) |
526 | GNUNET_NO); | 528 | cc->ready_cb (cc->ready_cb_cls, |
529 | GNUNET_NO); | ||
527 | /* Revert back to the state of having only received the 'CREATE', | 530 | /* Revert back to the state of having only received the 'CREATE', |
528 | and immediately proceed to send the CREATE_ACK. */ | 531 | and immediately proceed to send the CREATE_ACK. */ |
529 | cc->state = CADET_CONNECTION_CREATE_RECEIVED; | 532 | cc->state = CADET_CONNECTION_CREATE_RECEIVED; |
@@ -566,7 +569,6 @@ manage_first_hop_mq (void *cls, | |||
566 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 569 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
567 | "Core MQ for %s went down\n", | 570 | "Core MQ for %s went down\n", |
568 | GCC_2s (cc)); | 571 | GCC_2s (cc)); |
569 | cc->mqm_ready = GNUNET_NO; | ||
570 | cc->state = CADET_CONNECTION_NEW; | 572 | cc->state = CADET_CONNECTION_NEW; |
571 | cc->retry_delay = GNUNET_TIME_UNIT_ZERO; | 573 | cc->retry_delay = GNUNET_TIME_UNIT_ZERO; |
572 | if (NULL != cc->task) | 574 | if (NULL != cc->task) |
@@ -574,8 +576,13 @@ manage_first_hop_mq (void *cls, | |||
574 | GNUNET_SCHEDULER_cancel (cc->task); | 576 | GNUNET_SCHEDULER_cancel (cc->task); |
575 | cc->task = NULL; | 577 | cc->task = NULL; |
576 | } | 578 | } |
577 | cc->ready_cb (cc->ready_cb_cls, | 579 | if (GNUNET_YES == cc->mqm_ready) |
578 | GNUNET_NO); | 580 | { |
581 | cc->mqm_ready = GNUNET_NO; | ||
582 | if (CADET_CONNECTION_READY == cc->state) | ||
583 | cc->ready_cb (cc->ready_cb_cls, | ||
584 | GNUNET_NO); | ||
585 | } | ||
579 | return; | 586 | return; |
580 | } | 587 | } |
581 | 588 | ||