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
the difference between "mqtt3_db_message_write" and "loop_handle_reads_writes"? #710
Comments
Could you clarify the issue? I'd like to know it is just a doubt or a critical issue with appropriate background and reason. |
In mosquito source code, we traversed all the context in HASH_ITER(hh_sock, db->contexts_by_sock, context, ctxt_tmp)
{
...
/*if the context is valid, we handle the msgs queued in context*/
if(mqtt3_db_message_write(db, context) == MOSQ_ERR_SUCCESS)
{
....
}
...
/*poll all the fd in pollfds*/
fdcount = poll(pollfds, pollfd_index, 100);
if(fdcount == -1){
_mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error in poll: %s.", strerror(errno));
}else{
/*we handle write and read events of pollfds*/
loop_handle_reads_writes(db, pollfds);
...
}
...
} In mqtt3_db_message_write , we deal with all the msgs with states below: /*the call stack when we handle with msgs in 'mosq_ms_publish_qos0' states */
case mosq_ms_publish_qos0 -> _mosquitto_send_publish -> _mosquitto_send_real_publish ->
_mosquitto_packet_queue -> _mosquitto_packet_write -> _mosquitto_net_write In loop_handle_reads_writes, we still call the function Thanks a lot. |
You don't have a specific trouble, and you have just a doubt on the necessity of some codes, right? |
Yes... (⊙o⊙) I plan to write some blogs to explain the architecture and some difficult point of this MQTT broker recently. But I am confused with some codes, and that's why I asked this issue. |
Sounds great work! I am truly looking forward to seeing it. But this place is for reporting bugs (issue) or submitting changes (PR) . |
:-) You help me a lot.Thank you very much !!! |
Hi, guys, I am reading the mosquito source code recently , but I couldn't figure out the difference between mqtt3_db_message_write and loop_handle_reads_writes. I know mqtt3_db_message_write and loop_handle_reads_writes are both used to send the messages queued of one context. So what's the difference between them? Thanks a lot, :-)
The text was updated successfully, but these errors were encountered: