gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23201 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r23201 - gnunet/src/testbed
Date: Sat, 11 Aug 2012 15:04:52 +0200

Author: harsha
Date: 2012-08-11 15:04:52 +0200 (Sat, 11 Aug 2012)
New Revision: 23201

Modified:
   gnunet/src/testbed/testbed_api.c
   gnunet/src/testbed/testbed_api.h
Log:
forward operation msg cancel


Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c    2012-08-11 12:46:05 UTC (rev 23200)
+++ gnunet/src/testbed/testbed_api.c    2012-08-11 13:04:52 UTC (rev 23201)
@@ -751,7 +751,9 @@
 
 /**
  * Sends the given message as an operation. The given callback is called when a
- * reply for the operation is available
+ * reply for the operation is available.  Call
+ * GNUNET_TESTBED_forward_operation_msg_cancel_() to cleanup the returned
+ * operation context if the cc hasn't been called
  *
  * @param controller the controller to which the message has to be sent
  * @param operation_id the operation id of the message
@@ -778,6 +780,7 @@
   data->cc = cc;
   data->cc_cls = cc_cls;  
   opc = GNUNET_malloc (sizeof (struct OperationContext));
+  opc->c = controller;  
   opc->type = OP_FORWARDED;
   opc->data = data;
   opc->id = operation_id;
@@ -792,6 +795,21 @@
 
 
 /**
+ * Function to cancel an operation created by simply forwarding an operation
+ * message.
+ *
+ * @param opc the operation context from 
GNUNET_TESTBED_forward_operation_msg_()
+ */
+void
+GNUNET_TESTBED_forward_operation_msg_cancel_ (struct OperationContext *opc)
+{
+  GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
+  GNUNET_free (opc->data);
+  GNUNET_free (opc);  
+}
+
+
+/**
  * Handle for controller process
  */
 struct GNUNET_TESTBED_ControllerProc

Modified: gnunet/src/testbed/testbed_api.h
===================================================================
--- gnunet/src/testbed/testbed_api.h    2012-08-11 12:46:05 UTC (rev 23200)
+++ gnunet/src/testbed/testbed_api.h    2012-08-11 13:04:52 UTC (rev 23201)
@@ -356,7 +356,9 @@
 
 /**
  * Sends the given message as an operation. The given callback is called when a
- * reply for the operation is available
+ * reply for the operation is available.  Call
+ * GNUNET_TESTBED_forward_operation_msg_cancel_() to cleanup the returned
+ * operation context if the cc hasn't been called
  *
  * @param controller the controller to which the message has to be sent
  * @param operation_id the operation id of the message
@@ -374,5 +376,15 @@
                                        GNUNET_CLIENT_MessageHandler cc,
                                        void *cc_cls);
 
+/**
+ * Function to cancel an operation created by simply forwarding an operation
+ * message.
+ *
+ * @param opc the operation context from 
GNUNET_TESTBED_forward_operation_msg_()
+ */
+void
+GNUNET_TESTBED_forward_operation_msg_cancel_ (struct OperationContext *opc);
+
+
 #endif
 /* end of testbed_api.h */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]