comparison src/stream/ngx_stream_handler.c @ 6461:a01e315b3a78

Stream: additional logging for UDP.
author Vladimir Homutov <vl@nginx.com>
date Fri, 18 Mar 2016 19:53:22 +0300
parents 8f038068f4bc
children c70b7f4537e1
comparison
equal deleted inserted replaced
6460:034329824dd3 6461:a01e315b3a78
135 135
136 ngx_set_connection_log(c, cscf->error_log); 136 ngx_set_connection_log(c, cscf->error_log);
137 137
138 len = ngx_sock_ntop(c->sockaddr, c->socklen, text, NGX_SOCKADDR_STRLEN, 1); 138 len = ngx_sock_ntop(c->sockaddr, c->socklen, text, NGX_SOCKADDR_STRLEN, 1);
139 139
140 ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%uA client %*s connected to %V", 140 ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%uA %sclient %*s connected to %V",
141 c->number, len, text, &addr_conf->addr_text); 141 c->number, c->type == SOCK_DGRAM ? "udp " : "",
142 len, text, &addr_conf->addr_text);
142 143
143 c->log->connection = c->number; 144 c->log->connection = c->number;
144 c->log->handler = ngx_stream_log_error; 145 c->log->handler = ngx_stream_log_error;
145 c->log->data = s; 146 c->log->data = s;
146 c->log->action = "initializing connection"; 147 c->log->action = "initializing connection";
326 buf = p; 327 buf = p;
327 } 328 }
328 329
329 s = log->data; 330 s = log->data;
330 331
331 p = ngx_snprintf(buf, len, ", client: %V, server: %V", 332 p = ngx_snprintf(buf, len, ", %sclient: %V, server: %V",
333 s->connection->type == SOCK_DGRAM ? "udp " : "",
332 &s->connection->addr_text, 334 &s->connection->addr_text,
333 &s->connection->listening->addr_text); 335 &s->connection->listening->addr_text);
334 len -= p - buf; 336 len -= p - buf;
335 buf = p; 337 buf = p;
336 338