Skip to content

Commit

Permalink
Stop connection attempts if interrupted
Browse files Browse the repository at this point in the history
If the interruptor is interrupted, every network call will fail, but the
retry-on-error mechanism must also be stopped.
  • Loading branch information
rom1v committed Nov 14, 2021
1 parent 739ff9d commit 6a27062
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ connect_to_server(struct sc_server *server, uint32_t attempts, sc_tick delay) {

net_close(socket);
}

if (sc_intr_is_interrupted(&server->intr)) {
// Stop immediately
break;
}

if (attempts) {
sc_mutex_lock(&server->mutex);
sc_tick deadline = sc_tick_now() + delay;
Expand Down

0 comments on commit 6a27062

Please sign in to comment.