mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
build: drop conditional use of mdns code
Commit 1f6f723
missed a step. At first I was worried that scrubbing
the conditionals would lead to a runtime failure when compiled without
avahi, but my testing makes it appear that the runtime error will only
occur if the .conf files in /etc request mdns advertisement; and the
old behavior was to silently ignore the request, so this is actually
a better behavior of only failing when the config requests the
impossible.
* src/rpc/virnetserver.c: Drop HAVE_AVAHI conditionals; all
callers already passed NULL if mdns_adv was not configured.
This commit is contained in:
parent
addeb7cd05
commit
1d5bc38220
@ -36,9 +36,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "virfile.h"
|
#include "virfile.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#if HAVE_AVAHI
|
#include "virnetservermdns.h"
|
||||||
# include "virnetservermdns.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SA_SIGINFO
|
#ifndef SA_SIGINFO
|
||||||
# define SA_SIGINFO 0
|
# define SA_SIGINFO 0
|
||||||
@ -81,10 +79,8 @@ struct _virNetServer {
|
|||||||
int sigwatch;
|
int sigwatch;
|
||||||
|
|
||||||
char *mdnsGroupName;
|
char *mdnsGroupName;
|
||||||
#if HAVE_AVAHI
|
|
||||||
virNetServerMDNSPtr mdns;
|
virNetServerMDNSPtr mdns;
|
||||||
virNetServerMDNSGroupPtr mdnsGroup;
|
virNetServerMDNSGroupPtr mdnsGroup;
|
||||||
#endif
|
|
||||||
|
|
||||||
size_t nservices;
|
size_t nservices;
|
||||||
virNetServerServicePtr *services;
|
virNetServerServicePtr *services;
|
||||||
@ -364,7 +360,6 @@ virNetServerPtr virNetServerNew(size_t min_workers,
|
|||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#if HAVE_AVAHI
|
|
||||||
if (srv->mdnsGroupName) {
|
if (srv->mdnsGroupName) {
|
||||||
if (!(srv->mdns = virNetServerMDNSNew()))
|
if (!(srv->mdns = virNetServerMDNSNew()))
|
||||||
goto error;
|
goto error;
|
||||||
@ -372,7 +367,6 @@ virNetServerPtr virNetServerNew(size_t min_workers,
|
|||||||
srv->mdnsGroupName)))
|
srv->mdnsGroupName)))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (virMutexInit(&srv->lock) < 0) {
|
if (virMutexInit(&srv->lock) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
@ -592,14 +586,13 @@ error:
|
|||||||
|
|
||||||
int virNetServerAddService(virNetServerPtr srv,
|
int virNetServerAddService(virNetServerPtr srv,
|
||||||
virNetServerServicePtr svc,
|
virNetServerServicePtr svc,
|
||||||
const char *mdnsEntryName ATTRIBUTE_UNUSED)
|
const char *mdnsEntryName)
|
||||||
{
|
{
|
||||||
virNetServerLock(srv);
|
virNetServerLock(srv);
|
||||||
|
|
||||||
if (VIR_EXPAND_N(srv->services, srv->nservices, 1) < 0)
|
if (VIR_EXPAND_N(srv->services, srv->nservices, 1) < 0)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
#if HAVE_AVAHI
|
|
||||||
if (mdnsEntryName) {
|
if (mdnsEntryName) {
|
||||||
int port = virNetServerServiceGetPort(svc);
|
int port = virNetServerServiceGetPort(svc);
|
||||||
|
|
||||||
@ -608,7 +601,6 @@ int virNetServerAddService(virNetServerPtr srv,
|
|||||||
port))
|
port))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
srv->services[srv->nservices-1] = svc;
|
srv->services[srv->nservices-1] = svc;
|
||||||
virNetServerServiceRef(svc);
|
virNetServerServiceRef(svc);
|
||||||
@ -622,9 +614,7 @@ int virNetServerAddService(virNetServerPtr srv,
|
|||||||
|
|
||||||
no_memory:
|
no_memory:
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
#if HAVE_AVAHI
|
|
||||||
error:
|
error:
|
||||||
#endif
|
|
||||||
virNetServerUnlock(srv);
|
virNetServerUnlock(srv);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -694,11 +684,9 @@ void virNetServerRun(virNetServerPtr srv)
|
|||||||
|
|
||||||
virNetServerLock(srv);
|
virNetServerLock(srv);
|
||||||
|
|
||||||
#if HAVE_AVAHI
|
|
||||||
if (srv->mdns &&
|
if (srv->mdns &&
|
||||||
virNetServerMDNSStart(srv->mdns) < 0)
|
virNetServerMDNSStart(srv->mdns) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
#endif
|
|
||||||
|
|
||||||
srv->quit = 0;
|
srv->quit = 0;
|
||||||
|
|
||||||
@ -826,9 +814,7 @@ void virNetServerFree(virNetServerPtr srv)
|
|||||||
VIR_FREE(srv->clients);
|
VIR_FREE(srv->clients);
|
||||||
|
|
||||||
VIR_FREE(srv->mdnsGroupName);
|
VIR_FREE(srv->mdnsGroupName);
|
||||||
#if HAVE_AVAHI
|
|
||||||
virNetServerMDNSFree(srv->mdns);
|
virNetServerMDNSFree(srv->mdns);
|
||||||
#endif
|
|
||||||
|
|
||||||
virMutexDestroy(&srv->lock);
|
virMutexDestroy(&srv->lock);
|
||||||
VIR_FREE(srv);
|
VIR_FREE(srv);
|
||||||
|
Loading…
Reference in New Issue
Block a user