Skip to main content

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

Dear Roger & All,

thanks for the prompt answer! And if i call mosquitto_want_write() when returning, which event flag(s) i have to set?
My current version looks like:
https://gist.github.com/zgyarmati/fa2e2be391c664f35bd2ccac5c4cad3a
but i have the same symptoms: when only POLLIN enabled, the client dis/reconnects to the broker, if POLLOUT also enabled, i get busy loop... Any further ideas


Thanks in advance, regards

Zoltan Gyarmati
https://zgyarmati.de
On 2016-09-14 18:41, Roger Light wrote:

Hi Zoltan,

You should use mosquitto_want_write() (or a similar name, I'm on my phone and going on memory) to find out when the client wants to write.

Cheers,

Roger


On 14 Sep 2016 4:58 p.m., "Zoltan Gyarmati" <mr.zoltan.gyarmati@xxxxxxxxx> wrote:
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

_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev


_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev

Attachment: signature.asc
Description: OpenPGP digital signature


Back to the top