Skip to content

Commit c26f6e4

Browse files
committed
Prevent raftable from skipping peers during retries.
1 parent 545a044 commit c26f6e4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

contrib/raftable/raftable.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static struct {
4646
int *leader;
4747
} shared;
4848

49+
static bool try_next_leader = true;
4950
static int leadersock = -1;
5051
static WorkerConfig wcfg;
5152
static char *peerstr;
@@ -78,8 +79,8 @@ static void disconnect_leader(void)
7879
if (leadersock >= 0)
7980
{
8081
close(leadersock);
82+
try_next_leader = true;
8183
}
82-
select_next_peer();
8384
leadersock = -1;
8485
}
8586

@@ -172,7 +173,8 @@ static bool connect_leader(timeout_t *timeout)
172173

173174
HostPort *leaderhp;
174175

175-
if (*shared.leader == NOBODY) select_next_peer();
176+
// if (*shared.leader == NOBODY) select_next_peer();
177+
if (try_next_leader) select_next_peer();
176178

177179
leaderhp = wcfg.peers + *shared.leader;
178180

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy