void handleSimpleTunnelMsgHandler(RsslReactor *pReactor, RsslReactorChannel *pReactorChannel, SimpleTunnelMsgHandler *pSimpleTunnelMsgHandler) { time_t currentTime = 0; RsslTunnelStream *pTunnelStream = pSimpleTunnelMsgHandler->tunnelStreamHandler.pTunnelStream; handleTunnelStreamHandler(pReactor, pReactorChannel, &pSimpleTunnelMsgHandler->tunnelStreamHandler); if (pTunnelStream == NULL) return; /* Don't try to send messages if tunnel is not established. */ if (pTunnelStream->state.streamState != RSSL_STREAM_OPEN || pTunnelStream->state.dataState != RSSL_DATA_OK) return; /* If authentication was requested and this is a provider, ensure the authentication response * is sent before sending other messages. */ if (pSimpleTunnelMsgHandler->waitingForAuthenticationRequest) return; /* If tunnel is open and some time has passed, send a message. */ time(¤tTime); if (currentTime >= pSimpleTunnelMsgHandler->nextMsgTime) { simpleTunnelMsgHandlerSendMessage(pSimpleTunnelMsgHandler); pSimpleTunnelMsgHandler->nextMsgTime = currentTime + (time_t)TUNNEL_MSG_FREQUENCY; } }
void handleQueueMsgHandler(RsslReactor *pReactor, RsslReactorChannel *pReactorChannel, QueueMsgHandler *pQueueMsgHandler) { time_t currentTime = 0; RsslTunnelStream *pTunnelStream = pQueueMsgHandler->tunnelStreamHandler.pTunnelStream; handleTunnelStreamHandler(pReactor, pReactorChannel, &pQueueMsgHandler->tunnelStreamHandler); if (pTunnelStream == NULL) return; /* Don't try to send messages if tunnel is not established. */ if (pTunnelStream->state.streamState != RSSL_STREAM_OPEN || pTunnelStream->state.dataState != RSSL_DATA_OK) return; /* If tunnel is open and some time has passed, send a message. */ time(¤tTime); if (currentTime >= pQueueMsgHandler->nextMsgTime && pQueueMsgHandler->isQueueStreamOpen) { sendQueueMsg(pQueueMsgHandler); pQueueMsgHandler->nextMsgTime = currentTime + QUEUE_MSG_FREQUENCY; } }