diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-03-18 07:34:48 +0000 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-03-18 12:16:44 +0000 |
commit | c0fb2640665d552b39deb2192d59fa11ea701d51 (patch) | |
tree | 46d25046825542ff87714b283e31f14b83880604 /sd/source/ui | |
parent | 6181013d9989bb5c96e88ea1bc8d581b99c28421 (diff) |
fdo#75328 Do DiscoveryService socket setup off the main thread.
Change-Id: I795f365981d8e7983c9f32531c9ec2ae4793c8f4
Diffstat (limited to 'sd/source/ui')
-rw-r--r-- | sd/source/ui/remotecontrol/DiscoveryService.cxx | 33 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/DiscoveryService.hxx | 6 |
2 files changed, 26 insertions, 13 deletions
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx index 1919b60cd796..42563ed1fd2e 100644 --- a/sd/source/ui/remotecontrol/DiscoveryService.cxx +++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx @@ -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 ) diff --git a/sd/source/ui/remotecontrol/DiscoveryService.hxx b/sd/source/ui/remotecontrol/DiscoveryService.hxx index 9edfd69a02fc..03bbf87e4e96 100644 --- a/sd/source/ui/remotecontrol/DiscoveryService.hxx +++ b/sd/source/ui/remotecontrol/DiscoveryService.hxx @@ -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; |