fdo#75328 Do DiscoveryService socket setup off the main thread.

Change-Id: I795f365981d8e7983c9f32531c9ec2ae4793c8f4
This commit is contained in:
Andrzej Hunt
2014-03-18 07:34:48 +00:00
parent 6181013d99
commit c0fb264066
2 changed files with 26 additions and 13 deletions

View File

@@ -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 )

View File

@@ -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;