@@ -33,7 +33,7 @@ typedef ngx_peer_addr_t ngx_statsd_addr_t;
33
33
34
34
typedef struct {
35
35
ngx_statsd_addr_t peer_addr ;
36
- ngx_udp_connection_t * udp_connection ;
36
+ ngx_resolver_connection_t * udp_connection ;
37
37
ngx_log_t * log ;
38
38
} ngx_udp_endpoint_t ;
39
39
@@ -60,7 +60,7 @@ typedef struct {
60
60
ngx_array_t * stats ;
61
61
} ngx_http_statsd_conf_t ;
62
62
63
- ngx_int_t ngx_udp_connect (ngx_udp_connection_t * uc );
63
+ ngx_int_t ngx_udp_connect (ngx_resolver_connection_t * rec );
64
64
65
65
static void ngx_statsd_updater_cleanup (void * data );
66
66
static 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)
300
300
301
301
static ngx_int_t ngx_statsd_init_endpoint (ngx_conf_t * cf , ngx_udp_endpoint_t * endpoint ) {
302
302
ngx_pool_cleanup_t * cln ;
303
- ngx_udp_connection_t * uc ;
303
+ ngx_resolver_connection_t * rec ;
304
304
305
305
ngx_log_debug0 (NGX_LOG_DEBUG_HTTP , cf -> log , 0 ,
306
306
"statsd: initting endpoint" );
@@ -313,16 +313,16 @@ static ngx_int_t ngx_statsd_init_endpoint(ngx_conf_t *cf, ngx_udp_endpoint_t *en
313
313
cln -> handler = ngx_statsd_updater_cleanup ;
314
314
cln -> data = endpoint ;
315
315
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 ) {
318
318
return NGX_ERROR ;
319
319
}
320
320
321
- endpoint -> udp_connection = uc ;
321
+ endpoint -> udp_connection = rec ;
322
322
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 ;
326
326
327
327
endpoint -> log = & cf -> cycle -> new_log ;
328
328
@@ -338,8 +338,8 @@ ngx_statsd_updater_cleanup(void *data)
338
338
"cleanup statsd_updater" );
339
339
340
340
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 );
343
343
}
344
344
345
345
ngx_free (e -> udp_connection );
@@ -354,41 +354,41 @@ static ngx_int_t
354
354
ngx_http_statsd_udp_send (ngx_udp_endpoint_t * l , u_char * buf , size_t len )
355
355
{
356
356
ssize_t n ;
357
- ngx_udp_connection_t * uc ;
357
+ ngx_resolver_connection_t * rec ;
358
358
359
- uc = l -> udp_connection ;
360
- if (uc -> connection == NULL ) {
359
+ rec = l -> udp_connection ;
360
+ if (rec -> udp == NULL ) {
361
361
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" ;
366
366
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 ;
371
371
}
372
372
373
373
return NGX_ERROR ;
374
374
}
375
375
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 ;
379
379
}
380
380
381
- n = ngx_send (uc -> connection , buf , len );
381
+ n = ngx_send (rec -> udp , buf , len );
382
382
383
383
if (n == -1 ) {
384
384
return NGX_ERROR ;
385
385
}
386
386
387
387
if ((size_t ) n != (size_t ) len ) {
388
388
#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" );
390
390
#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" );
392
392
#endif
393
393
return NGX_ERROR ;
394
394
}
0 commit comments