mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-09-17 20:54:33 +08:00
Compare commits
3 Commits
20200818.0
...
20210116.0
Author | SHA1 | Date | |
---|---|---|---|
|
af607e4bfa | ||
|
6dcc97155b | ||
|
d607c5ff92 |
@@ -1,6 +1 @@
|
||||
For English speaking user:
|
||||
https://github.com/wangyu-/UDPspeeder/wiki/Issue-Guide
|
||||
|
||||
中文用户请看:
|
||||
https://github.com/wangyu-/UDPspeeder/wiki/发Issue前请看
|
||||
(否则Issue可能被忽略,或被直接关掉)
|
||||
English Only (except for bug reporting).
|
||||
|
@@ -44,12 +44,18 @@ void data_from_local_or_fec_timeout(conn_info_t & conn_info,int is_time_out)
|
||||
mylog(log_trace,"events[idx].data.u64 == (u64_t)local_listen_fd\n");
|
||||
address_t::storage_t udp_new_addr_in={0};
|
||||
socklen_t udp_new_addr_len = sizeof(address_t::storage_t);
|
||||
if ((data_len = recvfrom(local_listen_fd, data, max_data_len, 0,
|
||||
if ((data_len = recvfrom(local_listen_fd, data, max_data_len+1, 0,
|
||||
(struct sockaddr *) &udp_new_addr_in, &udp_new_addr_len)) == -1) {
|
||||
mylog(log_debug,"recv_from error,this shouldnt happen,err=%s,but we can try to continue\n",get_sock_error());
|
||||
return;
|
||||
};
|
||||
|
||||
if(data_len==max_data_len+1)
|
||||
{
|
||||
mylog(log_warn,"huge packet, data_len > %d, packet truncated, dropped\n",max_data_len);
|
||||
return ;
|
||||
}
|
||||
|
||||
if(!disable_mtu_warn&&data_len>=mtu_warn)
|
||||
{
|
||||
mylog(log_warn,"huge packet,data len=%d (>=%d).strongly suggested to set a smaller mtu at upper level,to get rid of this warn\n ",data_len,mtu_warn);
|
||||
@@ -122,7 +128,15 @@ static void remote_cb(struct ev_loop *loop, struct ev_io *watcher, int revents)
|
||||
|
||||
int fd=fd_manager.to_fd(remote_fd64);
|
||||
|
||||
int data_len =recv(fd,data,max_data_len,0);
|
||||
int data_len =recv(fd,data,max_data_len+1,0);
|
||||
|
||||
if(data_len==max_data_len+1)
|
||||
{
|
||||
mylog(log_warn,"huge packet, data_len > %d, packet truncated, dropped\n",max_data_len);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
mylog(log_trace, "received data from udp fd %d, len=%d\n", remote_fd,data_len);
|
||||
if(data_len<0)
|
||||
{
|
||||
|
@@ -89,7 +89,13 @@ void data_from_remote_or_fec_timeout_or_conn_timer(conn_info_t & conn_info,fd64_
|
||||
conn_info.update_active_time();
|
||||
|
||||
int fd=fd_manager.to_fd(fd64);
|
||||
data_len=recv(fd,data,max_data_len,0);
|
||||
data_len=recv(fd,data,max_data_len+1,0);
|
||||
|
||||
if(data_len==max_data_len+1)
|
||||
{
|
||||
mylog(log_warn,"huge packet, data_len > %d, packet truncated, dropped\n",max_data_len);
|
||||
return ;
|
||||
}
|
||||
|
||||
mylog(log_trace,"received a packet from udp_fd,len:%d,conv=%d\n",data_len,conv);
|
||||
|
||||
@@ -135,12 +141,18 @@ static void local_listen_cb(struct ev_loop *loop, struct ev_io *watcher, int rev
|
||||
int data_len;
|
||||
address_t::storage_t udp_new_addr_in={0};
|
||||
socklen_t udp_new_addr_len = sizeof(address_t::storage_t);
|
||||
if ((data_len = recvfrom(local_listen_fd, data, max_data_len, 0,
|
||||
if ((data_len = recvfrom(local_listen_fd, data, max_data_len+1, 0,
|
||||
(struct sockaddr *) &udp_new_addr_in, &udp_new_addr_len)) == -1) {
|
||||
mylog(log_error,"recv_from error,this shouldnt happen,err=%s,but we can try to continue\n",get_sock_error());
|
||||
return;
|
||||
};
|
||||
|
||||
if(data_len==max_data_len+1)
|
||||
{
|
||||
mylog(log_warn,"huge packet, data_len > %d, packet truncated, dropped\n",max_data_len);
|
||||
return ;
|
||||
}
|
||||
|
||||
address_t addr;
|
||||
addr.from_sockaddr((struct sockaddr *) &udp_new_addr_in,udp_new_addr_len);
|
||||
|
||||
|
Reference in New Issue
Block a user