mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Android: Acquire the MulticastLock when using the NetworkServiceDiscovery::AvailableServiceList class to ensure that multicast packets are received on all devices
This commit is contained in:
parent
f982c00d88
commit
605d0978ce
3 changed files with 72 additions and 0 deletions
|
|
@ -23,6 +23,11 @@
|
|||
namespace juce
|
||||
{
|
||||
|
||||
#if JUCE_ANDROID
|
||||
extern void acquireMulticastLock();
|
||||
extern void releaseMulticastLock();
|
||||
#endif
|
||||
|
||||
NetworkServiceDiscovery::Advertiser::Advertiser (const String& serviceTypeUID,
|
||||
const String& serviceDescription,
|
||||
int broadcastPortToUse, int connectionPort,
|
||||
|
|
@ -73,6 +78,10 @@ void NetworkServiceDiscovery::Advertiser::sendBroadcast()
|
|||
NetworkServiceDiscovery::AvailableServiceList::AvailableServiceList (const String& serviceType, int broadcastPort)
|
||||
: Thread ("Discovery_listen"), serviceTypeUID (serviceType)
|
||||
{
|
||||
#if JUCE_ANDROID
|
||||
acquireMulticastLock();
|
||||
#endif
|
||||
|
||||
socket.bindToPort (broadcastPort);
|
||||
startThread (2);
|
||||
}
|
||||
|
|
@ -81,6 +90,10 @@ NetworkServiceDiscovery::AvailableServiceList::~AvailableServiceList()
|
|||
{
|
||||
socket.shutdown();
|
||||
stopThread (2000);
|
||||
|
||||
#if JUCE_ANDROID
|
||||
releaseMulticastLock();
|
||||
#endif
|
||||
}
|
||||
|
||||
void NetworkServiceDiscovery::AvailableServiceList::run()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue