feat(mac): optimize BLE auto-connect, prioritize Wi-Fi/Hotspot, and fix scan timer spam#241
feat(mac): optimize BLE auto-connect, prioritize Wi-Fi/Hotspot, and fix scan timer spam#241Mudit200408 wants to merge 4 commits into
Conversation
…ix scan timer spam - BLE Central Manager Optimization: - Fix infinite connection and service discovery loop by tracking discovered service UUIDs in a Set instead of an integer counter. - Guard characteristics discovery and notification subscription to prevent duplicate calls and channel stalls. - Enforce single token write per connection attempt. - Prevent scan timer from restarting scans and spamming logs when connected or when Wi-Fi is active. - Delay BLE auto-connect by 3.0s if a local network is active to give Wi-Fi/Hotspot connection priority. - Hotspot Unicast Wake-up Fallback: - Implement default gateway (.1) fallback in QuickConnectManager when no exact network history matches the new Mac IP. - Trigger auto wake-up of last connected device immediately on network change/server restart. - This completely bypasses the hotspot UDP broadcast blockade and connects via hotspot unicast! - UDP Discovery & Reconnect Flow: - Keep UDP discovery active when only a BLE connection is active to allow seamless shift to Wi-Fi/Hotspot. - Guard network monitors to prevent tearing down active BLE connections or resetting the manual disconnect flag when Wi-Fi flaps. - enable UDP broadcasting and peer exchange during BLE fallback
|
@Mudit200408 What is the reason for these implementations? Hotspot is the same as any WiFi connection so there is no difference.
|
Here is a concise, professional reply you can paste directly into your Pull Request: Although mobile hotspots look like standard Wi-Fi, they treat local peer-to-peer communication differently:
These Implementation Allows us to bypass the broadcast blockade by falling back to a direct unicast connection attempt to the default gateway ( |
|
I have fixed the auto-connect button, can u test it out if possible? |
|
I was testing and i found out the airsync was working on steroids,even when the Macbook was not in use (lid down) it used to connect with android, these changes fixes that |
Yes, I am working on a fix for this.. I think it might be the bluetooth causing that. Edit: Fixed |
Hey, any more bugs you found in the implementation? |


BLE Central Manager Optimization:
Hotspot Unicast Wake-up Fallback:
UDP Discovery & Reconnect Flow: