summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/LinkLocal')
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h12
-rw-r--r--Swiften/LinkLocal/SConscript1
2 files changed, 9 insertions, 4 deletions
diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h b/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h
index cca0475..4b8987f 100644
--- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h
@@ -17,14 +17,15 @@ namespace Swift {
class AvahiBrowseQuery : public DNSSDBrowseQuery, public AvahiQuery {
public:
- AvahiBrowseQuery(boost::shared_ptr<AvahiQuerier> q) : AvahiQuery(q) {
+ AvahiBrowseQuery(boost::shared_ptr<AvahiQuerier> q) : AvahiQuery(q), browser(NULL) {
}
void startBrowsing() {
+ assert(!browser);
std::cout << "Start browsing" << std::endl;
avahi_threaded_poll_lock(querier->getThreadedPoll());
std::cout << "Creating browser" << std::endl;
- AvahiServiceBrowser* browser = avahi_service_browser_new(querier->getClient(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_presence._tcp", NULL, (AvahiLookupFlags) 0, &handleServiceDiscoveredStatic, this);
+ browser = avahi_service_browser_new(querier->getClient(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_presence._tcp", NULL, (AvahiLookupFlags) 0, &handleServiceDiscoveredStatic, this);
if (!browser) {
std::cout << "Error" << std::endl;
MainEventLoop::postEvent(boost::bind(boost::ref(onError)), shared_from_this());
@@ -35,9 +36,8 @@ namespace Swift {
}
void stopBrowsing() {
- assert(browser);
avahi_threaded_poll_lock(querier->getThreadedPoll());
- avahi_server_browser_free(browser);
+ avahi_service_browser_free(browser);
browser = NULL;
avahi_threaded_poll_unlock(querier->getThreadedPoll());
}
@@ -70,5 +70,9 @@ namespace Swift {
break;
}
}
+
+ private:
+ AvahiServiceBrowser* browser;
+
};
}
diff --git a/Swiften/LinkLocal/SConscript b/Swiften/LinkLocal/SConscript
index b929db1..3d4d737 100644
--- a/Swiften/LinkLocal/SConscript
+++ b/Swiften/LinkLocal/SConscript
@@ -28,6 +28,7 @@ if myenv.get("HAVE_BONJOUR", 0) :
"DNSSD/Bonjour/BonjourQuery.cpp",
]
elif myenv.get("HAVE_AVAHI", 0) :
+ myenv.Append(CPPDEFINES = ["HAVE_AVAHI"])
sources += [
"DNSSD/Avahi/AvahiQuerier.cpp",
"DNSSD/Avahi/AvahiQuery.cpp"