diff --git a/tun2socks/SocksUdpGwClient.c b/tun2socks/SocksUdpGwClient.c index 842c8983..db0bf265 100644 --- a/tun2socks/SocksUdpGwClient.c +++ b/tun2socks/SocksUdpGwClient.c @@ -617,16 +617,20 @@ void SocksUdpGwClient_SubmitPacket (SocksUdpGwClient *o, BAddr local_addr, BAddr // create new connection con = connection_init(o, conaddr, data, data_len, is_dns); } else { - // move connection to front of the list - LinkedList1_Remove(&o->connections_list, &con->connections_list_node); - LinkedList1_Append(&o->connections_list, &con->connections_list_node); - // reset the connection reset_connection(o, con, conaddr, is_dns); // send packet to existing connection - // drop the packet if out of buffer - connection_send(con, data, data_len); + int res = connection_send(con, data, data_len); + + if (res == 1) { + // drop the packet if out of buffer + BLog(BLOG_ERROR, "Drop the packet as the buffer is full"); + } else { + // move connection to front of the list + LinkedList1_Remove(&o->connections_list, &con->connections_list_node); + LinkedList1_Append(&o->connections_list, &con->connections_list_node); + } } #else // submit to udpgw client