mirror of https://github.com/yandex/odyssey.git
odissey: support listen host '*'
This commit is contained in:
parent
64011392e4
commit
976f677d7f
|
@ -89,12 +89,29 @@ od_pooler(void *arg)
|
|||
if (rc == -1)
|
||||
return;
|
||||
|
||||
/* listen '*' */
|
||||
struct addrinfo *hints_ptr = NULL;
|
||||
struct addrinfo hints;
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
hints.ai_protocol = 0;
|
||||
hints.ai_canonname = NULL;
|
||||
hints.ai_addr = NULL;
|
||||
hints.ai_next = NULL;
|
||||
char *host = env->scheme.host;
|
||||
if (strcmp(env->scheme.host, "*") == 0) {
|
||||
hints_ptr = &hints;
|
||||
host = NULL;
|
||||
}
|
||||
|
||||
/* resolve listen address and port */
|
||||
char port[16];
|
||||
snprintf(port, sizeof(port), "%d", env->scheme.port);
|
||||
struct addrinfo *ai = NULL;
|
||||
rc = machine_getaddrinfo(pooler->server,
|
||||
env->scheme.host, port, NULL, &ai, 0);
|
||||
rc = machine_getaddrinfo(pooler->server, host, port,
|
||||
hints_ptr, &ai, 0);
|
||||
if (rc < 0) {
|
||||
od_error(&env->log, NULL, "failed to resolve %s:%d",
|
||||
env->scheme.host,
|
||||
|
|
|
@ -206,7 +206,7 @@ int od_schemevalidate(od_scheme_t *scheme, od_log_t *log)
|
|||
|
||||
/* listen */
|
||||
if (scheme->host == NULL)
|
||||
scheme->host = "127.0.0.1";
|
||||
scheme->host = "*";
|
||||
|
||||
/* tls */
|
||||
if (scheme->tls_mode) {
|
||||
|
|
|
@ -13,15 +13,15 @@ odissey {
|
|||
pooling "transaction"
|
||||
|
||||
listen {
|
||||
host "localhost"
|
||||
host "*"
|
||||
port 6432
|
||||
nodelay yes
|
||||
# backlog 16
|
||||
# keepalive 7200
|
||||
tls_mode "disable"
|
||||
# tls_ca_file ""
|
||||
# tls_key_file ""
|
||||
# tls_cert_file ""
|
||||
# tls_key_file ""
|
||||
# tls_ca_file ""
|
||||
# tls_protocols ""
|
||||
workers 8
|
||||
client_max 100
|
||||
|
|
Loading…
Reference in New Issue