fdo#75328 Do DiscoveryService socket setup off the main thread.
Change-Id: I795f365981d8e7983c9f32531c9ec2ae4793c8f4
This commit is contained in:
@@ -55,8 +55,24 @@ using namespace rtl;
|
||||
using namespace sd;
|
||||
|
||||
DiscoveryService::DiscoveryService()
|
||||
: zService( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
DiscoveryService::~DiscoveryService()
|
||||
{
|
||||
#ifdef WNT
|
||||
closesocket( mSocket );
|
||||
#else
|
||||
close( mSocket );
|
||||
#endif
|
||||
|
||||
if (zService)
|
||||
zService->clear();
|
||||
}
|
||||
|
||||
void DiscoveryService::setupSockets()
|
||||
{
|
||||
zService = NULL;
|
||||
|
||||
#ifdef MACOSX
|
||||
// Bonjour for OSX
|
||||
@@ -119,21 +135,12 @@ DiscoveryService::DiscoveryService()
|
||||
}
|
||||
}
|
||||
|
||||
DiscoveryService::~DiscoveryService()
|
||||
{
|
||||
#ifdef WNT
|
||||
closesocket( mSocket );
|
||||
#else
|
||||
close( mSocket );
|
||||
#endif
|
||||
|
||||
if (zService)
|
||||
zService->clear();
|
||||
}
|
||||
|
||||
void SAL_CALL DiscoveryService::run()
|
||||
{
|
||||
osl::Thread::setName("DiscoveryService");
|
||||
|
||||
setupSockets();
|
||||
|
||||
// Kept for backwrad compatibility
|
||||
char aBuffer[BUFFER_SIZE];
|
||||
while ( true )
|
||||
|
@@ -30,6 +30,12 @@ namespace sd
|
||||
DiscoveryService();
|
||||
~DiscoveryService();
|
||||
|
||||
/**
|
||||
* Networking related setup -- must be run within our own thread
|
||||
* to prevent the application blocking (fdo#75328).
|
||||
*/
|
||||
void setupSockets();
|
||||
|
||||
static DiscoveryService *spService;
|
||||
virtual void SAL_CALL run();
|
||||
int mSocket;
|
||||
|
Reference in New Issue
Block a user