diff options
Diffstat (limited to 'Swiften/LinkLocal/BonjourQuery.cpp')
-rw-r--r-- | Swiften/LinkLocal/BonjourQuery.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Swiften/LinkLocal/BonjourQuery.cpp b/Swiften/LinkLocal/BonjourQuery.cpp new file mode 100644 index 0000000..a9c13fb --- /dev/null +++ b/Swiften/LinkLocal/BonjourQuery.cpp @@ -0,0 +1,31 @@ +#include "Swiften/LinkLocal/BonjourQuery.h" +#include "Swiften/LinkLocal/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()); +} + +} |