Skip to content

Commit

Permalink
Refine error message
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Feb 7, 2021
1 parent db1dafb commit 3a1d437
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tun2socks/SocksUdpGwClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3a1d437

Please sign in to comment.