@@ -33,7 +33,7 @@ typedef ngx_peer_addr_t ngx_statsd_addr_t;
3333
3434typedef struct {
3535 ngx_statsd_addr_t peer_addr ;
36- ngx_udp_connection_t * udp_connection ;
36+ ngx_resolver_connection_t * udp_connection ;
3737 ngx_log_t * log ;
3838} ngx_udp_endpoint_t ;
3939
@@ -60,7 +60,7 @@ typedef struct {
6060 ngx_array_t * stats ;
6161} ngx_http_statsd_conf_t ;
6262
63- ngx_int_t ngx_udp_connect (ngx_udp_connection_t * uc );
63+ ngx_int_t ngx_udp_connect (ngx_resolver_connection_t * rec );
6464
6565static void ngx_statsd_updater_cleanup (void * data );
6666static ngx_int_t ngx_http_statsd_udp_send (ngx_udp_endpoint_t * l , u_char * buf , size_t len );
@@ -300,7 +300,7 @@ ngx_http_statsd_handler(ngx_http_request_t *r)
300300
301301static ngx_int_t ngx_statsd_init_endpoint (ngx_conf_t * cf , ngx_udp_endpoint_t * endpoint ) {
302302 ngx_pool_cleanup_t * cln ;
303- ngx_udp_connection_t * uc ;
303+ ngx_resolver_connection_t * rec ;
304304
305305 ngx_log_debug0 (NGX_LOG_DEBUG_HTTP , cf -> log , 0 ,
306306 "statsd: initting endpoint" );
@@ -313,16 +313,16 @@ static ngx_int_t ngx_statsd_init_endpoint(ngx_conf_t *cf, ngx_udp_endpoint_t *en
313313 cln -> handler = ngx_statsd_updater_cleanup ;
314314 cln -> data = endpoint ;
315315
316- uc = ngx_calloc (sizeof (ngx_udp_connection_t ), cf -> log );
317- if (uc == NULL ) {
316+ rec = ngx_calloc (sizeof (ngx_resolver_connection_t ), cf -> log );
317+ if (rec == NULL ) {
318318 return NGX_ERROR ;
319319 }
320320
321- endpoint -> udp_connection = uc ;
321+ endpoint -> udp_connection = rec ;
322322
323- uc -> sockaddr = endpoint -> peer_addr .sockaddr ;
324- uc -> socklen = endpoint -> peer_addr .socklen ;
325- uc -> server = endpoint -> peer_addr .name ;
323+ rec -> sockaddr = endpoint -> peer_addr .sockaddr ;
324+ rec -> socklen = endpoint -> peer_addr .socklen ;
325+ rec -> server = endpoint -> peer_addr .name ;
326326
327327 endpoint -> log = & cf -> cycle -> new_log ;
328328
@@ -338,8 +338,8 @@ ngx_statsd_updater_cleanup(void *data)
338338 "cleanup statsd_updater" );
339339
340340 if (e -> udp_connection ) {
341- if (e -> udp_connection -> connection ) {
342- ngx_close_connection (e -> udp_connection -> connection );
341+ if (e -> udp_connection -> udp ) {
342+ ngx_close_connection (e -> udp_connection -> udp );
343343 }
344344
345345 ngx_free (e -> udp_connection );
@@ -354,41 +354,41 @@ static ngx_int_t
354354ngx_http_statsd_udp_send (ngx_udp_endpoint_t * l , u_char * buf , size_t len )
355355{
356356 ssize_t n ;
357- ngx_udp_connection_t * uc ;
357+ ngx_resolver_connection_t * rec ;
358358
359- uc = l -> udp_connection ;
360- if (uc -> connection == NULL ) {
359+ rec = l -> udp_connection ;
360+ if (rec -> udp == NULL ) {
361361
362- uc -> log = * l -> log ;
363- uc -> log .handler = NULL ;
364- uc -> log .data = NULL ;
365- uc -> log .action = "logging" ;
362+ rec -> log = * l -> log ;
363+ rec -> log .handler = NULL ;
364+ rec -> log .data = NULL ;
365+ rec -> log .action = "logging" ;
366366
367- if (ngx_udp_connect (uc ) != NGX_OK ) {
368- if (uc -> connection != NULL ) {
369- ngx_free_connection (uc -> connection );
370- uc -> connection = NULL ;
367+ if (ngx_udp_connect (rec ) != NGX_OK ) {
368+ if (rec -> udp != NULL ) {
369+ ngx_free_connection (rec -> udp );
370+ rec -> udp = NULL ;
371371 }
372372
373373 return NGX_ERROR ;
374374 }
375375
376- uc -> connection -> data = l ;
377- uc -> connection -> read -> handler = ngx_http_statsd_udp_dummy_handler ;
378- uc -> connection -> read -> resolver = 0 ;
376+ rec -> udp -> data = l ;
377+ rec -> udp -> read -> handler = ngx_http_statsd_udp_dummy_handler ;
378+ rec -> udp -> read -> resolver = 0 ;
379379 }
380380
381- n = ngx_send (uc -> connection , buf , len );
381+ n = ngx_send (rec -> udp , buf , len );
382382
383383 if (n == -1 ) {
384384 return NGX_ERROR ;
385385 }
386386
387387 if ((size_t ) n != (size_t ) len ) {
388388#if defined nginx_version && nginx_version >= 8032
389- ngx_log_error (NGX_LOG_CRIT , & uc -> log , 0 , "send() incomplete" );
389+ ngx_log_error (NGX_LOG_CRIT , & rec -> log , 0 , "send() incomplete" );
390390#else
391- ngx_log_error (NGX_LOG_CRIT , uc -> log , 0 , "send() incomplete" );
391+ ngx_log_error (NGX_LOG_CRIT , rec -> log , 0 , "send() incomplete" );
392392#endif
393393 return NGX_ERROR ;
394394 }
0 commit comments