mirror of
https://github.com/nginx/nginx.git
synced 2025-06-08 02:02:38 +08:00
Core: output client port number when logging accept event.
This commit is contained in:
parent
ca02a1020c
commit
056e88ea11
@ -288,9 +288,11 @@ ngx_event_accept(ngx_event_t *ev)
|
|||||||
#if (NGX_DEBUG)
|
#if (NGX_DEBUG)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ngx_str_t addr;
|
||||||
struct sockaddr_in *sin;
|
struct sockaddr_in *sin;
|
||||||
ngx_cidr_t *cidr;
|
ngx_cidr_t *cidr;
|
||||||
ngx_uint_t i;
|
ngx_uint_t i;
|
||||||
|
u_char text[NGX_SOCKADDR_STRLEN];
|
||||||
#if (NGX_HAVE_INET6)
|
#if (NGX_HAVE_INET6)
|
||||||
struct sockaddr_in6 *sin6;
|
struct sockaddr_in6 *sin6;
|
||||||
ngx_uint_t n;
|
ngx_uint_t n;
|
||||||
@ -340,12 +342,18 @@ ngx_event_accept(ngx_event_t *ev)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (log->log_level & NGX_LOG_DEBUG_EVENT) {
|
||||||
|
addr.data = text;
|
||||||
|
addr.len = ngx_sock_ntop(c->sockaddr, c->socklen, text,
|
||||||
|
NGX_SOCKADDR_STRLEN, 1);
|
||||||
|
|
||||||
|
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0,
|
||||||
|
"*%uA accept: %V fd:%d", c->number, &addr, s);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0,
|
|
||||||
"*%uA accept: %V fd:%d", c->number, &c->addr_text, s);
|
|
||||||
|
|
||||||
if (ngx_add_conn && (ngx_event_flags & NGX_USE_EPOLL_EVENT) == 0) {
|
if (ngx_add_conn && (ngx_event_flags & NGX_USE_EPOLL_EVENT) == 0) {
|
||||||
if (ngx_add_conn(c) == NGX_ERROR) {
|
if (ngx_add_conn(c) == NGX_ERROR) {
|
||||||
ngx_close_accepted_connection(c);
|
ngx_close_accepted_connection(c);
|
||||||
|
Loading…
Reference in New Issue
Block a user