From e554635e487e875817c2d702635220b97a6419f6 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 11 Jan 2020 16:03:28 +1100 Subject: [PATCH] [spice] turn on TCP_QUICKACK https://assets.extrahop.com/whitepapers/TCP-Optimization-Guide-by-ExtraHop.pdf --- VERSION | 2 +- client/spice/CMakeLists.txt | 1 + client/spice/src/spice.c | 5 +++-- client/src/main.h | 1 + common/include/common/locking.h | 6 ++++++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 94bfc4ae..2de33bcb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B1-79-g13f55011c0+1 \ No newline at end of file +B1-80-g5e915dd1ff+1 \ No newline at end of file diff --git a/client/spice/CMakeLists.txt b/client/spice/CMakeLists.txt index ceaf6030..272f5c2a 100644 --- a/client/spice/CMakeLists.txt +++ b/client/spice/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 3.0) project(spice LANGUAGES C) +set(CMAKE_C_STANDARD 11) find_package(PkgConfig) pkg_check_modules(SPICE_PKGCONFIG REQUIRED diff --git a/client/spice/src/spice.c b/client/spice/src/spice.c index cd253596..998ff336 100644 --- a/client/spice/src/spice.c +++ b/client/spice/src/spice.c @@ -733,8 +733,9 @@ bool spice_connect_channel(struct SpiceChannel * channel) if (spice.family != AF_UNIX) { - int flag = 1; - setsockopt(channel->socket, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int)); + const int flag = 1; + setsockopt(channel->socket, IPPROTO_TCP, TCP_NODELAY , &flag, sizeof(int)); + setsockopt(channel->socket, IPPROTO_TCP, TCP_QUICKACK, &flag, sizeof(int)); } if (connect(channel->socket, &spice.addr.addr, addrSize) == -1) diff --git a/client/src/main.h b/client/src/main.h index 34037afd..4a2955b9 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -49,6 +49,7 @@ struct AppState bool drawCursor; bool cursorInView; bool updateCursor; + bool initialCursorSync; float scaleX, scaleY; float accX, accY; int curLastX; diff --git a/common/include/common/locking.h b/common/include/common/locking.h index 0f5afebd..3a29667b 100644 --- a/common/include/common/locking.h +++ b/common/include/common/locking.h @@ -25,6 +25,12 @@ Place, Suite 330, Boston, MA 02111-1307 USA #define INTERLOCKED_GET(x) __sync_fetch_and_add((x), 0) #define INTERLOCKED_CE(x, c, v) __sync_val_compare_and_swap((x), (c), (v)) +#define INTERLOCKED_ENTER(lock) \ + while(__sync_lock_test_and_set(&(lock), 1)) while((lock)); + +#define INTERLOCKED_EXIT(lock) \ + __sync_lock_release(&(lock)); + #define INTERLOCKED_SECTION(lock, x) \ while(__sync_lock_test_and_set(&(lock), 1)) while((lock)); \ x\