From 3b9f0c32e61237dbe455f043258bba663fa8c55f Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 29 Oct 2014 16:01:28 -0500 Subject: [PATCH] FS-6927 #comment allow sub millisecond resolution for option ping times --- src/mod/endpoints/mod_sofia/mod_sofia.c | 6 +++--- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 2 +- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 0feaa6d8a2..c0eb573fb8 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2545,7 +2545,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t ob_failed += gp->ob_failed_calls; ob += gp->ob_calls; - stream->write_function(stream, "%25s\t%32s\t%s\t%9u\t%u/%u\t%u/%u", + stream->write_function(stream, "%25s\t%32s\t%s\t%6.2f\t%u/%u\t%u/%u", pkey, gp->register_to, sofia_state_names[gp->state], gp->ping_time, gp->ib_failed_calls, gp->ib_calls, gp->ob_failed_calls, gp->ob_calls); @@ -2591,7 +2591,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t stream->write_function(stream, "Freq \t%d\n", gp->freq); stream->write_function(stream, "Ping \t%d\n", gp->ping); stream->write_function(stream, "PingFreq\t%d\n", gp->ping_freq); - stream->write_function(stream, "PingTime\t%d\n", gp->ping_time); + stream->write_function(stream, "PingTime\t%0.2f\n", gp->ping_time); stream->write_function(stream, "PingState\t%d/%d/%d\n", gp->ping_min, gp->ping_count, gp->ping_max); stream->write_function(stream, "State \t%s\n", sofia_state_names[gp->state]); stream->write_function(stream, "Status \t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : ""); @@ -2836,7 +2836,7 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre stream->write_function(stream, " %d\n", gp->ping_min); stream->write_function(stream, " %d\n", gp->ping_count); stream->write_function(stream, " %d\n", gp->ping_max); - stream->write_function(stream, " %d\n", gp->ping_time); + stream->write_function(stream, " %0.2f\n", gp->ping_time); stream->write_function(stream, " %d\n", gp->pinging); stream->write_function(stream, " %s\n", sofia_state_names[gp->state]); stream->write_function(stream, " %s\n", status_names[gp->status]); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 051326c2ed..6e9b70cc44 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -505,7 +505,7 @@ struct sofia_gateway { int ping_max; int ping_min; switch_time_t ping_sent; - uint32_t ping_time; + float ping_time; switch_bool_t ping_monitoring; uint8_t flags[REG_FLAG_MAX]; int32_t retry_seconds; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 7965c4ce72..6e384ed215 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5683,7 +5683,7 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max, sofia_gateway_status_name(gateway->status)); } if (gateway->ping_sent) { - gateway->ping_time = (switch_micro_time_now() - gateway->ping_sent) / 1000; + gateway->ping_time = (float)(switch_time_now() - gateway->ping_sent) / 1000; gateway->ping_sent = 0; } } else { diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 98ac88df68..4cd81a3d80 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -379,7 +379,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) nua_handle_bind(nh, pvt); gateway_ptr->pinging = 1; - gateway_ptr->ping_sent = switch_micro_time_now(); + gateway_ptr->ping_sent = switch_time_now(); nua_options(nh, TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)), TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),