-ideas for stuff
authorChristian Grothoff <christian@grothoff.org>
Wed, 20 Jun 2012 14:18:02 +0000 (14:18 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 20 Jun 2012 14:18:02 +0000 (14:18 +0000)
src/lockmanager/lockmanager_api.c

index 2d2c75d509e02832e11b04870120487f70f3b643..bfdb2c182418f7fcea0b5feab9e462571edea98b 100644 (file)
@@ -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