server/server: fix target timer timing 18/7118/3
authorTomas Vanek <vanekt@fbl.cz>
Mon, 15 Aug 2022 17:18:18 +0000 (19:18 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 27 Aug 2022 16:17:53 +0000 (16:17 +0000)
The change 6363: Call poll at a fixed interval
switched from target_call_timer_callbacks() to target_call_timer_callbacks_now().
It breaks the timing as all timers callbacks are called every time
one timer expires.

Revert this part of change and use target_call_timer_callbacks().

Fixes: db16b3dc5b06 (Call poll at a fixed interval.)
Change-Id: Ib5b7774de9694d40c55d2a4109d0d1582fc5008b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7118
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/server/server.c

index eeaa3d750ecff316041bafb0dfcb416c02948d36..6542200d2f04e49bbc2319c46216adf8b05d8c11 100644 (file)
@@ -473,7 +473,7 @@ int server_loop(struct command_context *command_context)
                        tv.tv_usec = 0;
                        retval = socket_select(fd_max + 1, &read_fds, NULL, NULL, &tv);
                } else {
-                       /* Every 100ms, can be changed with "poll_period" command */
+                       /* Timeout socket_select() when a target timer expires or every polling_period */
                        int timeout_ms = next_event - timeval_ms();
                        if (timeout_ms < 0)
                                timeout_ms = 0;
@@ -507,9 +507,12 @@ int server_loop(struct command_context *command_context)
                }
 
                if (retval == 0) {
-                       /* We only execute these callbacks when there was nothing to do or we timed
-                        *out */
-                       target_call_timer_callbacks_now();
+                       /* Execute callbacks of expired timers when
+                        * - there was nothing to do if poll_ok was true
+                        * - socket_select() timed out if poll_ok was false, now one or more
+                        *   timers expired or the polling period elapsed
+                        */
+                       target_call_timer_callbacks();
                        next_event = target_timer_next_event();
                        process_jim_events(command_context);
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)