mirror of https://github.com/yandex/odyssey.git
odissey: fix getaddrinfo rc check
This commit is contained in:
parent
94cd277b68
commit
1ec7527ea4
|
@ -274,7 +274,7 @@ od_backend_connect_to(od_server_t *server,
|
||||||
snprintf(port, sizeof(port), "%d", server_scheme->port);
|
snprintf(port, sizeof(port), "%d", server_scheme->port);
|
||||||
struct addrinfo *ai = NULL;
|
struct addrinfo *ai = NULL;
|
||||||
rc = machine_getaddrinfo(server_scheme->host, port, NULL, &ai, 0);
|
rc = machine_getaddrinfo(server_scheme->host, port, NULL, &ai, 0);
|
||||||
if (rc == -1) {
|
if (rc != 0) {
|
||||||
od_error_server(&instance->log, server->id, context,
|
od_error_server(&instance->log, server->id, context,
|
||||||
"failed to resolve %s:%d",
|
"failed to resolve %s:%d",
|
||||||
server_scheme->host,
|
server_scheme->host,
|
||||||
|
|
|
@ -181,7 +181,7 @@ od_pooler_main(od_pooler_t *pooler)
|
||||||
struct addrinfo *ai = NULL;
|
struct addrinfo *ai = NULL;
|
||||||
int rc;
|
int rc;
|
||||||
rc = machine_getaddrinfo(host, port, hints_ptr, &ai, UINT32_MAX);
|
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",
|
od_error(&instance->log, "pooler", "failed to resolve %s:%d",
|
||||||
instance->scheme.host,
|
instance->scheme.host,
|
||||||
instance->scheme.port);
|
instance->scheme.port);
|
||||||
|
@ -189,7 +189,11 @@ od_pooler_main(od_pooler_t *pooler)
|
||||||
}
|
}
|
||||||
pooler->addr = ai;
|
pooler->addr = ai;
|
||||||
|
|
||||||
/* listen on every resolved address */
|
/* listen resolved addresses */
|
||||||
|
if (host) {
|
||||||
|
od_pooler_server_start(pooler, ai);
|
||||||
|
return;
|
||||||
|
}
|
||||||
while (ai) {
|
while (ai) {
|
||||||
od_pooler_server_start(pooler, ai);
|
od_pooler_server_start(pooler, ai);
|
||||||
ai = ai->ai_next;
|
ai = ai->ai_next;
|
||||||
|
|
Loading…
Reference in New Issue