From ea295bd694250b077b780cfd506cf4d7f6fd1471 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Harboe?= Date: Fri, 14 Oct 2011 15:05:45 +0200 Subject: [PATCH] target: DCC / target message backoff algorithm MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit by immediately polling again when we have received a message from the target instead of waiting 100ms, we can hope for much better performance. More than 100x? :-) Change-Id: Ieaf0c6c8b6e5addc482895670ffbf9a743e07a29 Signed-off-by: Øyvind Harboe Reviewed-on: http://openocd.zylin.com/27 Reviewed-by: Øyvind Harboe Tested-by: Øyvind Harboe --- src/server/server.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/server/server.c b/src/server/server.c index c70a5222..84ec1ac9 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -29,6 +29,7 @@ #include "server.h" #include +#include #include "openocd.h" #include "tcl_server.h" #include "telnet_server.h" @@ -443,6 +444,13 @@ int server_loop(struct command_context *command_context) poll_ok = true; } + /* This is a simple back-off algorithm where we immediately + * re-poll if we did something this time around. + * + * This greatly improves performance of DCC. + */ + poll_ok = poll_ok || target_got_message(); + for (service = services; service; service = service->next) { /* handle new connections on listeners */ -- 2.39.5