mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-01-19 06:19:34 +08:00
more options
This commit is contained in:
parent
f41494bd9c
commit
d012aad859
@ -201,9 +201,9 @@ unsigned short csum(const unsigned short *ptr,int nbytes) {
|
||||
|
||||
return(answer);
|
||||
}
|
||||
int set_buf_size(int fd)
|
||||
int set_buf_size(int fd,int size)
|
||||
{
|
||||
int socket_buf_size=1024*1024;
|
||||
//int socket_buf_size=1024*1024;
|
||||
if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &socket_buf_size, sizeof(socket_buf_size))<0)
|
||||
//if(setsockopt(fd, SOL_SOCKET, SO_SNDBUFFORCE, &socket_buf_size, sizeof(socket_buf_size))<0)
|
||||
{
|
||||
|
17
common.h
17
common.h
@ -49,6 +49,7 @@
|
||||
|
||||
#include<unordered_map>
|
||||
#include<unordered_set>
|
||||
#include<list>
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -61,10 +62,19 @@ typedef int i32_t;
|
||||
|
||||
const int max_data_len=1600;
|
||||
const int buf_len=max_data_len+200;
|
||||
|
||||
const u32_t conv_clear_interval=200;
|
||||
const u32_t timer_interval=400;
|
||||
const int conv_clear_ratio=40;
|
||||
const int conv_clear_min=5;
|
||||
const u32_t conv_timeout=20000;
|
||||
const int max_conv_num=10000;
|
||||
|
||||
/*
|
||||
const u32_t max_handshake_conn_num=10000;
|
||||
const u32_t max_ready_conn_num=1000;
|
||||
//const u32_t anti_replay_window_size=1000;
|
||||
const int max_conv_num=10000;
|
||||
|
||||
|
||||
const u32_t client_handshake_timeout=5000;
|
||||
const u32_t client_retry_interval=1000;
|
||||
@ -76,7 +86,7 @@ const int conn_clear_ratio=10;
|
||||
const int conv_clear_min=5;
|
||||
const int conn_clear_min=1;
|
||||
|
||||
const u32_t conv_clear_interval=1000;
|
||||
|
||||
const u32_t conn_clear_interval=1000;
|
||||
|
||||
|
||||
@ -94,6 +104,7 @@ const u32_t client_conn_uplink_timeout=client_conn_timeout+2000;
|
||||
|
||||
//const uint32_t server_conn_timeout=conv_timeout+60000;//this should be 60s+ longer than conv_timeout,so that conv_manager can destruct convs gradually,to avoid latency glicth
|
||||
const u32_t server_conn_timeout=conv_timeout+60000;//for test
|
||||
*/
|
||||
|
||||
extern int about_to_exit;
|
||||
|
||||
@ -132,7 +143,7 @@ u64_t hton64(u64_t a);
|
||||
bool larger_than_u16(uint16_t a,uint16_t b);
|
||||
bool larger_than_u32(u32_t a,u32_t b);
|
||||
void setnonblocking(int sock);
|
||||
int set_buf_size(int fd);
|
||||
int set_buf_size(int fd,int size=socket_buf_size);
|
||||
|
||||
unsigned short csum(const unsigned short *ptr,int nbytes);
|
||||
|
||||
|
18
makefile
18
makefile
@ -1,14 +1,18 @@
|
||||
ccarm=mips-openwrt-linux-g++
|
||||
FLAGS=-Wall -Wextra -Wno-unused-variable -Wno-unused-parameter
|
||||
cross_cc=mips-openwrt-linux-g++
|
||||
FLAGS=-Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -ggdb
|
||||
FLAGS2= -O3
|
||||
all:
|
||||
g++ main.cpp common.cpp log.cpp -I. -o dupd -static -lrt -std=c++11 ${FLAGS} ${FLAGS2}
|
||||
g++ main.cpp common.cpp log.cpp -I. -o speeder -static -lrt -std=c++11 ${FLAGS} ${FLAGS2}
|
||||
release:
|
||||
g++ main.cpp -o dupd_amd64 -static -lrt ${FLAGS} ${FLAGS2}
|
||||
g++ main.cpp -o dupd_x86 -static -lrt -m32 ${FLAGS} ${FLAGS2}
|
||||
${ccarm} main.cpp -o dupd_ar71xx -lrt
|
||||
g++ main.cpp common.cpp log.cpp -I. -o speeder_amd64 -static -lrt -std=c++11 ${FLAGS} ${FLAGS2}
|
||||
g++ -m32 main.cpp common.cpp log.cpp -I. -o speeder_x86 -static -lrt -std=c++11 ${FLAGS} ${FLAGS2}
|
||||
${cross_cc} main.cpp common.cpp log.cpp -I. -o speeder_ar71xx -lrt -std=c++11 ${FLAGS} ${FLAGS2}
|
||||
tar -zcvf udp_speeder_binaries.tar.gz speeder_amd64 speeder_x86 speeder_ar71xx
|
||||
cross:
|
||||
${cross_cc} main.cpp common.cpp log.cpp -I. -o speeder_cross -lrt -std=c++11 ${FLAGS} ${FLAGS2}
|
||||
|
||||
debug:
|
||||
g++ main.cpp common.cpp log.cpp -I. -o dupd -static -lrt -std=c++11 ${FLAGS} -Wformat-nonliteral -D MY_DEBUG
|
||||
g++ main.cpp common.cpp log.cpp -I. -o speeder -static -lrt -std=c++11 ${FLAGS} -Wformat-nonliteral -D MY_DEBUG
|
||||
|
||||
#g++ forward.cpp aes.c -o forward -static
|
||||
# ${ccarm} forward.cpp aes.c -o forwardarm -static -lgcc_eh
|
||||
|
Loading…
x
Reference in New Issue
Block a user