-
-
Notifications
You must be signed in to change notification settings - Fork 895
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
More MQTT Ethernet configuration - timeout #1453
base: development
Are you sure you want to change the base?
More MQTT Ethernet configuration - timeout #1453
Conversation
@@ -159,7 +159,11 @@ bool reconnectMQTT(void) | |||
|
|||
return true; | |||
} | |||
#if defined(MY_MQTT_ETH_CLIENT_CONNECTION_TIMEOUT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about setting the default value in MyConfig.h (like we do for baud rate here). That way we don't need to have the if clause here and on line 258.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you wish, no problem! Will do in an hour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
e27f08a
to
947f1a0
Compare
Nice work. Our CI pipeline is out of order at the moment unfortunately, probably due to changes in the Github API. People in the core team are looking at it. In the meanwhile, here are some minor things:
If keywords aren't included in Doxygen, they will not be available at https://www.mysensors.org/apidocs/index.html Just add defines for these: |
947f1a0
to
169c309
Compare
No problem! |
MY_MQTT_ETH_INIT_DELAY configuration field is useful for adjusting Ethernet Chip initialisation delay time by library user.
169c309
to
9ab9ed4
Compare
It appears that current EthernetClient implementation for Linux GW doesn't support setSocketTimeout. But it think it can be added easily, will try.... |
I've added implementation of setConnectionTimeout based on setsockopt SO_SNDTIMEO and SO_RCVTIMEO, please have a look. |
e9e656a
to
11a279b
Compare
Unfortunately, still ESP platforms doesnt support connection timeout, and i can't see an option to implement it... |
11a279b
to
880161a
Compare
Hi all, i can see butler assertion: is there any option to get what he has produced? I can't find what's wrong in coding style |
@mobrembski you didn't get the email? |
@mfalkvidd No, i didnt ;) that's why i was asking :) |
I'll check the log files to see if I can find anything related to the missing email. |
880161a
to
7ed332d
Compare
MY_MQTT_ETH_CLIENT_CONNECTION_TIMEOUT is useful for adjusting default MQTT TCP/IP connection timeout by library user.
7ed332d
to
c9130b9
Compare
I think gsm has same problem as esp. /var/lib/jenkins/jobs/MySensors/jobs/MySensors/branches/PR-1453/workspace/MySensors/core/MyGatewayTransportMQTTClient.cpp:256:18: error: 'TinyGsmClient {aka class TinyGsmSim800::GsmClient}' has no member named 'setConnectionTimeout'; did you mean 'setTimeout'? |
Hi All!
I will give you a background why i've created this PR.
My device is quite standalone, and it doesn't requires MQTT broker to be connected all the time. It's great if it is connected, but if it's not connected - it should be able to still operate normally.
The problem is that current MySensors library in practice doesn't allow to run code without connection to broker. In practice, because in theory it allows but when i run my code on my device, user loop() is handled every 2 seconds because MQTT is blocking MCU while waiting for connection to be established. If it fails, it runs user loop for one time and then it retries to connect, blocking for another second.
It is not very useful to have application loop executed every 2 seconds...
My solution is very simple. Just give end user ability to change default connection timeout settings. If he doesn't supply his customized settings, then default (1s) is used - just like it is now.