Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paho_mqtt_thread 里面的connect_callback执行的位置问题 #52

Open
yinqian-git opened this issue Mar 13, 2023 · 1 comment
Open

Comments

@yinqian-git
Copy link

paho_mqtt_thread 里面的connect_callback连接成功回调怎么是在连接开始的时候,不应该是连接服务器成功之后吗,不知道我理解对不对

@yinqian-git
Copy link
Author

_mqtt_start:
//源码位置,这个是连接开始前调用
if (c->connect_callback)
{
c->connect_callback(c);
}

rc = net_connect(c);
if (rc != 0)
{
    LOG_E("Net connect error(%d).", rc);
    goto _mqtt_restart;
}

rc = MQTTConnect(c);
if (rc != 0)
{
    LOG_E("MQTT connect error(%d): %s.", rc, MQTTSerialize_connack_string(rc));
    goto _mqtt_restart;
}
//此处连接成功,应该调用?
//if (c->connect_callback)
//{

// c->connect_callback(c);
// }
LOG_I("MQTT server connect success.");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant