Skip to content

Commit

Permalink
changed mtu setting,and default fec_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu- committed Nov 21, 2017
1 parent 3ecf662 commit ad7985f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static void print_help()
printf(" --tun-dev <number> sepcify tun device name, for example: tun10, default: a random name such as tun987\n");
printf(" -f,--fec x:y forward error correction, send y redundant packets for every x packets\n");
printf(" --timeout <number> how long could a packet be held in queue before doing fec, unit: ms, default: 8ms\n");
printf(" --mode <number> fec-mode,available values: 0, 1; 0 cost less bandwidth, 1 cost less latency(default)\n");
printf(" --mode <number> fec-mode,available values: 0, 1; 0 cost less bandwidth, 1 cost less latency;default: 0)\n");
printf(" --report <number> turn on send/recv report, and set a period for reporting, unit: s\n");
printf(" --re-connect re-connect after lost connection,only for client. \n");

Expand Down Expand Up @@ -100,6 +100,8 @@ int main(int argc, char *argv[])
}
}

g_fec_mode=0;

process_arg(argc,argv);

delay_manager.set_capacity(delay_capacity);
Expand All @@ -111,6 +113,7 @@ int main(int argc, char *argv[])
{
sprintf(tun_dev,"tun%u",get_true_random_number()%1000);
}
mylog(log_info,"using interface %s\n",tun_dev);

if(client_or_server==client_mode)
{
Expand Down
4 changes: 2 additions & 2 deletions tun_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ int tun_dev_client_event_loop()
assert(new_connected_socket(remote_fd,remote_ip_uint32,remote_port)==0);
remote_fd64=fd_manager.create(remote_fd);

assert(set_if(tun_dev,htonl((ntohl(sub_net_uint32)&0xFFFFFF00)|2),htonl((ntohl(sub_net_uint32)&0xFFFFFF00 )|1),g_fec_mtu)==0);
assert(set_if(tun_dev,htonl((ntohl(sub_net_uint32)&0xFFFFFF00)|2),htonl((ntohl(sub_net_uint32)&0xFFFFFF00 )|1),1500)==0);

epoll_fd = epoll_create1(0);
assert(epoll_fd>0);
Expand Down Expand Up @@ -449,7 +449,7 @@ int tun_dev_server_event_loop()
assert(tun_fd>0);

assert(new_listen_socket(local_listen_fd,local_ip_uint32,local_port)==0);
assert(set_if(tun_dev,htonl((ntohl(sub_net_uint32)&0xFFFFFF00)|1),htonl((ntohl(sub_net_uint32)&0xFFFFFF00 )|2),g_fec_mtu)==0);
assert(set_if(tun_dev,htonl((ntohl(sub_net_uint32)&0xFFFFFF00)|1),htonl((ntohl(sub_net_uint32)&0xFFFFFF00 )|2),1500)==0);

epoll_fd = epoll_create1(0);
assert(epoll_fd>0);
Expand Down

0 comments on commit ad7985f

Please sign in to comment.