Re-order avahi calls to make it more obvious what's going on.
This commit is contained in:
parent
7d09548243
commit
209b342bb9
@ -9,26 +9,40 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void LogCommit(QDBusPendingReply<> reply) {
|
void AddService(
|
||||||
qLog(Debug) << "Remote interface published on Avahi:" << reply.error();
|
const QString domain,
|
||||||
}
|
const QString type,
|
||||||
|
const QString name,
|
||||||
|
quint16 port,
|
||||||
|
QDBusPendingReply<QDBusObjectPath> path_reply);
|
||||||
|
void Commit(OrgFreedesktopAvahiEntryGroupInterface* interface);
|
||||||
|
void LogCommit(QDBusPendingReply<> reply);
|
||||||
|
|
||||||
void Commit(OrgFreedesktopAvahiEntryGroupInterface* interface) {
|
} // namespace
|
||||||
QDBusPendingReply<> reply = interface->Commit();
|
|
||||||
|
void Avahi::Publish(
|
||||||
|
const QString& domain,
|
||||||
|
const QString& type,
|
||||||
|
const QString& name,
|
||||||
|
quint16 port) {
|
||||||
|
OrgFreedesktopAvahiServerInterface server_interface(
|
||||||
|
"org.freedesktop.Avahi",
|
||||||
|
"/",
|
||||||
|
QDBusConnection::systemBus());
|
||||||
|
QDBusPendingReply<QDBusObjectPath> reply = server_interface.EntryGroupNew();
|
||||||
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply);
|
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply);
|
||||||
QObject::connect(
|
|
||||||
watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
|
||||||
watcher, SLOT(deleteLater()));
|
|
||||||
QObject::connect(
|
|
||||||
watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
|
||||||
interface, SLOT(deleteLater()));
|
|
||||||
NewClosure(
|
NewClosure(
|
||||||
watcher,
|
watcher,
|
||||||
SIGNAL(finished(QDBusPendingCallWatcher*)),
|
SIGNAL(finished(QDBusPendingCallWatcher*)),
|
||||||
&LogCommit,
|
&AddService,
|
||||||
reply);
|
domain, type, name, port, reply);
|
||||||
|
QObject::connect(
|
||||||
|
watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
||||||
|
watcher, SLOT(deleteLater()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
void AddService(
|
void AddService(
|
||||||
const QString domain,
|
const QString domain,
|
||||||
const QString type,
|
const QString type,
|
||||||
@ -72,25 +86,25 @@ void AddService(
|
|||||||
watcher, SLOT(deleteLater()));
|
watcher, SLOT(deleteLater()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
void Commit(OrgFreedesktopAvahiEntryGroupInterface* interface) {
|
||||||
|
QDBusPendingReply<> reply = interface->Commit();
|
||||||
void Avahi::Publish(
|
|
||||||
const QString& domain,
|
|
||||||
const QString& type,
|
|
||||||
const QString& name,
|
|
||||||
quint16 port) {
|
|
||||||
OrgFreedesktopAvahiServerInterface server_interface(
|
|
||||||
"org.freedesktop.Avahi",
|
|
||||||
"/",
|
|
||||||
QDBusConnection::systemBus());
|
|
||||||
QDBusPendingReply<QDBusObjectPath> reply = server_interface.EntryGroupNew();
|
|
||||||
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply);
|
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply);
|
||||||
NewClosure(
|
|
||||||
watcher,
|
|
||||||
SIGNAL(finished(QDBusPendingCallWatcher*)),
|
|
||||||
&AddService,
|
|
||||||
domain, type, name, port, reply);
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
||||||
watcher, SLOT(deleteLater()));
|
watcher, SLOT(deleteLater()));
|
||||||
|
QObject::connect(
|
||||||
|
watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
||||||
|
interface, SLOT(deleteLater()));
|
||||||
|
NewClosure(
|
||||||
|
watcher,
|
||||||
|
SIGNAL(finished(QDBusPendingCallWatcher*)),
|
||||||
|
&LogCommit,
|
||||||
|
reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LogCommit(QDBusPendingReply<> reply) {
|
||||||
|
qLog(Debug) << "Remote interface published on Avahi:" << reply.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user