Remove function static variables

This commit is contained in:
Yann Diorcet 2012-10-30 13:48:06 +01:00
parent 37681f0e66
commit 01c990cb10
2 changed files with 11 additions and 7 deletions

View file

@ -1192,6 +1192,9 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
sal_set_user_pointer(lc->sal,lc);
sal_set_callbacks(lc->sal,&linphone_sal_callbacks);
lc->network_last_check = 0;
lc->network_last_status = FALSE;
sip_setup_register_all();
sound_config_read(lc);
net_config_read(lc);
@ -1803,24 +1806,22 @@ void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val){
static void monitor_network_state(LinphoneCore *lc, time_t curtime){
static time_t last_check=0;
static bool_t last_status=FALSE;
char result[LINPHONE_IPADDR_SIZE];
bool_t new_status=last_status;
bool_t new_status=lc->network_last_status;
/* only do the network up checking every five seconds */
if (last_check==0 || (curtime-last_check)>=5){
if (lc->network_last_check==0 || (curtime-lc->network_last_check)>=5){
linphone_core_get_local_ip_for(lc->sip_conf.ipv6_enabled ? AF_INET6 : AF_INET,NULL,result);
if (strcmp(result,"::1")!=0 && strcmp(result,"127.0.0.1")!=0){
new_status=TRUE;
}else new_status=FALSE;
last_check=curtime;
if (new_status!=last_status) {
lc->network_last_check=curtime;
if (new_status!=lc->network_last_status) {
if (new_status){
ms_message("New local ip address is %s",result);
}
set_network_reachable(lc,new_status, curtime);
last_status=new_status;
lc->network_last_status=new_status;
}
}
}

View file

@ -556,6 +556,9 @@ struct _LinphoneCore
bool_t network_reachable;
bool_t use_preview_window;
time_t network_last_check;
bool_t network_last_status;
bool_t ringstream_autorelease;
bool_t pad[3];
int device_rotation;