From: Bart Polot Date: Tue, 20 Oct 2015 03:07:18 +0000 (+0000) Subject: - add some assertions to make sure the poll mechanism is sane X-Git-Tag: initial-import-from-subversion-38251~1220 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cd98f1800a0c44620deb120d30c6828354738753;p=oweals%2Fgnunet.git - add some assertions to make sure the poll mechanism is sane --- 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, /** * Callback called when a queued POLL message is sent. * - * @param cls Closure (FC). + * @param cls Closure (flow control context). * @param c Connection this message was on. * @param q Queue handler this call invalidates. * @param type Type of message sent. @@ -1405,6 +1405,8 @@ poll_sent (void *cls, { struct CadetFlowControl *fc = cls; + GNUNET_assert (fc->poll_msg == q); + fc->poll_msg = NULL; if (2 == c->destroy) { LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL canceled on shutdown\n"); @@ -1412,7 +1414,7 @@ poll_sent (void *cls, } LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL sent for %s, scheduling new one!\n", GCC_2s (c)); - fc->poll_msg = NULL; + GNUNET_assert (NULL == fc->poll_task); fc->poll_time = GNUNET_TIME_STD_BACKOFF (fc->poll_time); fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time, &connection_poll, @@ -3729,7 +3731,7 @@ GCC_start_poll (struct CadetConnection *c, int fwd) GC_f2s (fwd)); if (NULL != fc->poll_task || NULL != fc->poll_msg) { - LOG (GNUNET_ERROR_TYPE_DEBUG, " POLL not needed (%p, %p)\n", + LOG (GNUNET_ERROR_TYPE_DEBUG, " POLL already in progress (t: %p, m: %p)\n", fc->poll_task, fc->poll_msg); return; }