Skip to content

Commit

Permalink
client mostly works
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu- committed Aug 20, 2018
1 parent e2ae626 commit af6126c
Show file tree
Hide file tree
Showing 5 changed files with 317 additions and 230 deletions.
32 changes: 32 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,42 @@ static void print_help()
//printf("common options,these options must be same on both side\n");
}

void sigpipe_cb(struct ev_loop *l, ev_signal *w, int revents)
{
mylog(log_info, "got sigpipe, ignored");
}

void sigterm_cb(struct ev_loop *l, ev_signal *w, int revents)
{
mylog(log_info, "got sigterm, exit");
myexit(0);
}

void sigint_cb(struct ev_loop *l, ev_signal *w, int revents)
{
mylog(log_info, "got sigint, exit");
myexit(0);
}

int main(int argc, char *argv[])
{
working_mode=tun_dev_mode;
struct ev_loop* loop=ev_default_loop(0);
#if !defined(__MINGW32__)
ev_signal signal_watcher_sigpipe;
ev_signal_init(&signal_watcher_sigpipe, sigpipe_cb, SIGPIPE);
ev_signal_start(loop, &signal_watcher_sigpipe);
#else
enable_log_color=0;
#endif

ev_signal signal_watcher_sigterm;
ev_signal_init(&signal_watcher_sigterm, sigterm_cb, SIGTERM);
ev_signal_start(loop, &signal_watcher_sigterm);

ev_signal signal_watcher_sigint;
ev_signal_init(&signal_watcher_sigint, sigint_cb, SIGINT);
ev_signal_start(loop, &signal_watcher_sigint);

assert(sizeof(u64_t)==8);
assert(sizeof(i64_t)==8);
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cc_arm= /toolchains/arm-2014.05/bin/arm-none-linux-gnueabi-g++
#cc_bcm2708=/home/wangyu/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++
FLAGS= -std=c++11 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-missing-field-initializers -ggdb -I. -IUDPspeeder -isystem UDPspeeder/libev ${OPT}

SOURCES=`ls UDPspeeder/*.cpp UDPspeeder/lib/*.cpp|grep -v main.cpp|grep -v tunnel.cpp` main.cpp tun_dev.cpp
SOURCES=`ls UDPspeeder/*.cpp UDPspeeder/lib/*.cpp|grep -v main.cpp|grep -v tunnel.cpp` main.cpp tun_dev.cpp tun_dev_client.cpp tun_dev_server.cpp

#INCLUDE= -I. -IUDPspeeder

Expand Down
2 changes: 1 addition & 1 deletion tun_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int from_fec_to_normal2(conn_info_t & conn_info,dest_t &dest,char * data,int len

return 0;
}
int do_mssfix(char * s,int len)
int do_mssfix(char * s,int len)//currently only for ipv4
{
if(mssfix==0)
{
Expand Down
Loading

0 comments on commit af6126c

Please sign in to comment.