summaryrefslogtreecommitdiff
path: root/ot_stats.c
diff options
context:
space:
mode:
Diffstat (limited to 'ot_stats.c')
-rw-r--r--ot_stats.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ot_stats.c b/ot_stats.c
index 1177616..cc7dc30 100644
--- a/ot_stats.c
+++ b/ot_stats.c
@@ -443,13 +443,13 @@ static size_t stats_httperrors_txt ( char * reply ) {
443extern const char 443extern const char
444*g_version_opentracker_c, *g_version_accesslist_c, *g_version_clean_c, *g_version_fullscrape_c, *g_version_http_c, 444*g_version_opentracker_c, *g_version_accesslist_c, *g_version_clean_c, *g_version_fullscrape_c, *g_version_http_c,
445*g_version_iovec_c, *g_version_mutex_c, *g_version_stats_c, *g_version_sync_c, *g_version_udp_c, *g_version_vector_c, 445*g_version_iovec_c, *g_version_mutex_c, *g_version_stats_c, *g_version_sync_c, *g_version_udp_c, *g_version_vector_c,
446*g_version_scan_urlencoded_query_c, *g_version_trackerlogic_c; 446*g_version_scan_urlencoded_query_c, *g_version_trackerlogic_c, *g_version_livesync_c;
447 447
448size_t stats_return_tracker_version( char *reply ) { 448size_t stats_return_tracker_version( char *reply ) {
449 return sprintf( reply, "%s%s%s%s%s%s%s%s%s%s%s%s%s", 449 return sprintf( reply, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
450 g_version_opentracker_c, g_version_accesslist_c, g_version_clean_c, g_version_fullscrape_c, g_version_http_c, 450 g_version_opentracker_c, g_version_accesslist_c, g_version_clean_c, g_version_fullscrape_c, g_version_http_c,
451 g_version_iovec_c, g_version_mutex_c, g_version_stats_c, g_version_sync_c, g_version_udp_c, g_version_vector_c, 451 g_version_iovec_c, g_version_mutex_c, g_version_stats_c, g_version_sync_c, g_version_udp_c, g_version_vector_c,
452 g_version_scan_urlencoded_query_c, g_version_trackerlogic_c ); 452 g_version_scan_urlencoded_query_c, g_version_trackerlogic_c, g_version_livesync_c );
453} 453}
454 454
455size_t return_stats_for_tracker( char *reply, int mode, int format ) { 455size_t return_stats_for_tracker( char *reply, int mode, int format ) {
@@ -490,36 +490,36 @@ size_t return_stats_for_tracker( char *reply, int mode, int format ) {
490 } 490 }
491} 491}
492 492
493void stats_issue_event( ot_status_event event, int is_tcp, uint32_t event_data ) { 493void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uint32_t event_data ) {
494 switch( event ) { 494 switch( event ) {
495 case EVENT_ACCEPT: 495 case EVENT_ACCEPT:
496 if( is_tcp ) ot_overall_tcp_connections++; else ot_overall_udp_connections++; 496 if( proto == FLAG_TCP ) ot_overall_tcp_connections++; else ot_overall_udp_connections++;
497#ifdef WANT_LOG_NETWORKS 497#ifdef WANT_LOG_NETWORKS
498 stat_increase_network_count( &stats_network_counters_root, 0, event_data ); 498 stat_increase_network_count( &stats_network_counters_root, 0, event_data );
499#endif 499#endif
500 break; 500 break;
501 case EVENT_ANNOUNCE: 501 case EVENT_ANNOUNCE:
502 if( is_tcp ) ot_overall_tcp_successfulannounces++; else ot_overall_udp_successfulannounces++; 502 if( proto == FLAG_TCP ) ot_overall_tcp_successfulannounces++; else ot_overall_udp_successfulannounces++;
503 break; 503 break;
504 case EVENT_CONNECT: 504 case EVENT_CONNECT:
505 if( is_tcp ) ot_overall_tcp_connects++; else ot_overall_udp_connects++; 505 if( proto == FLAG_TCP ) ot_overall_tcp_connects++; else ot_overall_udp_connects++;
506 break; 506 break;
507 case EVENT_SCRAPE: 507 case EVENT_SCRAPE:
508 if( is_tcp ) ot_overall_tcp_successfulscrapes++; else ot_overall_udp_successfulscrapes++; 508 if( proto == FLAG_TCP ) ot_overall_tcp_successfulscrapes++; else ot_overall_udp_successfulscrapes++;
509 case EVENT_FULLSCRAPE: 509 case EVENT_FULLSCRAPE:
510 ot_full_scrape_count++; 510 ot_full_scrape_count++;
511 ot_full_scrape_size += event_data; 511 ot_full_scrape_size += event_data;
512 break; 512 break;
513 case EVENT_FULLSCRAPE_REQUEST: 513 case EVENT_FULLSCRAPE_REQUEST:
514 { 514 {
515 unsigned char ip[4]; *(int*)ip = is_tcp; /* ugly hack to transfer ip to stats */ 515 unsigned char ip[4]; *(int*)ip = (int)proto; /* ugly hack to transfer ip to stats */
516 LOG_TO_STDERR( "[%08d] scrp: %d.%d.%d.%d - FULL SCRAPE\n", (unsigned int)(g_now - ot_start_time), ip[0], ip[1], ip[2], ip[3] ); 516 LOG_TO_STDERR( "[%08d] scrp: %d.%d.%d.%d - FULL SCRAPE\n", (unsigned int)(g_now - ot_start_time), ip[0], ip[1], ip[2], ip[3] );
517 ot_full_scrape_request_count++; 517 ot_full_scrape_request_count++;
518 } 518 }
519 break; 519 break;
520 case EVENT_FULLSCRAPE_REQUEST_GZIP: 520 case EVENT_FULLSCRAPE_REQUEST_GZIP:
521 { 521 {
522 unsigned char ip[4]; *(int*)ip = is_tcp; /* ugly hack to transfer ip to stats */ 522 unsigned char ip[4]; *(int*)ip = (int)proto; /* ugly hack to transfer ip to stats */
523 LOG_TO_STDERR( "[%08d] scrp: %d.%d.%d.%d - FULL SCRAPE GZIP\n", (unsigned int)(g_now - ot_start_time), ip[0], ip[1], ip[2], ip[3] ); 523 LOG_TO_STDERR( "[%08d] scrp: %d.%d.%d.%d - FULL SCRAPE GZIP\n", (unsigned int)(g_now - ot_start_time), ip[0], ip[1], ip[2], ip[3] );
524 ot_full_scrape_request_count++; 524 ot_full_scrape_request_count++;
525 } 525 }