Example #1
0
void MQTTClient_retry(void)
{
	time_t now;

	FUNC_ENTRY;
	time(&(now));
	if (difftime(now, last) > 5)
	{
		time(&(last));
		MQTTProtocol_keepalive(now);
		MQTTProtocol_retry(now, 1, 0);
	}
	else
		MQTTProtocol_retry(now, 0, 0);
	FUNC_EXIT;
}
Example #2
0
/**
 * MQTT protocol keepalive and retry processing.
 */
int MQTTProtocol_housekeeping(int more_work)
{
	time_t now = 0;

	FUNC_ENTRY;
	time(&(now));
	if (difftime(now, last_keepalive) > 5)
	{
		time(&(last_keepalive));
		MQTTProtocol_keepalive(now);
		more_work = MQTTProtocol_retry(now, 1);
		MQTTProtocol_update(now);
		Socket_cleanNew(now);
	}
	/*else
		more_work = MQTTProtocol_retry(now, 0);*/
	FUNC_EXIT_RC(more_work);
	return more_work;
}