Introduce virNetServerClientRemoteAddrStringURI

Use it in virNetServerClientGetInfo to switch back to using
the URI-format (separated by ':') instead of the SASL format
(separated by ';').

Also use it in the error message reported by virNetServerAddClient.
This commit is contained in:
Ján Tomko 2016-06-20 15:51:18 +02:00
parent 2da6a13e5f
commit 23b6559d65
4 changed files with 10 additions and 2 deletions

View File

@ -145,6 +145,7 @@ virNetServerClientNew;
virNetServerClientNewPostExecRestart;
virNetServerClientPreExecRestart;
virNetServerClientRemoteAddrString;
virNetServerClientRemoteAddrStringURI;
virNetServerClientRemoveFilter;
virNetServerClientSendMessage;
virNetServerClientSetAuth;

View File

@ -243,7 +243,7 @@ int virNetServerAddClient(virNetServerPtr srv,
if (srv->nclients >= srv->nclients_max) {
virReportError(VIR_ERR_RPC,
_("Too many active clients (%zu), dropping connection from %s"),
srv->nclients_max, virNetServerClientRemoteAddrString(client));
srv->nclients_max, virNetServerClientRemoteAddrStringURI(client));
goto error;
}

View File

@ -918,6 +918,12 @@ const char *virNetServerClientRemoteAddrString(virNetServerClientPtr client)
return virNetSocketRemoteAddrString(client->sock);
}
const char *virNetServerClientRemoteAddrStringURI(virNetServerClientPtr client)
{
if (!client->sock)
return NULL;
return virNetSocketRemoteAddrStringURI(client->sock);
}
void virNetServerClientDispose(void *obj)
{
@ -1608,7 +1614,7 @@ virNetServerClientGetInfo(virNetServerClientPtr client,
virObjectLock(client);
*readonly = client->readonly;
if (!(*sock_addr = virNetServerClientRemoteAddrString(client))) {
if (!(*sock_addr = virNetServerClientRemoteAddrStringURI(client))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("No network socket associated with client"));
goto cleanup;

View File

@ -140,6 +140,7 @@ int virNetServerClientStartKeepAlive(virNetServerClientPtr client);
const char *virNetServerClientLocalAddrString(virNetServerClientPtr client);
const char *virNetServerClientRemoteAddrString(virNetServerClientPtr client);
const char *virNetServerClientRemoteAddrStringURI(virNetServerClientPtr client);
int virNetServerClientSendMessage(virNetServerClientPtr client,
virNetMessagePtr msg);