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

[msom] Adjust cloud keep alive based on network connection #2716

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

scott-brust
Copy link
Member

@scott-brust scott-brust commented Dec 12, 2023

Problem

MSoM platform has both cellular and wifi connection options. However, the cloud keep alive is fixed with the cellular duration of 23 minutes even when connecting with wifi

Solution

For MSoM, when connecting to the cloud on cellular, use 23 minutes timeout
when connecting with any other interface (ie wifi), use 25 seconds timeout

Steps to Test

Connect msom on cellular, verify pings only sent every 23 minutes
Connect msom on wifi, verify pings are sent

Example App

See device-os/user/tests/app/connection-manager/application.cpp

References

Going from Cell to wifi:

0000176543 [net.ifapi] TRACE: Netif wl4 ipv4 configuration changed
0000176547 [system.nm] INFO: State changed: IFACE_LINK_UP -> IP_CONFIGURED
0000176554 [system] INFO: Cloud: connecting
0000176560 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000176566 [system] WARN: Failed to load session data from persistent storage
0000176572 [system] INFO: Discarding session data
0000176609 [system] TRACE: Resolving 0a10aced202194944a04b000.v5.udp.particle.io#5684
0000176730 [system] TRACE: Address type: 3
0000176732 [system] TRACE: Cloud socket=0, family=2, type=2, protocol=17
0000176736 [system] INFO: Cloud socket=0, connecting to 18.213.90.196#5684
0000176744 [system] TRACE: 0 Bound cloud socket to lwip interface wl4 // <---------- Wifi
0000176752 [system] TRACE: Cloud socket=0, connected to 18.213.90.196#5684
0000176758 [system] TRACE: Updating cloud keepalive for AF_INET: 1380000 -> 25000 // <---------- Wifi timeout
0000176766 [system] TRACE: Applying new keepalive interval now
0000176772 [system] INFO: Cloud socket connected

Going from wifi to cell:

0000238970 [system] INFO: Cloud: connecting
0000238974 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000238978 [system] WARN: Failed to load session data from persistent storage
0000238984 [system] INFO: Discarding session data
0000239018 [system] TRACE: Resolving 0a10aced202194944a04b000.v5.udp.particle.io#5684
0000239414 [net.rltkncp] ERROR: linkOutput up=0 link_up=0
0000239824 [system] TRACE: Address type: 3
0000239827 [system] TRACE: Cloud socket=0, family=2, type=2, protocol=17
0000239831 [system] INFO: Cloud socket=0, connecting to 18.213.90.196#5684
0000239837 [system] TRACE: 0 Bound cloud socket to lwip interface pp3 // <---------- Cellular
0000239845 [system] TRACE: Cloud socket=0, connected to 18.213.90.196#5684
0000239853 [system] TRACE: Updating cloud keepalive for AF_INET: 25000 -> 1380000 // <---------- Cellular timeout
0000239859 [system] TRACE: Applying new keepalive interval now
0000239867 [system] INFO: Cloud socket connected

@scott-brust scott-brust added this to the 5.6.1 milestone Dec 14, 2023
@scott-brust scott-brust merged commit ac4e7e9 into develop Dec 14, 2023
13 checks passed
@scott-brust scott-brust deleted the sc-123806/fix-keep-alives branch December 14, 2023 18:51
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

Successfully merging this pull request may close these issues.

3 participants