From: Matthias Wachs Date: Thu, 23 Dec 2010 13:03:34 +0000 (+0000) Subject: changed reliability to cancel notify_transmit_ready X-Git-Tag: initial-import-from-subversion-38251~19415 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=417167b77f6f6a904892e628824b26660ea809c7;p=oweals%2Fgnunet.git changed reliability to cancel notify_transmit_ready --- diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 4da5ab48d..767ada25e 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c @@ -148,7 +148,7 @@ static GNUNET_SCHEDULER_TaskIdentifier die_task; static GNUNET_SCHEDULER_TaskIdentifier measurement_task; static GNUNET_SCHEDULER_TaskIdentifier measurement_counter_task; -struct GNUNET_TRANSPORT_TransmitHandle * transmit_handle; +static struct GNUNET_TRANSPORT_TransmitHandle * transmit_handle; #define OKPP do { ok++; } while (0) diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 96e0d988d..cabc9f6e4 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c @@ -100,7 +100,7 @@ static int msg_scheduled; static int msg_sent; static int msg_recv_expected; static int msg_recv; - +static struct GNUNET_TRANSPORT_TransmitHandle * transmit_handle; #if VERBOSE #define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) @@ -351,6 +351,11 @@ notify_connect (void *cls, if (connected == 2) { + + if ((transmit_handle!=NULL) && (cls == NULL)) + GNUNET_TRANSPORT_notify_transmit_ready_cancel(transmit_handle); + if ((transmit_handle!=NULL) && (cls == &transmit_handle)) + transmit_handle==NULL; GNUNET_TRANSPORT_notify_transmit_ready (p2.th, &p1.id, get_size (0), 0, TIMEOUT, @@ -466,7 +471,7 @@ exchange_hello_last (void *cls, const struct GNUNET_MessageHeader *message) { struct PeerContext *me = cls; - + transmit_handle = NULL; GNUNET_TRANSPORT_get_hello_cancel (p2.th, &exchange_hello_last, me); #if VERBOSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -479,12 +484,12 @@ exchange_hello_last (void *cls, GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) message, &me->id)); - GNUNET_assert(NULL != GNUNET_TRANSPORT_notify_transmit_ready (p2.th, + GNUNET_assert(NULL != (transmit_handle = GNUNET_TRANSPORT_notify_transmit_ready (p2.th, &p1.id, sizeof (struct GNUNET_MessageHeader), 0, TIMEOUT, ¬ify_ready_connect, - NULL)); + &transmit_handle))); /* both HELLOs exchanged, get ready to test transmission! */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,