0
0
Fork 0

feat(usbip): Adopt more aggressive KCP strategy

This commit is contained in:
windowsair 2021-10-10 21:44:43 +08:00
parent c7fa99c7ca
commit b1ab783a14
2 changed files with 10 additions and 7 deletions

View File

@ -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) {
return ikcp_send(kcp1, buffer, len);
ikcp_send(kcp1, buffer, len);
ikcp_flush(kcp1);
return 0;
}
void kcp_server_task()
{
TickType_t xLastWakeTime;
TickType_t xLastWakeTime = xTaskGetTickCount();
while (1) {
kSock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
@ -114,13 +116,14 @@ void kcp_server_task()
}
kcp1->output = udp_output;
ikcp_wndsize(kcp1, 128, 128);
ikcp_wndsize(kcp1, 4096, 4096);
ikcp_nodelay(kcp1, 2, 10, 2, 1); // set fast mode
kcp1->rx_minrto = 10;
ikcp_nodelay(kcp1, 2, 2, 2, 1); // set fast mode
kcp1->interval = 0;
kcp1->rx_minrto = 1;
kcp1->fastresend = 1;
ikcp_setmtu(kcp1, 1500);
ikcp_setmtu(kcp1, 768);

View File

@ -172,7 +172,7 @@ void app_main()
timer_init();
#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
xTaskCreate(tcp_server_task, "tcp_server", 4096, NULL, 14, NULL);
#endif