Emit removeService() for all discovered services when browser is stopped.

This commit is contained in:
Jonathan Bagg
2017-10-09 21:23:00 -04:00
parent ab0fae957d
commit 2622544691
4 changed files with 11 additions and 3 deletions

View File

@ -208,8 +208,10 @@ public:
browser = NULL;
QMap<QString, QZeroConfService *>::iterator i;
for (i = pub->services.begin(); i != pub->services.end(); i++)
for (i = pub->services.begin(); i != pub->services.end(); i++) {
emit pub->serviceRemoved(*i);
delete *i;
}
pub->services.clear();
QMap<QString, AvahiServiceResolver *>::iterator r;

View File

@ -220,8 +220,10 @@ public:
browser = NULL;
QMap<QString, QZeroConfService *>::iterator i;
for (i = pub->services.begin(); i != pub->services.end(); i++)
for (i = pub->services.begin(); i != pub->services.end(); i++) {
emit pub->serviceRemoved(*i);
delete *i;
}
pub->services.clear();
QMap<QString, AvahiSServiceResolver *>::iterator r;

View File

@ -250,8 +250,10 @@ void QZeroConfPrivate::cleanUp(DNSServiceRef toClean)
browserSocket = NULL;
}
QMap<QString, QZeroConfService *>::iterator i;
for (i = pub->services.begin(); i != pub->services.end(); i++)
for (i = pub->services.begin(); i != pub->services.end(); i++) {
emit pub->serviceRemoved(*i);
delete *i;
}
pub->services.clear();
}
else if (toClean == dnssRef) {

View File

@ -74,12 +74,14 @@ public:
~QZeroConf();
void startServicePublish(const char *name, const char *type, const char *domain, quint16 port);
void stopServicePublish(void);
bool publishExists(void);
inline void startBrowser(QString type)
{
startBrowser(type, QAbstractSocket::IPv4Protocol);
}
void startBrowser(QString type, QAbstractSocket::NetworkLayerProtocol protocol);
void stopBrowser(void);
bool browserExists(void);
void addServiceTxtRecord(QString nameOnly);
void addServiceTxtRecord(QString name, QString value);
void clearServiceTxtRecords();