/* * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include #include namespace Swift { BonjourQuery::BonjourQuery(boost::shared_ptr q, EventLoop* eventLoop) : eventLoop(eventLoop), querier(q), sdRef(0) { } BonjourQuery::~BonjourQuery() { DNSServiceRefDeallocate(sdRef); } void BonjourQuery::processResult() { boost::lock_guard lock(sdRefMutex); DNSServiceProcessResult(sdRef); } int BonjourQuery::getSocketID() const { boost::lock_guard lock(sdRefMutex); return DNSServiceRefSockFD(sdRef); } void BonjourQuery::run() { querier->addRunningQuery(shared_from_this()); } void BonjourQuery::finish() { querier->removeRunningQuery(shared_from_this()); } }