Skip to content

Commit a60169f

Browse files
committed
fix: connection error logic
1 parent b9e2b3c commit a60169f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,13 @@ async fn main() -> Result<(), Box<dyn Error>> {
219219
let mut result = None;
220220

221221
loop {
222-
if !is_leader && swarm.behaviour().gossipsub.all_peers().count() == 0 {
223-
if result.is_none() {
224-
eprintln!("The benchmark was cancelled by one of the participants, exiting.");
222+
if let Phase::ConfirmingParticipants = phase {
223+
if swarm.behaviour().gossipsub.all_peers().count() == 0 {
224+
if result.is_none() {
225+
eprintln!("Not everyone agreed to participate, exiting without running the benchmark.");
226+
}
227+
std::process::exit(1);
225228
}
226-
std::process::exit(1);
227229
}
228230
if let Phase::SendingShares = phase {
229231
if swarm.behaviour().gossipsub.all_peers().count() == 0 {

0 commit comments

Comments
 (0)