summaryrefslogtreecommitdiff
path: root/src/core/ngx_connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ngx_connection.c')
-rw-r--r--src/core/ngx_connection.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 03662b398..226dc1ec8 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -37,23 +37,23 @@ ngx_listening_inet_stream_socket(ngx_conf_t *cf, in_addr_t addr, in_port_t port)
ls->addr_text.data = ngx_pnalloc(cf->pool,
- INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1);
+ NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1);
if (ls->addr_text.data == NULL) {
return NULL;
}
- len = ngx_inet_ntop(AF_INET, &addr, ls->addr_text.data, INET_ADDRSTRLEN);
+ len = ngx_inet_ntop(AF_INET, &addr, ls->addr_text.data,
+ NGX_INET_ADDRSTRLEN);
ls->addr_text.len = ngx_sprintf(ls->addr_text.data + len, ":%d", port)
- ls->addr_text.data;
ls->fd = (ngx_socket_t) -1;
- ls->family = AF_INET;
ls->type = SOCK_STREAM;
ls->sockaddr = (struct sockaddr *) sin;
ls->socklen = sizeof(struct sockaddr_in);
ls->addr = offsetof(struct sockaddr_in, sin_addr);
- ls->addr_text_max_len = INET_ADDRSTRLEN;
+ ls->addr_text_max_len = NGX_INET_ADDRSTRLEN;
return ls;
}
@@ -104,17 +104,16 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle)
continue;
}
- ls[i].addr_text_max_len = INET_ADDRSTRLEN;
+ ls[i].addr_text_max_len = NGX_INET_ADDRSTRLEN;
ls[i].addr_text.data = ngx_pnalloc(cycle->pool,
- INET_ADDRSTRLEN - 1 + sizeof(":65535") - 1);
+ NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1);
if (ls[i].addr_text.data == NULL) {
return NGX_ERROR;
}
- ls[i].family = sin->sin_family;
- len = ngx_sock_ntop(ls[i].family, ls[i].sockaddr,
- ls[i].addr_text.data, INET_ADDRSTRLEN);
+ len = ngx_sock_ntop(ls[i].sockaddr, ls[i].addr_text.data,
+ NGX_INET_ADDRSTRLEN);
if (len == 0) {
return NGX_ERROR;
}
@@ -254,7 +253,7 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
continue;
}
- s = ngx_socket(ls[i].family, ls[i].type, 0);
+ s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type, 0);
if (s == -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,