mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-27 19:10:41 -05:00
Fix broadcast discovery in Android
On Android and potencially other mobile platforms, WiFi drivers are configured by default to discard any packet that is not directed to the unicast mac address of the interface, this way they could save some battery but breaks anything that is not unicast, such as broadcast discovery. To solve this problem On such platforms provide methods to handle low level multicast listening so we can receive advertisement from same broadcast domain nodes.
This commit is contained in:
parent
48267eb659
commit
7f2bfae104
4 changed files with 180 additions and 3 deletions
|
|
@ -107,5 +107,45 @@ public:
|
|||
*/
|
||||
virtual std::vector<RsBroadcastDiscoveryResult> getDiscoveredPeers() = 0;
|
||||
|
||||
/**
|
||||
* @brief Check if multicast listening is enabled
|
||||
* @jsonapi{development}
|
||||
* On some platforms such as Android multicast listening, which is needed
|
||||
* for broadcast discovery, is not enabled by default at WiFi driver level
|
||||
* @see enableMulticastListening, so this method check if it is enabled.
|
||||
* On platforms that are not expected to have such a limitation this method
|
||||
* always return true.
|
||||
* @return true if enabled, false otherwise.
|
||||
*/
|
||||
virtual bool isMulticastListeningEnabled() = 0;
|
||||
|
||||
/**
|
||||
* @brief On platforms that need it enable low level multicast listening
|
||||
* @jsonapi{development}
|
||||
* On Android and potencially other mobile platforms, WiFi drivers are
|
||||
* configured by default to discard any packet that is not directed to the
|
||||
* unicast mac address of the interface, this way they could save some
|
||||
* battery but breaks anything that is not unicast, such as broadcast
|
||||
* discovery. On such platforms this method enable low level multicast
|
||||
* listening so we can receive advertisement from same broadcast domain
|
||||
* nodes.
|
||||
* On platforms without such limitation does nothing and always return
|
||||
* false.
|
||||
* It is exposed as a public API so the UI can decide the right equilibrium
|
||||
* between discoverability and battery saving.
|
||||
* @return true if multicast listening has been enabled due to this call,
|
||||
* false otherwise.
|
||||
*/
|
||||
virtual bool enableMulticastListening() = 0;
|
||||
|
||||
/**
|
||||
* @brief Disable multicast listening
|
||||
* @jsonapi{development}
|
||||
* The opposite of @see enableMulticastListening.
|
||||
* @return true if multicast listening has been disabled due to this call,
|
||||
* false otherwise.
|
||||
*/
|
||||
virtual bool disableMulticastListening() = 0;
|
||||
|
||||
virtual ~RsBroadcastDiscovery();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue