Skip to content
Browse files

fixed the compatiable problem with nginx-1.5.3

Signed-off-by: paulyang <y_y@neusoft.com>
  • Loading branch information...
1 parent 4c76e4f commit 534c5beafa307fcee0601bb3f8f0a46b7fcca8c0 paulyang committed
Showing with 12 additions and 0 deletions.
  1. +8 −0 ngx_tcp.c
  2. +4 −0 ngx_tcp_core_module.c
View
8 ngx_tcp.c
@@ -473,7 +473,11 @@ ngx_tcp_add_addrs(ngx_conf_t *cf, ngx_tcp_port_t *mport,
addrs[i].conf.ssl = addr[i].ssl;
#endif
+#if defined(nginx_version) && nginx_version >= 1005003
+ len = ngx_sock_ntop(addr[i].sockaddr, addr[i].socklen, buf, NGX_SOCKADDR_STRLEN, 1);
+#else
len = ngx_sock_ntop(addr[i].sockaddr, buf, NGX_SOCKADDR_STRLEN, 1);
+#endif
p = ngx_pnalloc(cf->pool, len);
if (p == NULL) {
@@ -531,7 +535,11 @@ ngx_tcp_add_addrs6(ngx_conf_t *cf, ngx_tcp_port_t *mport,
addrs6[i].conf.ssl = addr[i].ssl;
#endif
+#if defined(nginx_version) && nginx_version >= 1005003
+ len = ngx_sock_ntop(addr[i].sockaddr, addr[i].socklen, buf, NGX_SOCKADDR_STRLEN, 1);
+#else
len = ngx_sock_ntop(addr[i].sockaddr, buf, NGX_SOCKADDR_STRLEN, 1);
+#endif
p = ngx_pnalloc(cf->pool, len);
if (p == NULL) {
View
4 ngx_tcp_core_module.c
@@ -545,7 +545,11 @@ ngx_tcp_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ls->bind = 1;
} else {
+#if defined(nginx_version) && nginx_version >= 1005003
+ len = ngx_sock_ntop(sa, ls->socklen, buf, NGX_SOCKADDR_STRLEN, 1);
+#else
len = ngx_sock_ntop(sa, buf, NGX_SOCKADDR_STRLEN, 1);
+#endif
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"ipv6only is not supported "

0 comments on commit 534c5be

Please sign in to comment.
Something went wrong with that request. Please try again.