-testbed host registration cancel
authorSree Harsha Totakura <totakura@in.tum.de>
Tue, 26 Jun 2012 22:27:48 +0000 (22:27 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Tue, 26 Jun 2012 22:27:48 +0000 (22:27 +0000)
src/testbed/testbed_api.c

index 4075e1b99a1095006f934a15cc921ff07fda6929..825cf28ba2a300f744609ae4b2e9d9ff723fed53 100644 (file)
@@ -204,6 +204,11 @@ struct GNUNET_TESTBED_HostRegistrationHandle
    */
   struct GNUNET_TESTBED_Host *host;
 
+  /**
+   * The controller at which this host is being registered
+   */
+  struct GNUNET_TESTBED_Controller *c;
+
   /**
    * The Registartion completion callback
    */
@@ -544,6 +549,7 @@ GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller,
   }  
   rh = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostRegistrationHandle));
   rh->host = host;
+  rh->c = controller;
   GNUNET_assert (NULL != cc);
   rh->cc = cc;
   rh->cc_cls = cc_cls;
@@ -584,7 +590,13 @@ void
 GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationHandle
                                     *handle)
 {
-  GNUNET_break (0);
+  if (handle != handle->c->rh)
+  {
+    GNUNET_break (0);
+    return;
+  }
+  handle->c->rh = NULL;
+  GNUNET_free (handle);  
 }