odissey: fix getaddrinfo rc check

This commit is contained in:
Dmitry Simonenko 2017-06-20 13:24:51 +03:00
parent 94cd277b68
commit 1ec7527ea4
2 changed files with 7 additions and 3 deletions

View File

@ -274,7 +274,7 @@ od_backend_connect_to(od_server_t *server,
snprintf(port, sizeof(port), "%d", server_scheme->port);
struct addrinfo *ai = NULL;
rc = machine_getaddrinfo(server_scheme->host, port, NULL, &ai, 0);
if (rc == -1) {
if (rc != 0) {
od_error_server(&instance->log, server->id, context,
"failed to resolve %s:%d",
server_scheme->host,

View File

@ -181,7 +181,7 @@ od_pooler_main(od_pooler_t *pooler)
struct addrinfo *ai = NULL;
int rc;
rc = machine_getaddrinfo(host, port, hints_ptr, &ai, UINT32_MAX);
if (rc == -1) {
if (rc != 0) {
od_error(&instance->log, "pooler", "failed to resolve %s:%d",
instance->scheme.host,
instance->scheme.port);
@ -189,7 +189,11 @@ od_pooler_main(od_pooler_t *pooler)
}
pooler->addr = ai;
/* listen on every resolved address */
/* listen resolved addresses */
if (host) {
od_pooler_server_start(pooler, ai);
return;
}
while (ai) {
od_pooler_server_start(pooler, ai);
ai = ai->ai_next;