feat(usbip): Adopt more aggressive KCP strategy
This commit is contained in:
parent
c7fa99c7ca
commit
b1ab783a14
|
@ -71,12 +71,14 @@ static int udp_output(const char *buf, int len, ikcpcb *kcp, void *user)
|
||||||
}
|
}
|
||||||
|
|
||||||
int kcp_network_send(const char *buffer, int len) {
|
int kcp_network_send(const char *buffer, int len) {
|
||||||
return ikcp_send(kcp1, buffer, len);
|
ikcp_send(kcp1, buffer, len);
|
||||||
|
ikcp_flush(kcp1);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void kcp_server_task()
|
void kcp_server_task()
|
||||||
{
|
{
|
||||||
TickType_t xLastWakeTime;
|
TickType_t xLastWakeTime = xTaskGetTickCount();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
kSock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
|
kSock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
|
||||||
|
@ -114,13 +116,14 @@ void kcp_server_task()
|
||||||
}
|
}
|
||||||
kcp1->output = udp_output;
|
kcp1->output = udp_output;
|
||||||
|
|
||||||
ikcp_wndsize(kcp1, 128, 128);
|
ikcp_wndsize(kcp1, 4096, 4096);
|
||||||
|
|
||||||
ikcp_nodelay(kcp1, 2, 10, 2, 1); // set fast mode
|
ikcp_nodelay(kcp1, 2, 2, 2, 1); // set fast mode
|
||||||
kcp1->rx_minrto = 10;
|
kcp1->interval = 0;
|
||||||
|
kcp1->rx_minrto = 1;
|
||||||
kcp1->fastresend = 1;
|
kcp1->fastresend = 1;
|
||||||
|
|
||||||
ikcp_setmtu(kcp1, 1500);
|
ikcp_setmtu(kcp1, 768);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ void app_main()
|
||||||
timer_init();
|
timer_init();
|
||||||
|
|
||||||
#if (USE_KCP == 1)
|
#if (USE_KCP == 1)
|
||||||
xTaskCreate(kcp_server_task, "kcp_server", 4096, NULL, 14, NULL);
|
xTaskCreate(kcp_server_task, "kcp_server", 4096, NULL, 7, NULL);
|
||||||
#else
|
#else
|
||||||
xTaskCreate(tcp_server_task, "tcp_server", 4096, NULL, 14, NULL);
|
xTaskCreate(tcp_server_task, "tcp_server", 4096, NULL, 14, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue