forked from jbagg/QtZeroConf
Add optional parameter for binding service to specific interface
Forgot Linux
This commit is contained in:
@ -226,16 +226,19 @@ QZeroConf::~QZeroConf()
|
||||
delete pri;
|
||||
}
|
||||
|
||||
void QZeroConf::startServicePublish(const char *name, const char *type, const char *domain, quint16 port)
|
||||
void QZeroConf::startServicePublish(const char *name, const char *type, const char *domain, quint16 port, quint32 interface)
|
||||
{
|
||||
if (pri->group) {
|
||||
emit error(QZeroConf::serviceRegistrationFailed);
|
||||
return;
|
||||
}
|
||||
if (interface <= 0) {
|
||||
interface = AVAHI_IF_UNSPEC;
|
||||
}
|
||||
|
||||
pri->group = avahi_entry_group_new(pri->client, QZeroConfPrivate::groupCallback, pri);
|
||||
|
||||
int ret = avahi_entry_group_add_service_strlst(pri->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_UPDATE, name, type, domain, NULL, port, pri->txt);
|
||||
int ret = avahi_entry_group_add_service_strlst(pri->group, interface, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_UPDATE, name, type, domain, NULL, port, pri->txt);
|
||||
if (ret < 0) {
|
||||
avahi_entry_group_free(pri->group);
|
||||
pri->group = NULL;
|
||||
|
Reference in New Issue
Block a user