本文整理汇总了C++中Browser::remove_service方法的典型用法代码示例。如果您正苦于以下问题:C++ Browser::remove_service方法的具体用法?C++ Browser::remove_service怎么用?C++ Browser::remove_service使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browser
的用法示例。
在下文中一共展示了Browser::remove_service方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: browse_callback
void Browser::browse_callback(AvahiServiceBrowser *b,
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiBrowserEvent event,
const char *name,
const char *type,
const char *domain,
AvahiLookupResultFlags,
void* data)
{
assert(b);
AvahiClient *client = avahi_service_browser_get_client(b);
assert(data);
Browser *browser = static_cast<Browser *>(data);
switch (event) {
case AVAHI_BROWSER_FAILURE:
cerr << "[Browser] " << avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b))) << endl;
throw BrowserError(avahi_client_errno(client));
//a->Stop();
return;
case AVAHI_BROWSER_NEW:
//cerr << "[Browser] New service '" << name << "' of type '" << type << "' in domain '" << domain << "'" << endl;
if (!(avahi_service_resolver_new(client, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC,
(AvahiLookupFlags)0, resolve_callback, browser)))
cerr << "Failed to resolve service '" << name << "': " << avahi_strerror(avahi_client_errno(client)) << endl;
break;
case AVAHI_BROWSER_REMOVE:
//cerr << "[Browser] Removed service " << name << " of type " << type << " in domain " << domain << endl;
// XXX Remove cached service, broadcast
browser->remove_service(name);
break;
case AVAHI_BROWSER_ALL_FOR_NOW:
//cerr << "[Browser] All for now." << endl;
break;
case AVAHI_BROWSER_CACHE_EXHAUSTED:
//cerr << "[Browser] Cache exhausted." << endl;
break;
}
}