From 27019672fb6706ed522f8dd615ef12150b6e62f9 Mon Sep 17 00:00:00 2001 From: Akira Hayakawa Date: Sat, 9 Nov 2024 17:08:42 +0900 Subject: [PATCH] fix: process_kern_request needs guard to avoid looping --- sorock/src/process/raft_process/responder.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sorock/src/process/raft_process/responder.rs b/sorock/src/process/raft_process/responder.rs index f7837390..c8483a93 100644 --- a/sorock/src/process/raft_process/responder.rs +++ b/sorock/src/process/raft_process/responder.rs @@ -46,6 +46,8 @@ impl RaftProcess { rx.await?; } else { + // Avoid looping. + ensure!(self.driver.self_node_id() != leader_id); let conn = self.driver.connect(leader_id); conn.process_kern_request(req).await?; } @@ -80,7 +82,7 @@ impl RaftProcess { rx.await? } else { - // This check is to avoid looping. + // Avoid looping. ensure!(self.driver.self_node_id() != leader_id); let conn = self.driver.connect(leader_id); conn.process_user_read_request(req).await? @@ -116,9 +118,8 @@ impl RaftProcess { rx.await? } else { - // This check is to avoid looping. + // Avoid looping. ensure!(self.driver.self_node_id() != leader_id); - let conn = self.driver.connect(leader_id); conn.process_user_write_request(req).await? };