Skip to content

Commit 1628c15

Browse files
committed
new option hb-len
1 parent 79855b4 commit 1628c15

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ int mtu_warn=1375;//if a packet larger than mtu warn is receviced,there will be
1111

1212

1313
char hb_buf[buf_len];
14-
int hb_len=1200;
14+
1515

1616
int server_on_raw_recv_pre_ready(conn_info_t &conn_info,char * ip_port,u32_t tmp_oppsite_const_id);
1717
int server_on_raw_recv_ready(conn_info_t &conn_info,char * ip_port,char type,char *data,int data_len);

misc.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515

1616
int hb_mode=1;
17+
int hb_len=1200;
1718

1819
fd_manager_t fd_manager;
1920

@@ -151,6 +152,7 @@ void print_help()
151152
printf(" the parameter automatically,specify it manually if 'auto' failed\n");
152153
printf(" --gen-add generate iptables rule and add it permanently,then exit.overrides -g\n");
153154
printf(" --keep-rule monitor iptables and auto re-add if necessary.implys -a\n");
155+
printf(" --hb-len <number> length of heart-beat packet\n");
154156
printf(" --clear clear any iptables rules added by this program.overrides everything\n");
155157
printf(" -h,--help print this help message\n");
156158

@@ -250,6 +252,7 @@ void process_arg(int argc, char *argv[]) //process all options
250252
{"random-drop", required_argument, 0, 1},
251253
{"fifo", required_argument, 0, 1},
252254
{"hb-mode", required_argument, 0, 1},
255+
{"hb-len", required_argument, 0, 1},
253256
{NULL, 0, 0, 0}
254257
};
255258

@@ -598,6 +601,12 @@ void process_arg(int argc, char *argv[]) //process all options
598601
assert(hb_mode==0||hb_mode==1);
599602
mylog(log_info,"hb_mode =%d \n",hb_mode);
600603
}
604+
else if(strcmp(long_options[option_index].name,"hb-len")==0)
605+
{
606+
sscanf(optarg,"%d",&hb_len);
607+
assert(hb_len>=0&&hb_len<=1500);
608+
mylog(log_info,"hb_len =%d \n",hb_len);
609+
}
601610

602611
else
603612
{

misc.h

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "network.h"
1515

1616
extern int hb_mode;
17+
extern int hb_len;
1718

1819
const u32_t max_handshake_conn_num=10000;
1920
const u32_t max_ready_conn_num=1000;

0 commit comments

Comments
 (0)