forked from qt-creator/qt-creator
zeroconf: improve startup of mdnssd
give enough startup time, while still quickly bailing out when quitting Change-Id: I628621099e9ead4defc4613615ccb5e8303ff2df Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
@@ -35,7 +35,9 @@
|
||||
|
||||
#include "dnssd_ipc.h"
|
||||
|
||||
namespace ZeroConf { namespace embeddedLib {
|
||||
namespace ZeroConf {
|
||||
extern int gQuickStop;
|
||||
namespace embeddedLib {
|
||||
#include "../dns_sd_funct.h"
|
||||
static int gDaemonErr = kDNSServiceErr_NoError;
|
||||
}}
|
||||
@@ -233,7 +235,7 @@ static int read_all(dnssd_sock_t sd, char *buf, int len)
|
||||
int nVal=select(sd+1, &readFds, &writeFds, &exceptFds, &timeout);
|
||||
if (nVal < 1 || !FD_ISSET(sd, &readFds)) {
|
||||
++nErr;
|
||||
if (nErr < 6) // wait max 6s without reading
|
||||
if (nErr < 100 && ! ZeroConf::gQuickStop) // wait max 100s without reading
|
||||
continue;
|
||||
} else {
|
||||
num_read = recv(sd, buf, len, 0);
|
||||
|
@@ -197,6 +197,8 @@ void ZeroConfLib::setDefaultLib(LibUsage usage, const QString &avahiLibName,
|
||||
|
||||
namespace ZeroConf {
|
||||
|
||||
int gQuickStop = 0;
|
||||
|
||||
// ----------------- ErrorMessage impl -----------------
|
||||
/*!
|
||||
\class ZeroConf::ErrorMessage
|
||||
@@ -1597,7 +1599,9 @@ MainConnection::MainConnection():
|
||||
|
||||
MainConnection::~MainConnection()
|
||||
{
|
||||
gQuickStop = 1;
|
||||
stop(true);
|
||||
gQuickStop = 0;
|
||||
delete m_thread;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user