File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ const STORAGE_KEY = 'cloud-social-contacts';
2626const ADMIN_USERNAME = 'giver' ;
2727const REGULAR_USERNAME = 'getter' ;
2828
29+ // Timeout for establishing an SSH connection.
30+ const CONNECT_TIMEOUT_MS = 10000 ;
31+
2932// Credentials for accessing a cloud instance.
3033// The serialised, base64 form is distributed amongst users.
3134// TODO: add (private) keys, for key-based auth
@@ -450,6 +453,7 @@ class Connection {
450453 host : this . invite_ . host ,
451454 port : SSH_SERVER_PORT ,
452455 username : this . invite_ . user ,
456+ readyTimeout : CONNECT_TIMEOUT_MS ,
453457 // Remaining fields only for type-correctness.
454458 tryKeyboard : false ,
455459 debug : undefined
@@ -464,6 +468,7 @@ class Connection {
464468
465469 return new Promise < void > ( ( F , R ) => {
466470 this . client_ . on ( 'ready' , ( ) => {
471+ // TODO: set a timeout here, too
467472 this . setState_ ( ConnectionState . ESTABLISHING_TUNNEL ) ;
468473 this . client_ . forwardOut (
469474 // TODO: since we communicate using the stream, what does this mean?
You can’t perform that action at this time.
0 commit comments