是否存在c->ping_outstanding = 1;的后一秒就触发TimerIsExpired(&c->last_received)
int keepalive(MQTTClient *c)
{
int rc = SUCCESS;
if (c->keepAliveInterval == 0)
goto exit;
if (TimerIsExpired(&c->last_sent) || TimerIsExpired(&c->last_received))
{
if (c->ping_outstanding)
rc = FAILURE;
else
{
Timer timer;
TimerInit(&timer);
TimerCountdownMS(&timer, 1000);
int len = MQTTSerialize_pingreq(c->buf, c->buf_size);
if (len > 0 && (rc = sendPacket(c, len, &timer)) == SUCCESS)
c->ping_outstanding = 1;
}
}
exit:
return rc;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)