aboutsummaryrefslogtreecommitdiff
path: root/src/core/test_core_quota_compliance.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-08 18:10:04 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-08 18:10:04 +0000
commitc32824526668948c5555f95ef545733004cc5e4a (patch)
tree61163ea8a77efae23d875c2610467373dc3c369f /src/core/test_core_quota_compliance.c
parent5c7d441a8d85fcfd5eef2cf411898d63af52e5d6 (diff)
downloadgnunet-c32824526668948c5555f95ef545733004cc5e4a.tar.gz
gnunet-c32824526668948c5555f95ef545733004cc5e4a.zip
-properly cancel offer_hello handlers
Diffstat (limited to 'src/core/test_core_quota_compliance.c')
-rw-r--r--src/core/test_core_quota_compliance.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index 5e2db6fcb..c30a4fec8 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -70,8 +70,8 @@ struct PeerContext
70 struct GNUNET_CONFIGURATION_Handle *cfg; 70 struct GNUNET_CONFIGURATION_Handle *cfg;
71 struct GNUNET_CORE_Handle *ch; 71 struct GNUNET_CORE_Handle *ch;
72 struct GNUNET_CORE_TransmitHandle *nth; 72 struct GNUNET_CORE_TransmitHandle *nth;
73 struct GNUNET_TRANSPORT_OfferHelloHandle *oh;
73 struct GNUNET_PeerIdentity id; 74 struct GNUNET_PeerIdentity id;
74 struct GNUNET_TRANSPORT_Handle *th;
75 struct GNUNET_MessageHeader *hello; 75 struct GNUNET_MessageHeader *hello;
76 struct GNUNET_STATISTICS_Handle *stats; 76 struct GNUNET_STATISTICS_Handle *stats;
77 struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 77 struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
@@ -122,11 +122,15 @@ terminate_peer (struct PeerContext *p)
122 GNUNET_CORE_disconnect (p->ch); 122 GNUNET_CORE_disconnect (p->ch);
123 p->ch = NULL; 123 p->ch = NULL;
124 } 124 }
125 if (NULL != p->th) 125 if (NULL != p->ghh)
126 { 126 {
127 GNUNET_TRANSPORT_get_hello_cancel (p->ghh); 127 GNUNET_TRANSPORT_get_hello_cancel (p->ghh);
128 GNUNET_TRANSPORT_disconnect (p->th); 128 p->ghh = NULL;
129 p->th = NULL; 129 }
130 if (NULL != p->oh)
131 {
132 GNUNET_TRANSPORT_offer_hello_cancel (p->oh);
133 p->oh = NULL;
130 } 134 }
131 if (NULL != p->ats_sh) 135 if (NULL != p->ats_sh)
132 { 136 {
@@ -546,15 +550,15 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
546 GNUNET_assert (message != NULL); 550 GNUNET_assert (message != NULL);
547 p->hello = GNUNET_malloc (ntohs (message->size)); 551 p->hello = GNUNET_malloc (ntohs (message->size));
548 GNUNET_memcpy (p->hello, message, ntohs (message->size)); 552 GNUNET_memcpy (p->hello, message, ntohs (message->size));
549 if ((p == &p1) && (p2.th != NULL)) 553 if ((p == &p1) && (NULL == p2.oh))
550 GNUNET_TRANSPORT_offer_hello (p2.cfg, message, NULL, NULL); 554 p2.oh = GNUNET_TRANSPORT_offer_hello (p2.cfg, message, NULL, NULL);
551 if ((p == &p2) && (p1.th != NULL)) 555 if ((p == &p2) && (NULL == p1.oh))
552 GNUNET_TRANSPORT_offer_hello (p1.cfg, message, NULL, NULL); 556 p1.oh = GNUNET_TRANSPORT_offer_hello (p1.cfg, message, NULL, NULL);
553 557
554 if ((p == &p1) && (p2.hello != NULL)) 558 if ((p == &p1) && (p2.hello != NULL) && (NULL == p1.oh))
555 GNUNET_TRANSPORT_offer_hello (p1.cfg, p2.hello, NULL, NULL); 559 p1.oh = GNUNET_TRANSPORT_offer_hello (p1.cfg, p2.hello, NULL, NULL);
556 if ((p == &p2) && (p1.hello != NULL)) 560 if ((p == &p2) && (p1.hello != NULL) && (NULL == p2.oh) )
557 GNUNET_TRANSPORT_offer_hello (p2.cfg, p1.hello, NULL, NULL); 561 p2.oh = GNUNET_TRANSPORT_offer_hello (p2.cfg, p1.hello, NULL, NULL);
558} 562}
559 563
560 564
@@ -575,8 +579,6 @@ setup_peer (struct PeerContext *p, const char *cfgname)
575 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 579 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
576 p->stats = GNUNET_STATISTICS_create ("core", p->cfg); 580 p->stats = GNUNET_STATISTICS_create ("core", p->cfg);
577 GNUNET_assert (p->stats != NULL); 581 GNUNET_assert (p->stats != NULL);
578 p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL);
579 GNUNET_assert (p->th != NULL);
580 p->ats = GNUNET_ATS_connectivity_init (p->cfg); 582 p->ats = GNUNET_ATS_connectivity_init (p->cfg);
581 GNUNET_assert (NULL != p->ats); 583 GNUNET_assert (NULL != p->ats);
582 p->ghh = GNUNET_TRANSPORT_get_hello (p->cfg, &process_hello, p); 584 p->ghh = GNUNET_TRANSPORT_get_hello (p->cfg, &process_hello, p);