summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-25 09:37:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-25 09:37:42 (GMT)
commit0f77a684b42f25052eb1cfa688721e321526a90d (patch)
tree226c07deff7a663f8aefdfc8814e9ecd04085999 /Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp
parentb33a2937fe4a3cae0017892ad7f5c27b8a6f976d (diff)
downloadswift-0f77a684b42f25052eb1cfa688721e321526a90d.zip
swift-0f77a684b42f25052eb1cfa688721e321526a90d.tar.bz2
Created DNSSD submodule for LinkLocal.
Diffstat (limited to 'Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp')
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp
new file mode 100644
index 0000000..c1c481b
--- /dev/null
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp
@@ -0,0 +1,31 @@
+#include "Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h"
+#include "Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h"
+
+namespace Swift {
+
+BonjourQuery::BonjourQuery(boost::shared_ptr<BonjourQuerier> q) : querier(q), sdRef(0) {
+}
+
+BonjourQuery::~BonjourQuery() {
+ DNSServiceRefDeallocate(sdRef);
+}
+
+void BonjourQuery::processResult() {
+ boost::lock_guard<boost::mutex> lock(sdRefMutex);
+ DNSServiceProcessResult(sdRef);
+}
+
+int BonjourQuery::getSocketID() const {
+ boost::lock_guard<boost::mutex> lock(sdRefMutex);
+ return DNSServiceRefSockFD(sdRef);
+}
+
+void BonjourQuery::run() {
+ querier->addRunningQuery(shared_from_this());
+}
+
+void BonjourQuery::finish() {
+ querier->removeRunningQuery(shared_from_this());
+}
+
+}