Solved zeroconf service name conflict

This commit is contained in:
Xinyu Hou 2014-11-25 14:31:38 +00:00
parent 5222b81600
commit 97ea94de69
2 changed files with 10 additions and 1 deletions

View File

@ -28,6 +28,10 @@ ZeroconfBrowser::ZeroconfBrowser(QObject* parent) :
ZeroconfBrowser::~ZeroconfBrowser()
{
if (m_pSocket) {
delete m_pSocket;
}
if (m_DnsServiceRef) {
DNSServiceRefDeallocate(m_DnsServiceRef);
m_DnsServiceRef = 0;

View File

@ -28,6 +28,10 @@ ZeroconfRegister::ZeroconfRegister(QObject* parent) :
ZeroconfRegister::~ZeroconfRegister()
{
if (m_pSocket) {
delete m_pSocket;
}
if (m_DnsServiceRef) {
DNSServiceRefDeallocate(m_DnsServiceRef);
m_DnsServiceRef = 0;
@ -49,7 +53,8 @@ void ZeroconfRegister::registerService(const ZeroconfRecord& record,
}
#endif
DNSServiceErrorType err = DNSServiceRegister(&m_DnsServiceRef, 0, 0,
DNSServiceErrorType err = DNSServiceRegister(&m_DnsServiceRef,
kDNSServiceFlagsNoAutoRename, 0,
record.serviceName.toUtf8().constData(),
record.registeredType.toUtf8().constData(),
record.replyDomain.isEmpty() ? 0 : record.replyDomain.toUtf8().constData(),