Skip to content

Commit

Permalink
fix: fix the 'waiting for $x response' message outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
gkc committed Dec 4, 2023
1 parent 1e4f2da commit 6e7c143
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ abstract class SshnpdChannel with AsyncInitialization, AtClientBindings {
/// Returns true if the deamon acknowledged our request.
/// Returns false if a timeout occurred.
Future<SshnpdAck> waitForDaemonResponse() async {
int counter = 0;
// Timer to timeout after 10 Secs or after the Ack of connected/Errors
for (int i = 0; i < 100; i++) {
if ((counter + 1) % 20 == 0) {
logger.info('Waiting for sshnpd response: $counter');
for (int counter = 1; counter <= 100; counter++) {
if (counter % 20 == 0) {
logger.info('Still waiting for sshnpd response');
logger.info('sshnpdAck: $sshnpdAck');
}
await Future.delayed(Duration(milliseconds: 100));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ abstract class SshrvdChannel<T> with AsyncInitialization, AtClientBindings {
logger.info('Sending notification to sshrvd: $ourSshrvdIdKey');
await notify(ourSshrvdIdKey, sessionId);

int counter = 0;
int counter = 1;
while (sshrvdAck == SshrvdAck.notAcknowledged) {
if ((counter + 1) % 20 == 0) {
logger.info('Waiting for sshrvd response: $counter');
if (counter % 20 == 0) {
logger.info('Still waiting for sshrvd response');
}
await Future.delayed(Duration(milliseconds: 100));
counter++;
if (counter == 100) {
if (counter > 100) {
logger.warning('Timed out waiting for sshrvd response');
throw ('Connection timeout to sshrvd $host service\nhint: make sure host is valid and online');
}
Expand Down

0 comments on commit 6e7c143

Please sign in to comment.