mirror of https://github.com/yandex/odyssey.git
odissey: exit on signal; minor fixes
This commit is contained in:
parent
1c55e37dcb
commit
e53b391e0f
|
@ -1 +1 @@
|
|||
Subproject commit d5ac45b6513e006b5da362b5dfa32d2608cf166d
|
||||
Subproject commit b1f2b5545f2809d81cccbc5a7a25503d6d3b1a0a
|
|
@ -232,7 +232,7 @@ od_backend_connect(od_server_t *server)
|
|||
struct addrinfo *ai = NULL;
|
||||
int rc;
|
||||
rc = machine_getaddrinfo(server_scheme->host, port, NULL, &ai, 0);
|
||||
if (rc < 0) {
|
||||
if (rc == -1) {
|
||||
od_error_server(&instance->log, server->id, NULL,
|
||||
"failed to resolve %s:%d",
|
||||
server_scheme->host,
|
||||
|
@ -244,7 +244,7 @@ od_backend_connect(od_server_t *server)
|
|||
/* connect to server */
|
||||
rc = machine_connect(server->io, ai->ai_addr, UINT32_MAX);
|
||||
freeaddrinfo(ai);
|
||||
if (rc < 0) {
|
||||
if (rc == -1) {
|
||||
od_error_server(&instance->log, server->id, NULL,
|
||||
"failed to connect to %s:%d",
|
||||
server_scheme->host,
|
||||
|
@ -461,7 +461,7 @@ int od_backend_reset(od_server_t *server)
|
|||
wait_try_cancel);
|
||||
wait_try_cancel++;
|
||||
rc = od_cancel(instance, route->scheme->server, &server->key, server->id);
|
||||
if (rc < 0)
|
||||
if (rc == -1)
|
||||
goto error;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ int od_cancel(od_instance_t *instance,
|
|||
struct addrinfo *ai = NULL;
|
||||
int rc;
|
||||
rc = machine_getaddrinfo(server_scheme->host, port, NULL, &ai, 0);
|
||||
if (rc < 0) {
|
||||
if (rc == -1) {
|
||||
od_error_server(&instance->log, 0, "cancel", "failed to resolve %s:%d",
|
||||
server_scheme->host,
|
||||
server_scheme->port);
|
||||
|
@ -91,7 +91,7 @@ int od_cancel(od_instance_t *instance,
|
|||
/* connect to server */
|
||||
rc = machine_connect(server.io, ai->ai_addr, UINT32_MAX);
|
||||
freeaddrinfo(ai);
|
||||
if (rc < 0) {
|
||||
if (rc == -1) {
|
||||
od_error_server(&instance->log, 0, "cancel",
|
||||
"failed to connect to %s:%d",
|
||||
server_scheme->host,
|
||||
|
|
|
@ -102,7 +102,7 @@ od_frontend_startup_read(od_client_t *client)
|
|||
if (rc == -1)
|
||||
return -1;
|
||||
rc = machine_read(client->io, (char*)stream->p, to_read, UINT32_MAX);
|
||||
if (rc < 0) {
|
||||
if (rc == -1) {
|
||||
od_error_client(&instance->log, client->id, "startup",
|
||||
"read error: %s",
|
||||
machine_error(client->io));
|
||||
|
|
|
@ -42,7 +42,7 @@ int od_read(machine_io_t *io, so_stream_t *stream, int time_ms)
|
|||
if (rc == -1)
|
||||
return -1;
|
||||
rc = machine_read(io, (char*)stream->p, to_read, time_ms);
|
||||
if (rc < 0)
|
||||
if (rc == -1)
|
||||
return -1;
|
||||
so_stream_advance(stream, to_read);
|
||||
request_size += to_read;
|
||||
|
@ -53,12 +53,9 @@ int od_read(machine_io_t *io, so_stream_t *stream, int time_ms)
|
|||
int od_write(machine_io_t *io, so_stream_t *stream)
|
||||
{
|
||||
int rc;
|
||||
rc = machine_write(io, (char*)stream->s,
|
||||
so_stream_used(stream),
|
||||
rc = machine_write(io, (char*)stream->s, so_stream_used(stream),
|
||||
UINT32_MAX);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int od_getpeername(machine_io_t *io, char *buf, int size)
|
||||
|
|
|
@ -79,7 +79,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 < 0) {
|
||||
if (rc == -1) {
|
||||
od_error(&instance->log, "failed to resolve %s:%d",
|
||||
instance->scheme.host,
|
||||
instance->scheme.port);
|
||||
|
@ -97,7 +97,7 @@ od_pooler_main(od_pooler_t *pooler)
|
|||
/* bind to listen address and port */
|
||||
rc = machine_bind(pooler->server, ai->ai_addr);
|
||||
freeaddrinfo(ai);
|
||||
if (rc < 0) {
|
||||
if (rc == -1) {
|
||||
od_error(&instance->log, "bind %s:%d failed",
|
||||
instance->scheme.host,
|
||||
instance->scheme.port);
|
||||
|
@ -116,7 +116,7 @@ od_pooler_main(od_pooler_t *pooler)
|
|||
machine_io_t *client_io;
|
||||
rc = machine_accept(pooler->server, &client_io,
|
||||
instance->scheme.backlog, UINT32_MAX);
|
||||
if (rc < 0) {
|
||||
if (rc == -1) {
|
||||
od_error(&instance->log, "pooler: accept failed");
|
||||
continue;
|
||||
}
|
||||
|
@ -171,7 +171,6 @@ od_signalizer(void *arg)
|
|||
sigset_t mask;
|
||||
sigemptyset(&mask);
|
||||
sigaddset(&mask, SIGINT);
|
||||
|
||||
int rc;
|
||||
rc = machine_signal_init(&mask);
|
||||
if (rc == -1) {
|
||||
|
@ -187,6 +186,7 @@ od_signalizer(void *arg)
|
|||
switch (rc) {
|
||||
case SIGINT:
|
||||
od_log(&instance->log, "pooler: SIGINT");
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ od_router_attacher(void *arg)
|
|||
|
||||
int rc;
|
||||
rc = machine_condition(route->scheme->pool_timeout);
|
||||
if (rc < 0) {
|
||||
if (rc == -1) {
|
||||
od_clientpool_set(&route->client_pool, client, OD_CPENDING);
|
||||
od_debug_client(&instance->log, client->id, "router",
|
||||
"server pool wait timedout, closing");
|
||||
|
|
|
@ -205,7 +205,7 @@ od_tls_backend_connect(od_server_t *server,
|
|||
/* read server reply */
|
||||
so_stream_reset(stream);
|
||||
rc = machine_read(server->io, (char*)stream->p, 1, UINT32_MAX);
|
||||
if (rc < 0) {
|
||||
if (rc == -1) {
|
||||
od_error_server(log, server->id, "tls", "read error: %s",
|
||||
machine_error(server->io));
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue