gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37488 - in gnunet/src: include util


From: gnunet
Subject: [GNUnet-SVN] r37488 - in gnunet/src: include util
Date: Fri, 8 Jul 2016 18:32:50 +0200

Author: grothoff
Date: 2016-07-08 18:32:50 +0200 (Fri, 08 Jul 2016)
New Revision: 37488

Modified:
   gnunet/src/include/gnunet_mq_lib.h
   gnunet/src/util/mq.c
Log:
add GNUNET_MQ_set_handlers_closure API

Modified: gnunet/src/include/gnunet_mq_lib.h
===================================================================
--- gnunet/src/include/gnunet_mq_lib.h  2016-07-08 14:04:58 UTC (rev 37487)
+++ gnunet/src/include/gnunet_mq_lib.h  2016-07-08 16:32:50 UTC (rev 37488)
@@ -536,6 +536,18 @@
 
 
 /**
+ * Change the closure argument in all of the `handlers` of the
+ * @a mq.
+ *
+ * @param mq to modify
+ * @param handlers_cls new closure to use
+ */
+void
+GNUNET_MQ_set_handlers_closure (struct GNUNET_MQ_Handle *mq,
+                                void *handlers_cls);
+
+
+/**
  * Call a callback once the envelope has been sent, that is,
  * sending it can not be canceled anymore.
  * There can be only one notify sent callback per envelope.

Modified: gnunet/src/util/mq.c
===================================================================
--- gnunet/src/util/mq.c        2016-07-08 14:04:58 UTC (rev 37487)
+++ gnunet/src/util/mq.c        2016-07-08 16:32:50 UTC (rev 37488)
@@ -473,6 +473,26 @@
 
 
 /**
+ * Change the closure argument in all of the `handlers` of the
+ * @a mq.
+ *
+ * @param mq to modify
+ * @param handlers_cls new closure to use
+ */
+void
+GNUNET_MQ_set_handlers_closure (struct GNUNET_MQ_Handle *mq,
+                                void *handlers_cls)
+{
+  unsigned int i;
+
+  if (NULL == mq->handlers)
+    return;
+  for (i=0;NULL != mq->handlers[i].cb; i++)
+    mq->handlers[i].cls = handlers_cls;
+}
+
+
+/**
  * Get the message that should currently be sent.
  * Fails if there is no current message.
  * Only useful for implementing message queues,
@@ -662,8 +682,8 @@
   mq->impl_state = scss;
   scss->client = client;
   GNUNET_SERVER_client_keep (client);
-  mq->send_impl = server_client_send_impl;
-  mq->destroy_impl = server_client_destroy_impl;
+  mq->send_impl = &server_client_send_impl;
+  mq->destroy_impl = &server_client_destroy_impl;
   return mq;
 }
 




reply via email to

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