From c5576791b6963e7375b25574e2fdcd2c216bc04d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 20 Jun 2012 14:18:02 +0000 Subject: [PATCH] -ideas for stuff --- src/lockmanager/lockmanager_api.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/lockmanager/lockmanager_api.c b/src/lockmanager/lockmanager_api.c index 2d2c75d50..bfdb2c182 100644 --- a/src/lockmanager/lockmanager_api.c +++ b/src/lockmanager/lockmanager_api.c @@ -68,6 +68,12 @@ struct MessageQueue * The LOCKMANAGER Message */ struct GNUNET_LOCKMANAGER_Message *msg; + + /** + * If this is a AQUIRE_LOCK message, this is the + * affiliated locking request. + */ + struct GNUNET_LOCKMANAGER_LockingRequest *lr; }; @@ -123,6 +129,12 @@ struct GNUNET_LOCKMANAGER_LockingRequest */ GNUNET_LOCKMANAGER_StatusCallback status_cb; + /** + * Entry in the request message queue for aquiring this + * lock; NULL after request has been sent. + */ + struct MessageQueue *mqe; + /** * Closure for the status callback */ @@ -678,16 +690,16 @@ GNUNET_LOCKMANAGER_acquire_lock (struct GNUNET_LOCKMANAGER_Handle *handle, LOG (GNUNET_ERROR_TYPE_DEBUG, "Queueing ACQUIRE message\n"); queue_message (handle, msg); get_key (r->domain, r->lock, &hash); - GNUNET_CONTAINER_multihashmap_put (r->handle->hashmap, - &hash, - r, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); + GNUNET_assert (GNUNET_OK == + GNUNET_CONTAINER_multihashmap_put (r->handle->hashmap, + &hash, + r, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); LOG (GNUNET_ERROR_TYPE_DEBUG, "%s() END\n", __func__); return r; } - /** * Function to cancel the locking request generated by * GNUNET_LOCKMANAGER_acquire_lock. If the lock is acquired by us then the lock -- 2.25.1