[PATCH 1.1] transport.c: Add mamaTransport_disableRefresh() Method


John Gray <jgray@...>
 

Add mamaTransport_disableRefresh() Method

 

Added method to disable refreshes for a transport. This method must be called

after mamaTransport_allocate() but before mamaTransport_create(). If invoked

with a non-zero argument the transport will not send refresh messages.

 

Index: c_cpp/src/c/transport.c

===================================================================

RCS file: /cvsroot/products/mama/c_cpp/src/c/transport.c,v

retrieving revision 1.79.4.6.2.2.2.8

diff -u -r1.79.4.6.2.2.2.8 transport.c

--- c_cpp/src/c/transport.c          2 Oct 2011 19:02:17 -0000              1.79.4.6.2.2.2.8

+++ c_cpp/src/c/transport.c       27 Dec 2011 20:44:15 -0000

@@ -161,6 +161,7 @@

     int                     mGroupSizeHint;

     uint8_t                 mDisableDisconnectCb;

+    uint8_t                                                                           mDisableRefresh;

     preInitialScheme         mPreInitialScheme;

} transportImpl;

@@ -369,14 +370,18 @@

  *

  * Return non-zero to disable refresh messages.

  */

-static int mamaTransportInternal_disableRefreshes (const char* transportName)

+void mamaTransport_disableRefresh(mamaTransport transport, uint8_t disable)

+{

+    self->mDisableRefresh=disable;

+}

+

+static int mamaTransportInternal_disableRefreshes(const char* transportName)

{

   const char* propValue;

   char propString[MAX_PROP_STRING];

   int retVal;

-  retVal=snprintf (propString, MAX_PROP_STRING,

-    "mama.transport.%s.%s",

+  retVal=snprintf(propString, MAX_PROP_STRING, "mama.transport.%s.%s",

     transportName ? transportName : "", PROP_NAME_DISABLE_REFRESH);

   if ((retVal<0) || (retVal>=MAX_PROP_STRING))

@@ -759,8 +764,7 @@

                 name);

     }

-

-    if (!mamaTransportInternal_disableRefreshes (name))

+    if ((!self->mDisableRefresh) && (!mamaTransportInternal_disableRefreshes(name)))

     {

         return refreshTransport_create (&self->mRefreshTransport,

                                     (mamaTransport)self,

Index: c_cpp/src/c/mama/transport.h

===================================================================

RCS file: /cvsroot/products/mama/c_cpp/src/c/mama/transport.h,v

retrieving revision 1.34.4.2.4.1.2.3

diff -u -r1.34.4.2.4.1.2.3 transport.h

--- c_cpp/src/c/mama/transport.h           10 Aug 2011 14:53:28 -0000          1.34.4.2.4.1.2.3

+++ c_cpp/src/c/mama/transport.h        27 Dec 2011 20:44:15 -0000

@@ -291,6 +291,17 @@

                                    double *result);

 /**

+ * Disable Refreshing.

+ *

+ * @param transport the transport instance

+ * @param disable t/f.

+ */

+MAMAExpDLL

+extern void

+mamaTransport_disableRefresh (mamaTransport transport,

+                                                                                                                             uint8_t disable);

+

+/**

  * Set the throttle rate.

  *

  * @param transport the transport.

 

Signed-off-by: John Gray <jgray@...>

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.