From e7671178b3ac2f09d9d48b2eb3f797d11bd13513 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Nov 2011 09:20:46 +1100 Subject: [PATCH] desktop: fixed TCP buffering issue with HIL the TCP layer was buffering the servo updates, which caused very poor HIL flight --- libraries/Desktop/support/FastSerial.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/Desktop/support/FastSerial.cpp b/libraries/Desktop/support/FastSerial.cpp index 04623fa8d0..79dbc1a78a 100644 --- a/libraries/Desktop/support/FastSerial.cpp +++ b/libraries/Desktop/support/FastSerial.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include "desktop.h" #define LISTEN_BASE_PORT 5760 @@ -131,6 +132,7 @@ static void tcp_start_connection(unsigned int serial_port, bool wait_for_connect fprintf(stderr, "accept() error - %s", strerror(errno)); exit(1); } + setsockopt(s->fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one)); s->connected = true; } } @@ -170,7 +172,9 @@ static void check_connection(struct tcp_state *s) if (select_check(s->listen_fd)) { s->fd = accept(s->listen_fd, NULL, NULL); if (s->fd != -1) { + int one = 1; s->connected = true; + setsockopt(s->fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one)); printf("New connection on serial port %u\n", s->serial_port); } }