Skip to content

Commit

Permalink
g3keymess: ignore more early connection errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq-b committed Aug 23, 2023
1 parent e104e4c commit 891fe75
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion g3keymess/src/serve/task/multiplex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ impl KeylessTask {
msg_count += 1;
}
Ok(false) => return Ok(()),
Err(e) => return Err(ServerTaskError::ReadFailed(e)),
Err(e) => {
return if msg_count == 0 {
Err(ServerTaskError::ConnectionClosedEarly)
} else {
Err(ServerTaskError::ReadFailed(e))
};
}
}
}
r = self.ctx.reload_notifier.recv() => {
Expand Down
6 changes: 5 additions & 1 deletion g3keymess/src/serve/task/simplex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ impl KeylessTask {
}
Ok(false) => break,
Err(e) => {
self.log_task_err(ServerTaskError::ReadFailed(e));
if msg_count == 0 {
self.log_task_err(ServerTaskError::ConnectionClosedEarly);
} else {
self.log_task_err(ServerTaskError::ReadFailed(e));
}
break;
}
}
Expand Down

0 comments on commit 891fe75

Please sign in to comment.