Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] External loop with poll()

Dear All,

I'm trying to integrate a libmosquitto client into my application built around poll() and mosquitto_loop_write() and co.
Here is the relevant excerpt of the code:
https://gist.github.com/zgyarmati/fa2e2be391c664f35bd2ccac5c4cad3a

I got confused about the needed events flags: if i set only POLLIN at line #89 (and #114) at the first PINGREQ the client dis- and reconnects (I assume it can't send out the request, so it won't get answer to it neither), but if i set "POLLIN | POLLOUT", the poll always returns instantly
 (regardless if actual event was happening) with the mosquitto socket's fd, pushing the CPU to 100%.
What do i miss here?

Thanks in advance, regards

-- 
Zoltan Gyarmati
https://zgyarmati.de

Attachment: signature.asc
Description: OpenPGP digital signature


Back to the top