servalproject / batphone

The Serval Mesh app for Android. EXPERIMENTAL SOFTWARE.
http://www.servalproject.org
GNU General Public License v3.0
398 stars 158 forks source link

peer listing issue with bluetooth disabled #119

Closed brettowe closed 8 years ago

brettowe commented 8 years ago

on the .93rc in google play right now I see a problem where if wifi is enabled and connected to AP but bluetooth is disable it shows no peers in my test it should show 1 as soon as bluetooth is enabled it sees peers on wifi side I did do a test with bluetooth only and wifi disabled and it works as expected

brettowe commented 8 years ago

if this was pushed to google play I now see 0 peers all the time no matter how i toggle things note the peers i should be seeing are on the wifi side only

lakeman commented 8 years ago

You can check if you have 0.93-RC3 on the help screen.

brettowe commented 8 years ago

yeah thats the version thats installed

lakeman commented 8 years ago

Can you capture the output of;

$ adb logcat -v threadtime

While turning wifi & bluetooth off and on?

brettowe commented 8 years ago

attached is the log it includes opening the app and then enabling the service then toggling each item off then back on done on a motog let me know if you want logs from a nexus 7 or 10 but they act the same ether way serval-adblog.gz

lakeman commented 8 years ago

Looks like the app is successfully detecting the wifi network, binding sockets etc. So the bug I fixed has certainly gone away. I can't see any other obvious issues.

In order to detect peers, at least one broadcast IPv4 packet has to arrive in one direction. Followed by reply broadcast or unicast packets in the other direction. If a 2-way connection can't be established, no peers will be listed.

WiFi can have some weird compatibility issues between devices. Broadcast packets between peers may be either accidentally or deliberately blocked. Have you tried any other access points? Have you tried turning one of the phones into a hotspot?

We're running a web server on http://127.0.0.1:4110/ that will show some stats for each 1-way link between peers. If there are any packets getting through, this might tell us something.

brettowe commented 8 years ago

I played with it some last night i got 2 of 3 peers to show the odd part was if the nexus 7 wasnt up nexus 10 wouldnt be seen by any device i think it had to do with a test i did at one point with bluetooth only between motog and nexus7 but i removed the bluetooth entrys that should allowed that but that also doesnt explain why it would show at all with bluetooth not being used on the nexus 10

also seeing that it says 'idle' if bluetooth is toggled off did get wifi only peer to show just now that part was my screwup but if bluetooth is toggled off no peers are seen and shows idle services as soon as turned on shows 2 peers as expected but still shows up in contact peer list so maybe just a accounting issue with bluetooth off?

lakeman commented 8 years ago

Actually now that I look at this again, showing "Idle" is a bit misleading. That's actually just telling you that the most recent change to an interface was turning something off. This bit of code is still assuming that there is only one network type that we care about. We should probably fix that.

Opening the http://127.0.0.1:4110/ page on each device could help you to diagnose which network links work and which ones don't between every permutation of device pairs and access points you have access to.

That said, if device Wi-Fi compatibility is your only remaining issue, there's not much we can do to fix that. At least you can now seamlessly use bluetooth as a network link as well.

brettowe commented 8 years ago

I think at this point the last problem I had was the idle being misleading playing more with it leaving bluetooth off and reloading app gives counts properly so backend is working UI just needs a minor bug fix so I'm not sure if you want to leave this open for that bug or start a new issue for the UI issue

lakeman commented 8 years ago

Fixed by 69506ecaa8