diff options
Diffstat (limited to 'src/cadet/gnunet-service-cadet_peer.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index c46e968dc..5c810e926 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -491,15 +491,13 @@ consider_peer_destroy (struct CadetPeer *cp) | |||
491 | return; /* still relevant! */ | 491 | return; /* still relevant! */ |
492 | if (NULL != cp->hello) | 492 | if (NULL != cp->hello) |
493 | { | 493 | { |
494 | struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (cp->hello); | ||
495 | |||
496 | /* relevant only until HELLO expires */ | 494 | /* relevant only until HELLO expires */ |
497 | exp = GNUNET_TIME_absolute_get_remaining (GNUNET_HELLO_builder_get_expiration_time (builder, | 495 | exp = GNUNET_TIME_absolute_get_remaining ( |
498 | cp->hello)); | 496 | GNUNET_HELLO_builder_get_expiration_time (cp |
497 | ->hello)); | ||
499 | cp->destroy_task = GNUNET_SCHEDULER_add_delayed (exp, | 498 | cp->destroy_task = GNUNET_SCHEDULER_add_delayed (exp, |
500 | &destroy_peer, | 499 | &destroy_peer, |
501 | cp); | 500 | cp); |
502 | GNUNET_HELLO_builder_free (builder); | ||
503 | return; | 501 | return; |
504 | } | 502 | } |
505 | cp->destroy_task = GNUNET_SCHEDULER_add_delayed (IDLE_PEER_TIMEOUT, | 503 | cp->destroy_task = GNUNET_SCHEDULER_add_delayed (IDLE_PEER_TIMEOUT, |
@@ -1323,14 +1321,15 @@ GCP_set_hello (struct CadetPeer *cp, | |||
1323 | if (NULL != cp->hello) | 1321 | if (NULL != cp->hello) |
1324 | { | 1322 | { |
1325 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | 1323 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
1326 | struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (hello); | 1324 | |
1327 | struct GNUNET_HELLO_Builder *cp_builder = GNUNET_HELLO_builder_from_msg (cp->hello); | 1325 | struct GNUNET_TIME_Absolute new_hello_exp = |
1328 | struct GNUNET_TIME_Absolute new_hello_exp = GNUNET_HELLO_builder_get_expiration_time (builder, | 1326 | GNUNET_HELLO_builder_get_expiration_time (hello); |
1329 | hello); | 1327 | struct GNUNET_TIME_Absolute old_hello_exp = |
1330 | struct GNUNET_TIME_Absolute old_hello_exp = GNUNET_HELLO_builder_get_expiration_time (cp_builder, | 1328 | GNUNET_HELLO_builder_get_expiration_time (cp |
1331 | cp->hello); | 1329 | ->hello); |
1332 | 1330 | ||
1333 | if (GNUNET_TIME_absolute_cmp (new_hello_exp, > , now) && GNUNET_TIME_absolute_cmp (new_hello_exp, > , old_hello_exp)) | 1331 | if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) && |
1332 | GNUNET_TIME_absolute_cmp (new_hello_exp, >, old_hello_exp)) | ||
1334 | { | 1333 | { |
1335 | GNUNET_free (cp->hello); | 1334 | GNUNET_free (cp->hello); |
1336 | cp->hello = GNUNET_malloc (size); | 1335 | cp->hello = GNUNET_malloc (size); |
@@ -1340,8 +1339,6 @@ GCP_set_hello (struct CadetPeer *cp, | |||
1340 | { | 1339 | { |
1341 | return; | 1340 | return; |
1342 | } | 1341 | } |
1343 | GNUNET_HELLO_builder_free (builder); | ||
1344 | GNUNET_HELLO_builder_free (cp_builder); | ||
1345 | } | 1342 | } |
1346 | else | 1343 | else |
1347 | { | 1344 | { |