mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-01-19 14:29:34 +08:00
fix timer of fd64
This commit is contained in:
parent
e8398d0d31
commit
a54a0e269b
6
main.cpp
6
main.cpp
@ -926,8 +926,7 @@ int server_on_raw_recv_pre_ready(conn_info_t &conn_info,char * ip_port,u32_t tmp
|
|||||||
|
|
||||||
//g_conn_info=conn_info;
|
//g_conn_info=conn_info;
|
||||||
int new_timer_fd;
|
int new_timer_fd;
|
||||||
set_timer_server(epollfd, new_timer_fd);
|
set_timer_server(epollfd, new_timer_fd,conn_info.timer_fd64);
|
||||||
conn_info.timer_fd64=fd_manager.create(new_timer_fd);
|
|
||||||
|
|
||||||
fd_manager.get_info(conn_info.timer_fd64).ip_port=conn_info.ip_port;
|
fd_manager.get_info(conn_info.timer_fd64).ip_port=conn_info.ip_port;
|
||||||
//assert(conn_manager.timer_fd_mp.find(new_timer_fd)==conn_manager.timer_fd_mp.end());
|
//assert(conn_manager.timer_fd_mp.find(new_timer_fd)==conn_manager.timer_fd_mp.end());
|
||||||
@ -1509,7 +1508,8 @@ int server_event_loop()
|
|||||||
{
|
{
|
||||||
|
|
||||||
if(debug_flag)begin_time=get_current_time();
|
if(debug_flag)begin_time=get_current_time();
|
||||||
int fd=get_u64_l(events[idx].data.u64);
|
//int fd=get_u64_l(events[idx].data.u64);
|
||||||
|
int fd=fd_manager.to_fd(fd64);
|
||||||
u64_t dummy;
|
u64_t dummy;
|
||||||
read(fd, &dummy, 8);
|
read(fd, &dummy, 8);
|
||||||
|
|
||||||
|
6
misc.cpp
6
misc.cpp
@ -951,7 +951,7 @@ int set_timer(int epollfd,int &timer_fd)//put a timer_fd into epoll,general func
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int set_timer_server(int epollfd,int &timer_fd)//only for server
|
int set_timer_server(int epollfd,int &timer_fd,fd64_t &fd64)//only for server
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
epoll_event ev;
|
epoll_event ev;
|
||||||
@ -969,9 +969,11 @@ int set_timer_server(int epollfd,int &timer_fd)//only for server
|
|||||||
its.it_value.tv_nsec=1; //imidiately
|
its.it_value.tv_nsec=1; //imidiately
|
||||||
timerfd_settime(timer_fd,0,&its,0);
|
timerfd_settime(timer_fd,0,&its,0);
|
||||||
|
|
||||||
|
fd64=fd_manager.create(timer_fd);
|
||||||
|
|
||||||
|
|
||||||
ev.events = EPOLLIN;
|
ev.events = EPOLLIN;
|
||||||
ev.data.u64 = pack_u64(2,timer_fd);////difference
|
ev.data.u64 = fd64;////difference
|
||||||
|
|
||||||
ret=epoll_ctl(epollfd, EPOLL_CTL_ADD, timer_fd, &ev);
|
ret=epoll_ctl(epollfd, EPOLL_CTL_ADD, timer_fd, &ev);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
2
misc.h
2
misc.h
@ -112,7 +112,7 @@ void iptables_rule();
|
|||||||
void pre_process_arg(int argc, char *argv[]);//mainly for load conf file;
|
void pre_process_arg(int argc, char *argv[]);//mainly for load conf file;
|
||||||
int unit_test();
|
int unit_test();
|
||||||
int set_timer(int epollfd,int &timer_fd);
|
int set_timer(int epollfd,int &timer_fd);
|
||||||
int set_timer_server(int epollfd,int &timer_fd);
|
int set_timer_server(int epollfd,int &timer_fd,fd64_t &fd64);
|
||||||
int handle_lower_level(raw_info_t &raw_info);
|
int handle_lower_level(raw_info_t &raw_info);
|
||||||
|
|
||||||
int add_iptables_rule(const char *);
|
int add_iptables_rule(const char *);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user