new option hb-len

This commit is contained in:
wangyu- 2017-11-11 01:15:50 -06:00
parent 706cb0b583
commit 7599d99fcc
3 changed files with 11 additions and 1 deletions

@ -11,7 +11,7 @@ int mtu_warn=1375;//if a packet larger than mtu warn is receviced,there will be
char hb_buf[buf_len];
int hb_len=1200;
int server_on_raw_recv_pre_ready(conn_info_t &conn_info,char * ip_port,u32_t tmp_oppsite_const_id);
int server_on_raw_recv_ready(conn_info_t &conn_info,char * ip_port,char type,char *data,int data_len);

@ -14,6 +14,7 @@
int hb_mode=1;
int hb_len=1200;
fd_manager_t fd_manager;
@ -151,6 +152,7 @@ void print_help()
printf(" the parameter automatically,specify it manually if 'auto' failed\n");
printf(" --gen-add generate iptables rule and add it permanently,then exit.overrides -g\n");
printf(" --keep-rule monitor iptables and auto re-add if necessary.implys -a\n");
printf(" --hb-len <number> length of heart-beat packet\n");
printf(" --clear clear any iptables rules added by this program.overrides everything\n");
printf(" -h,--help print this help message\n");
@ -250,6 +252,7 @@ void process_arg(int argc, char *argv[]) //process all options
{"random-drop", required_argument, 0, 1},
{"fifo", required_argument, 0, 1},
{"hb-mode", required_argument, 0, 1},
{"hb-len", required_argument, 0, 1},
{NULL, 0, 0, 0}
};
@ -598,6 +601,12 @@ void process_arg(int argc, char *argv[]) //process all options
assert(hb_mode==0||hb_mode==1);
mylog(log_info,"hb_mode =%d \n",hb_mode);
}
else if(strcmp(long_options[option_index].name,"hb-len")==0)
{
sscanf(optarg,"%d",&hb_len);
assert(hb_len>=0&&hb_len<=1500);
mylog(log_info,"hb_len =%d \n",hb_len);
}
else
{

1
misc.h

@ -14,6 +14,7 @@
#include "network.h"
extern int hb_mode;
extern int hb_len;
const u32_t max_handshake_conn_num=10000;
const u32_t max_ready_conn_num=1000;