comparison src/mail/ngx_mail_handler.c @ 6130:fc99323a3d79

Mail: error_log support.
author Vladimir Homutov <vl@nginx.com>
date Fri, 20 Feb 2015 15:31:37 +0300
parents ec01b1d1fff1
children bcb107bb89cd
comparison
equal deleted inserted replaced
6129:187aa751ad62 6130:fc99323a3d79
22 22
23 23
24 void 24 void
25 ngx_mail_init_connection(ngx_connection_t *c) 25 ngx_mail_init_connection(ngx_connection_t *c)
26 { 26 {
27 size_t len; 27 size_t len;
28 ngx_uint_t i; 28 ngx_uint_t i;
29 ngx_mail_port_t *port; 29 ngx_mail_port_t *port;
30 struct sockaddr *sa; 30 struct sockaddr *sa;
31 struct sockaddr_in *sin; 31 struct sockaddr_in *sin;
32 ngx_mail_log_ctx_t *ctx; 32 ngx_mail_log_ctx_t *ctx;
33 ngx_mail_in_addr_t *addr; 33 ngx_mail_in_addr_t *addr;
34 ngx_mail_session_t *s; 34 ngx_mail_session_t *s;
35 ngx_mail_addr_conf_t *addr_conf; 35 ngx_mail_addr_conf_t *addr_conf;
36 u_char text[NGX_SOCKADDR_STRLEN]; 36 ngx_mail_core_srv_conf_t *cscf;
37 u_char text[NGX_SOCKADDR_STRLEN];
37 #if (NGX_HAVE_INET6) 38 #if (NGX_HAVE_INET6)
38 struct sockaddr_in6 *sin6; 39 struct sockaddr_in6 *sin6;
39 ngx_mail_in6_addr_t *addr6; 40 ngx_mail_in6_addr_t *addr6;
40 #endif 41 #endif
41 42
42 43
43 /* find the server configuration for the address:port */ 44 /* find the server configuration for the address:port */
44 45
131 s->addr_text = &addr_conf->addr_text; 132 s->addr_text = &addr_conf->addr_text;
132 133
133 c->data = s; 134 c->data = s;
134 s->connection = c; 135 s->connection = c;
135 136
137 cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
138
139 ngx_set_connection_log(c, cscf->error_log);
140
136 len = ngx_sock_ntop(c->sockaddr, c->socklen, text, NGX_SOCKADDR_STRLEN, 1); 141 len = ngx_sock_ntop(c->sockaddr, c->socklen, text, NGX_SOCKADDR_STRLEN, 1);
137 142
138 ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%uA client %*s connected to %V", 143 ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%uA client %*s connected to %V",
139 c->number, len, text, s->addr_text); 144 c->number, len, text, s->addr_text);
140 145