Skip to content

Commit

Permalink
Merge pull request #275 from atsign-foundation/fix/sshrvd-late-init-e…
Browse files Browse the repository at this point in the history
…rror

fix: LateInitializationError sshrvdPort
  • Loading branch information
gkc authored Jul 23, 2023
2 parents c8e69f0 + 9b6d492 commit 9665e43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/sshnoports/lib/sshnp/sshnp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ abstract class SSHNP {
abstract final String namespace;

/// When using sshrvd, this is fetched from sshrvd during [init]
abstract final String sshrvdPort;
String get sshrvdPort;

/// Set to '$localPort $port $username $host $sessionId' during [init]
abstract final String sshString;
Expand Down
10 changes: 7 additions & 3 deletions packages/sshnoports/lib/sshnp/sshnp_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@ class SSHNPImpl implements SSHNP {
late final String namespace;

/// When using sshrvd, this is fetched from sshrvd during [init]
/// This is only set when using sshrvd
/// (i.e. after [getHostAndPortFromSshrvd] has been called)
@override
late final String sshrvdPort;
String get sshrvdPort => _sshrvdPort;

late String _sshrvdPort;

/// Set to '$localPort $port $username $host $sessionId' during [init]
@override
Expand Down Expand Up @@ -484,7 +488,7 @@ class SSHNPImpl implements SSHNP {
List results = ipPorts.split(',');
host = results[0];
port = results[1];
sshrvdPort = results[2];
_sshrvdPort = results[2];
sshrvdAck = true;
});

Expand Down Expand Up @@ -525,7 +529,7 @@ class SSHNPImpl implements SSHNP {

// Connect to rendezvous point using background process.
// sshnp (this program) can then exit without issue.
unawaited(Process.run(getSshrvCommand(), [host, sshrvdPort]));
unawaited(Process.run(getSshrvCommand(), [host, _sshrvdPort]));
}

Future<void> generateSshKeys() async {
Expand Down

0 comments on commit 9665e43

Please sign in to comment.