RpcChannelFailureCb rpcFailureCb;
guint rpcMaxFailures;
gboolean rpcInInitialized;
+ GSource *restartTimer; /* Channel restart timer */
#endif
} RpcChannelInt;
/* Synchronize with any RpcChannel_Send calls by other threads. */
g_static_mutex_lock(&chan->impl.outLock);
+ g_source_unref(chan->restartTimer);
+ chan->restartTimer = NULL;
RpcChannelStopNoLock(&chan->impl);
/* Check the channel state. */
if (chan->rpcError) {
- GSource *src;
if (++(chan->rpcResetErrorCount) > channelTimeoutAttempts) {
Warning("Failed to reset channel after %u attempts\n",
/* Schedule the channel restart for 1 sec in the future. */
Debug(LGPFX "Resetting channel [%u]\n", chan->rpcResetErrorCount);
- src = g_timeout_source_new(1000);
- g_source_set_callback(src, RpcChannelRestart, chan, NULL);
- g_source_attach(src, chan->mainCtx);
- g_source_unref(src);
+ ASSERT(chan->restartTimer == NULL);
+ chan->restartTimer = g_timeout_source_new(1000);
+ g_source_set_callback(chan->restartTimer, RpcChannelRestart, chan, NULL);
+ g_source_attach(chan->restartTimer, chan->mainCtx);
goto exit;
}
return;
}
+ /*
+ * Stop the restartTimer.
+ */
+ if (cdata->restartTimer) {
+ g_source_destroy(cdata->restartTimer);
+ g_source_unref(cdata->restartTimer);
+ cdata->restartTimer = NULL;
+ }
+
RpcChannel_UnregisterCallback(chan, &cdata->resetReg);
for (i = 0; i < ARRAYSIZE(gRpcHandlers); i++) {
RpcChannel_UnregisterCallback(chan, &gRpcHandlers[i]);