[PATCH] [transport] Added method to disable refreshes


Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@...>

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.

Signed-off-by: John Gray <jgray@...>
---
mama/c_cpp/src/c/mama/transport.h | 11 +++++++++++
mama/c_cpp/src/c/transport.c | 14 +++++++++-----
2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/mama/c_cpp/src/c/mama/transport.h b/mama/c_cpp/src/c/mama/transport.h
index f97021b..d66905c 100644
--- a/mama/c_cpp/src/c/mama/transport.h
+++ b/mama/c_cpp/src/c/mama/transport.h
@@ -291,6 +291,17 @@ mamaTransport_getOutboundThrottle (mamaTransport transport,
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.
diff --git a/mama/c_cpp/src/c/transport.c b/mama/c_cpp/src/c/transport.c
index de92a56..95e912c 100644
--- a/mama/c_cpp/src/c/transport.c
+++ b/mama/c_cpp/src/c/transport.c
@@ -161,6 +161,7 @@ typedef struct transportImpl_
int mGroupSizeHint;

uint8_t mDisableDisconnectCb;
+ uint8_t mDisableRefresh;
preInitialScheme mPreInitialScheme;
} transportImpl;

@@ -369,14 +370,18 @@ static void setPreInitialStrategy (mamaTransport transport)
*
* 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 @@ mamaTransport_create (mamaTransport transport,
name);
}

-
- if (!mamaTransportInternal_disableRefreshes (name))
+ if ((!self->mDisableRefresh) && (!mamaTransportInternal_disableRefreshes(name)))
{
return refreshTransport_create (&self->mRefreshTransport,
(mamaTransport)self,
--
1.7.5.4