mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-26 13:14:14 +00:00
change low res sleep func api names
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11486 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
1973ee74bc
commit
0463541d61
49 files changed
+180
-180
No files matched your search
@@ -1650,7 +1650,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
|
||||
switch_assert(gp->state < REG_STATE_LAST);
|
||||
stream->write_function(stream, "%25s\t%s\t %32s\t%s", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
|
||||
if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
|
||||
time_t now = switch_timestamp(NULL);
|
||||
time_t now = switch_epoch_time_now(NULL);
|
||||
if (gp->retry > now) {
|
||||
stream->write_function(stream, " (retry: %ds)", gp->retry - now);
|
||||
} else {
|
||||
@@ -1842,7 +1842,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
||||
switch_assert(gp->state < REG_STATE_LAST);
|
||||
stream->write_function(stream, "<gateway>\n<Name>%s</Name>\n<Type>%s</Type>\n<Data>%s</Data>\n<State>%s</State>\n</gateway>\n", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
|
||||
if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
|
||||
time_t now = switch_timestamp(NULL);
|
||||
time_t now = switch_epoch_time_now(NULL);
|
||||
if (gp->retry > now) {
|
||||
stream->write_function(stream, " (retry: %ds)", gp->retry - now);
|
||||
} else {
|
||||
@@ -2042,7 +2042,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
|
||||
|
||||
if (!strcasecmp(argv[1], "stop") || !strcasecmp(argv[1], "restart")) {
|
||||
int rsec = 10;
|
||||
int diff = (int) (switch_timestamp(NULL) - profile->started);
|
||||
int diff = (int) (switch_epoch_time_now(NULL) - profile->started);
|
||||
int remain = rsec - diff;
|
||||
if (diff < rsec) {
|
||||
stream->write_function(stream, "Profile %s must be up for at least %d seconds to stop/restart.\nPlease wait %d second%s\n",
|
||||
|
||||
@@ -284,11 +284,11 @@ void sofia_handle_sip_r_message(int status, sofia_profile_t *profile, nua_handle
|
||||
|
||||
void sofia_wait_for_reply(struct private_object *tech_pvt, nua_event_t event, uint32_t timeout)
|
||||
{
|
||||
time_t exp = switch_timestamp(NULL) + timeout;
|
||||
time_t exp = switch_epoch_time_now(NULL) + timeout;
|
||||
|
||||
tech_pvt->want_event = event;
|
||||
|
||||
while(switch_channel_ready(tech_pvt->channel) && tech_pvt->want_event && switch_timestamp(NULL) < exp) {
|
||||
while(switch_channel_ready(tech_pvt->channel) && tech_pvt->want_event && switch_epoch_time_now(NULL) < exp) {
|
||||
switch_yield(100000);
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ void event_handler(switch_event_t *event)
|
||||
char *rpid = switch_event_get_header(event, "orig-rpid");
|
||||
char *call_id = switch_event_get_header(event, "orig-call-id");
|
||||
char *user_agent = switch_event_get_header(event, "user-agent");
|
||||
long expires = (long) switch_timestamp(NULL);
|
||||
long expires = (long) switch_epoch_time_now(NULL);
|
||||
char *profile_name = switch_event_get_header(event, "orig-profile-name");
|
||||
char *to_user = switch_event_get_header(event, "orig-to-user");
|
||||
char *presence_hosts = switch_event_get_header(event, "presence-hosts");
|
||||
@@ -601,12 +601,12 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
|
||||
|
||||
if (++loops >= 100) {
|
||||
if (++ireg_loops >= IREG_SECONDS) {
|
||||
sofia_reg_check_expire(profile, switch_timestamp(NULL), 0);
|
||||
sofia_reg_check_expire(profile, switch_epoch_time_now(NULL), 0);
|
||||
ireg_loops = 0;
|
||||
}
|
||||
|
||||
if (++gateway_loops >= GATEWAY_SECONDS) {
|
||||
sofia_reg_check_gateway(profile, switch_timestamp(NULL));
|
||||
sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL));
|
||||
gateway_loops = 0;
|
||||
}
|
||||
sofia_sub_check_gateway(profile, time(NULL));
|
||||
@@ -778,7 +778,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting thread for %s\n", profile->name);
|
||||
|
||||
profile->started = switch_timestamp(NULL);
|
||||
profile->started = switch_epoch_time_now(NULL);
|
||||
|
||||
sofia_set_pflag_locked(profile, PFLAG_RUNNING);
|
||||
launch_sofia_worker_thread(profile);
|
||||
@@ -1104,7 +1104,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
||||
if (ping_freq) {
|
||||
if (ping_freq >= 5) {
|
||||
gateway->ping_freq = ping_freq;
|
||||
gateway->ping = switch_timestamp(NULL) + ping_freq;
|
||||
gateway->ping = switch_epoch_time_now(NULL) + ping_freq;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: invalid ping!\n");
|
||||
}
|
||||
@@ -2350,12 +2350,12 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
|
||||
gateway->state = REG_STATE_FAILED;
|
||||
}
|
||||
}
|
||||
gateway->ping = switch_timestamp(NULL) + gateway->ping_freq;
|
||||
gateway->ping = switch_epoch_time_now(NULL) + gateway->ping_freq;
|
||||
sofia_reg_release_gateway(gateway);
|
||||
gateway->pinging = 0;
|
||||
} else if ((profile->pflags & PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) {
|
||||
char *sql;
|
||||
time_t now = switch_timestamp(NULL);
|
||||
time_t now = switch_epoch_time_now(NULL);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n",
|
||||
sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host);
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t *
|
||||
}
|
||||
|
||||
if (!tech_pvt->owner_id) {
|
||||
tech_pvt->owner_id = (uint32_t) switch_timestamp(NULL) - port;
|
||||
tech_pvt->owner_id = (uint32_t) switch_epoch_time_now(NULL) - port;
|
||||
}
|
||||
|
||||
if (!tech_pvt->session_id) {
|
||||
@@ -145,7 +145,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
|
||||
}
|
||||
|
||||
if (!tech_pvt->owner_id) {
|
||||
tech_pvt->owner_id = (uint32_t) switch_timestamp(NULL) - port;
|
||||
tech_pvt->owner_id = (uint32_t) switch_epoch_time_now(NULL) - port;
|
||||
}
|
||||
|
||||
if (!tech_pvt->session_id) {
|
||||
@@ -2902,7 +2902,7 @@ void sofia_glue_restart_all_profiles(void)
|
||||
switch_hash_this(hi, &var, NULL, &val);
|
||||
if ((pptr = (sofia_profile_t *) val)) {
|
||||
int rsec = 10;
|
||||
int diff = (int) (switch_timestamp(NULL) - pptr->started);
|
||||
int diff = (int) (switch_epoch_time_now(NULL) - pptr->started);
|
||||
int remain = rsec - diff;
|
||||
if (sofia_test_pflag(pptr, PFLAG_RESPAWN) || !sofia_test_pflag(pptr, PFLAG_RUNNING)) {
|
||||
continue;
|
||||
|
||||
@@ -946,7 +946,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
char *open;
|
||||
char *prpid;
|
||||
const char *ct = "no/idea";
|
||||
time_t exptime = switch_timestamp(NULL) + 3600;
|
||||
time_t exptime = switch_epoch_time_now(NULL) + 3600;
|
||||
int is_dialog = 0;
|
||||
sofia_profile_t *ext_profile = NULL, *profile = helper->profile;
|
||||
char sstr[128] = "";
|
||||
@@ -990,7 +990,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
if (expires) {
|
||||
long tmp = atol(expires);
|
||||
if (tmp > 0) {
|
||||
exptime = tmp - switch_timestamp(NULL) - SUB_OVERLAP;
|
||||
exptime = tmp - switch_epoch_time_now(NULL) - SUB_OVERLAP;
|
||||
} else {
|
||||
exptime = tmp;
|
||||
}
|
||||
@@ -1281,7 +1281,7 @@ static int sofia_presence_mwi_callback(void *pArg, int argc, char **argv, char *
|
||||
}
|
||||
|
||||
id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
|
||||
expire_sec = (int) (expire_sec - switch_timestamp(NULL));
|
||||
expire_sec = (int) (expire_sec - switch_epoch_time_now(NULL));
|
||||
if (expire_sec < 0) {
|
||||
expire_sec = 3600;
|
||||
}
|
||||
@@ -1585,7 +1585,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
exp_delta = profile->force_subscription_expires ? profile->force_subscription_expires : (sip->sip_expires ? sip->sip_expires->ex_delta : 3600);
|
||||
|
||||
if (exp_delta) {
|
||||
exp_abs = (long) switch_timestamp(NULL) + exp_delta;
|
||||
exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta;
|
||||
} else {
|
||||
exp_abs = 0;
|
||||
sub_state = nua_substate_terminated;
|
||||
@@ -1859,7 +1859,7 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n
|
||||
}
|
||||
|
||||
exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600);
|
||||
exp = (long) switch_timestamp(NULL) + exp_delta;
|
||||
exp = (long) switch_epoch_time_now(NULL) + exp_delta;
|
||||
|
||||
if ((sql =
|
||||
switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' "
|
||||
|
||||
@@ -612,7 +612,7 @@ void sofia_reg_auth_challenge(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
switch_uuid_format(uuid_str, &uuid);
|
||||
|
||||
sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname) "
|
||||
"values('%q', %ld, '%q', '%q')", uuid_str, switch_timestamp(NULL) + profile->nonce_ttl, profile->name, mod_sofia_globals.hostname);
|
||||
"values('%q', %ld, '%q', '%q')", uuid_str, switch_epoch_time_now(NULL) + profile->nonce_ttl, profile->name, mod_sofia_globals.hostname);
|
||||
switch_assert(sql != NULL);
|
||||
sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex);
|
||||
switch_safe_free(sql);
|
||||
@@ -940,7 +940,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
"(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name,hostname) "
|
||||
"values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q')",
|
||||
call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : reg_host,
|
||||
contact_str, reg_desc, rpid, (long) switch_timestamp(NULL) + (long) exptime * 2,
|
||||
contact_str, reg_desc, rpid, (long) switch_epoch_time_now(NULL) + (long) exptime * 2,
|
||||
agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname);
|
||||
|
||||
if (sql) {
|
||||
@@ -1091,7 +1091,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
}
|
||||
}
|
||||
|
||||
switch_rfc822_date(date, switch_timestamp_now());
|
||||
switch_rfc822_date(date, switch_micro_time_now());
|
||||
nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT(sip->sip_contact),
|
||||
TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
|
||||
NUTAG_WITH_THIS(nua),
|
||||
|
||||
Reference in new issue
Block a user