Is there a device discovery algorithm - or random?

Android v.0.12.2+18-g56f1c29

I have 3 local devices in a cluster, all behind the same router.

(1) Android Phone (2) Windows laptop (3) Synology NAS (linux)

The method Android Syncthing uses to discover the other 2 devices appears to be totally random. Each time I fire it up I see a different ip address for the other 2 devices. Sometimes it employs LOCAL DISCOVERY, sometimes GLOBAL DISCOVERY on port 22000, and sometimes very slowly via relay server.

Is there a hard algorithm used to prioritize the discovery method, or is this entirely random?

My preference would be Local Discovery for local devices, and relay used as the method of last resort.

Thanks.

It obviously prefers local addresses to global addresses, but there is a limited amount of time we wait for that to happen.

Can you run with STTRACE=discovery, and get the output via ADB from the phone/NAS/device that is having trouble to see whats actually happening.

Thanks

My android phone is unrooted, not sure I can run the “STTRACE=discovery” command on it. I’ll try this later when I am on the windows laptop - to see if we can get any meaningful output.

You can set the debug argument in the wrapper, then enable developer mode on the phone, and connect it to your desktop using ADB. I am sure there is enough material on Google to help you with this.

The version upgrade to v.0.12.4 appears to have corrected my prior discovery issues. Local devices are now using LAN addresses on “dynamic”, and also the correct IP addresses for remote devices on “dynamic”. I’m no longer getting discovery time-outs pushing me to the relay servers.

Looks good.

Meanwhile, I have installed the Java SDK + Android Suite (with ADB); I will start learning how to generate output logs the for next time I need them.

Thanks!

No need for all that, if you don’t want to compile, you can just use the adb tool :wink:

Ha ha … I know, I figured THAT out 2 minutes after I installed this 4GB monster!

:facepalm:

1 Like

So v0.12.4 has exactly 0 changes in that department, so I don’t think its fixed.

OK.

I captured an “sttrace discovery” adb output from my Android phone as follows:

(1) Started St on all cluster devices EXCEPT for the Android

(2) Started the adb capture

(3) Started St on Android

(4) Waited for all devices to discover each other and sync

(5) Closed St on Android

(6) Stopped the adb capture

I don’t want to post this here in the forum. How can I send it to you? Thanks.

Sure, but did you capture it as the issue happened or just captured in general?

The logs would only make sense when captured when the issue happens (and nice to compare it with logs when it doesn’t happen).

I haven’t been able to reproduce the time-outs and local discovery bumped to relay server.

IF the problem occurs again, I’ll try to capture that … and then we can compare it to when it doesn’t happen.

Thanks.