[mod_verto] use SWITCH_TIME_T_FMT

This commit is contained in:
Seven Du 2025-01-13 14:10:25 +08:00
parent e343b47c49
commit f0ab438d89
No known key found for this signature in database
2 changed files with 8 additions and 9 deletions

View File

@ -1062,7 +1062,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
} else { } else {
switch_xml_t x_param, x_params; switch_xml_t x_param, x_params;
const char *use_passwd = NULL, *verto_context = NULL, *verto_dialplan = NULL; const char *use_passwd = NULL, *verto_context = NULL, *verto_dialplan = NULL;
time_t now = switch_epoch_time_now(NULL); switch_time_t now = switch_epoch_time_now(NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Login sucessful for user: %s domain: %s\n", id, domain); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Login sucessful for user: %s domain: %s\n", id, domain);
@ -1117,11 +1117,11 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
switch_clear_flag(jsock, JPFLAG_AUTH_EXPIRED); switch_clear_flag(jsock, JPFLAG_AUTH_EXPIRED);
if (!strcmp(var, "login-expires")) { if (!strcmp(var, "login-expires")) {
uint32_t tmp = atol(val); switch_time_t tmp = atol(val);
if (tmp > now) { if (tmp > now) {
jsock->exptime = tmp; jsock->exptime = tmp;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Login expire time for %s set to %ld seconds [%ld] [%ld]\n", jsock->uid, tmp - now, jsock->exptime, now); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Login expire time for %s set to %" SWITCH_TIME_T_FMT " seconds [%" SWITCH_TIME_T_FMT "] [%" SWITCH_TIME_T_FMT "]\n", jsock->uid, tmp - now, jsock->exptime, now);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid expire time for %s. Defaulting to 300 sec\n", jsock->uid); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid expire time for %s. Defaulting to 300 sec\n", jsock->uid);
jsock->exptime = now + 300; jsock->exptime = now + 300;
@ -1994,7 +1994,7 @@ static void client_run(jsock_t *jsock)
while(jsock->profile->running) { while(jsock->profile->running) {
int pflags, poll_time = 50; int pflags, poll_time = 50;
time_t now; switch_time_t now;
if (!jsock->ws) { die("%s Setup Error\n", jsock->name); } if (!jsock->ws) { die("%s Setup Error\n", jsock->name); }
@ -2005,9 +2005,8 @@ static void client_run(jsock_t *jsock)
if (now >= jsock->exptime) { if (now >= jsock->exptime) {
switch_set_flag(jsock, JPFLAG_AUTH_EXPIRED); switch_set_flag(jsock, JPFLAG_AUTH_EXPIRED);
die("%s Authentication Expired [%ld] >= [%ld]\n", jsock->uid, now, jsock->exptime); die("%s Authentication Expired [%" SWITCH_TIME_T_FMT "] >= [%" SWITCH_TIME_T_FMT "]\n", jsock->uid, now, jsock->exptime);
} }
} }
if (jsock->drop) { die("%s Dropping Connection\n", jsock->name); } if (jsock->drop) { die("%s Dropping Connection\n", jsock->name); }

View File

@ -141,8 +141,8 @@ struct jsock_s {
char remote_host[256]; char remote_host[256];
int remote_port; int remote_port;
int family; int family;
time_t exptime; switch_time_t exptime;
time_t logintime; switch_time_t logintime;
struct verto_profile_s *profile; struct verto_profile_s *profile;
switch_thread_rwlock_t *rwlock; switch_thread_rwlock_t *rwlock;
@ -191,7 +191,7 @@ typedef struct verto_pvt_s {
switch_media_handle_t *smh; switch_media_handle_t *smh;
switch_core_media_params_t *mparams; switch_core_media_params_t *mparams;
switch_call_cause_t remote_hangup_cause; switch_call_cause_t remote_hangup_cause;
time_t detach_time; switch_time_t detach_time;
struct verto_pvt_s *next; struct verto_pvt_s *next;
switch_byte_t text_read_frame_data[SWITCH_RTP_MAX_BUF_LEN]; switch_byte_t text_read_frame_data[SWITCH_RTP_MAX_BUF_LEN];
switch_frame_t text_read_frame; switch_frame_t text_read_frame;