diff --git a/src/README b/src/README index 6d74ce1..84360b2 100644 --- a/src/README +++ b/src/README @@ -1,3 +1,9 @@ +--V1.12 -- +2015-12-23 +修正在程序开始时对IPC变量删除的错误函数调用。 +添加配置项crazyping,当其不为零时,会在每次取网卡信息时进行ping操作。 + + --V1.11 -- 2015-12-18 添加在程序开始时对IPC变量是否已存在的判断,如果已存在,则将其删除。 diff --git a/src/sys_nicmonitor/README b/src/sys_nicmonitor/README index 6d74ce1..84360b2 100644 --- a/src/sys_nicmonitor/README +++ b/src/sys_nicmonitor/README @@ -1,3 +1,9 @@ +--V1.12 -- +2015-12-23 +修正在程序开始时对IPC变量删除的错误函数调用。 +添加配置项crazyping,当其不为零时,会在每次取网卡信息时进行ping操作。 + + --V1.11 -- 2015-12-18 添加在程序开始时对IPC变量是否已存在的判断,如果已存在,则将其删除。 diff --git a/src/sys_nicmonitor/mnic.c b/src/sys_nicmonitor/mnic.c index dd1457f..ba6ace7 100644 --- a/src/sys_nicmonitor/mnic.c +++ b/src/sys_nicmonitor/mnic.c @@ -52,6 +52,7 @@ typedef struct __config_file_st{ char ip[IPSIZE]; int pingnum; //OPTIONAL!! How many times for once ping check? Default is 2. int pinglap; //OPTIONAL!! How many seconds does ping wait for reply package? Default is 1. + int crazyping; }CONFIG_FILE_ST; typedef struct inc_name_node{ @@ -133,6 +134,7 @@ char myconf[][64] = { "ping", // 13 "pingnum", // 14 "pinglap", // 15 + "crazyping", // 16 "" }; @@ -153,6 +155,7 @@ static const configoption_t options[] = { {myconf[13], ARG_STR, cb_str, NULL, CTX_ALL}, {myconf[14], ARG_INT, cb_int, NULL, CTX_ALL}, {myconf[15], ARG_INT, cb_int, NULL, CTX_ALL}, + {myconf[16], ARG_INT, cb_int, NULL, CTX_ALL}, LAST_OPTION }; @@ -1189,6 +1192,10 @@ DOTCONF_CB(cb_int) if(strcmp(cmd ->name, myconf[15]) == 0){ conf.pinglap = cmd->data.value; } + if(strcmp(cmd ->name, myconf[16]) == 0){ + conf.crazyping = cmd->data.value; + } + return NULL; } @@ -1413,7 +1420,7 @@ int get_netcard_status(NETCARD_INFO_ST *listp) return NIC_UNRUNNING; //20100510 - if(elapsed_ping_time == total_ping_time){ + if(conf.crazyping || (elapsed_ping_time == total_ping_time)){ if(ping_gw(listp->info.charname) != 0) return NIC_UNLINKABLE; } @@ -1475,14 +1482,14 @@ int do_alarm(NETCARD_INFO_ST *listp, int nic_status, D5000_NIC_ALARM *Malarm) int main(int argc, char ** argv) { int id = -1; - if((id = semget(0x1d5200, 1, 0666)) == -1) + if((id = semget(0x1d5200, 1, 0666)) != -1) semctl(id,0,IPC_RMID,0); id = -1; - if((id = shmget(0x1d5010,sizeof(SHM) + 16 , 0666)) == -1) - semctl(id,0,IPC_RMID,0); + if((id = shmget(0x1d5010,sizeof(SHM) + 16 , 0666)) != -1) + shmctl(id,IPC_RMID,0); id = -1; - if((id = shmget(0x1d6010, 128, 0666)) == -1) - semctl(id,0,IPC_RMID,0); + if((id = shmget(0x1d6010, 128, 0666)) != -1) + shmctl(id,IPC_RMID,0); int ret = 0, proc_stat = 0; unsigned int i = 0; @@ -1725,7 +1732,8 @@ int main(int argc, char ** argv) total_ping_time = 1000 / conf.monitor_interval; if(total_ping_time == 0) total_ping_time = 1; - elapsed_ping_time = 1; + //elapsed_ping_time = 1; + elapsed_ping_time = total_ping_time; while(1){ i = 0; diff --git a/src/sys_nicmonitor/version.h b/src/sys_nicmonitor/version.h index f849540..bcb3351 100644 --- a/src/sys_nicmonitor/version.h +++ b/src/sys_nicmonitor/version.h @@ -1,5 +1,5 @@ -// version=1.11 +// version=1.12 #ifndef MNIC_VERSION - #define MNIC_VERSION "1.11" + #define MNIC_VERSION "1.12" #endif