GNUNET_CONTAINER_multihashmap32_remove (map,
entry->index,
entry));
+ if (GNUNET_SCHEDULER_NO_TASK != entry->notify_task)
+ {
+ GNUNET_SCHEDULER_cancel (entry->notify_task);
+ entry->notify_task = GNUNET_SCHEDULER_NO_TASK;
+ }
LOG_DEBUG ("Cleaning up handles of a pooled connection\n");
if (NULL != entry->handle_transport)
GNUNET_assert (NULL != entry->op_transport);
/**
* Function called from peer connect notify callbacks from CORE and TRANSPORT
- * connections. This function calls the pendning peer connect notify callbacks
+ * connections. This function calls the pending peer connect notify callbacks
* which are queued in an entry.
*
* @param cls the #PooledConnection object
*
* @note @a connect_notify_cb will not be called if @a target is
* already connected @a service level. Use
- * GNUNET_TRANSPORT_check_neighbour_connected() or a similar function from the
+ * GNUNET_TRANSPORT_check_peer_connected() or a similar function from the
* respective @a service's API to check if the target peer is already connected or
* not. @a connect_notify_cb will be called only once or never (in case @a target
* cannot be connected or is already connected).
gh,
gh->service, entry->index);
if (!gh->connection_ready_called)
+ {
GNUNET_CONTAINER_DLL_remove (entry->head_waiting, entry->tail_waiting, gh);
+ if ( (NULL == search_waiting (entry, entry->head_waiting))
+ && (GNUNET_SCHEDULER_NO_TASK != entry->notify_task) )
+ {
+ GNUNET_SCHEDULER_cancel (entry->notify_task);
+ entry->notify_task = GNUNET_SCHEDULER_NO_TASK;
+ }
+ }
if (gh->notify_waiting)
- {
+ {
GNUNET_CONTAINER_DLL_remove (entry->head_notify, entry->tail_notify, gh);
gh->notify_waiting = 0;
}
GNUNET_free (gh);
gh = NULL;
GNUNET_assert (!entry->in_lru);
- if ( (!entry->in_pool) && (NULL != map) )
+ if (!entry->in_pool)
+ GNUNET_CONTAINER_DLL_remove (head_not_pooled, tail_not_pooled, entry);
+ if (NULL != map)
{
if (GNUNET_YES == GNUNET_CONTAINER_multihashmap32_contains (map,
entry->index))
goto unallocate;
destroy_pooled_connection (head_lru);
}
- GNUNET_CONTAINER_DLL_remove (head_not_pooled, tail_not_pooled, entry);
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap32_put (map,
entry->index,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
entry->in_pool = GNUNET_YES;
}
+
unallocate:
GNUNET_assert (0 < entry->demand);
entry->demand--;