diff options
author | Bozhidar Batsov <bozhidar@batsov.com> | 2017-03-06 09:54:45 +0200 |
---|---|---|
committer | Bozhidar Batsov <bozhidar@batsov.com> | 2017-03-06 09:54:45 +0200 |
commit | 49bb2129b7fb569d51674e829209e082e6b029bc (patch) | |
tree | 221d83a89b2f1f08ae6413695bdd576f6a9432b4 /nrepl-client.el | |
parent | 400652e8b52f7ae67a4a760b9f865436fd009a51 (diff) |
[Fix #1935] Correct the broken ssh fallback connection logic
Due to a silly mistake the code never entered what was supposed to be
the fallback connection code branch.
Diffstat (limited to 'nrepl-client.el')
-rw-r--r-- | nrepl-client.el | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nrepl-client.el b/nrepl-client.el index 7b4438ea..05729adb 100644 --- a/nrepl-client.el +++ b/nrepl-client.el @@ -529,11 +529,15 @@ key-values depending on the connection type." (nrepl--direct-connect (or host "localhost") port) ;; we're dealing with a remote host (if (and host (not nrepl-force-ssh-for-remote-hosts)) - (nrepl--direct-connect host port 'no-error) - ;; direct connection failed or `nrepl-force-ssh-for-remote-hosts' is non-nil - (when (or nrepl-use-ssh-fallback-for-remote-hosts - nrepl-force-ssh-for-remote-hosts) - (nrepl--ssh-tunnel-connect host port)))))) + (or (nrepl--direct-connect host port 'no-error) + ;; direct connection failed + ;; fallback to ssh tunneling if enabled + (and nrepl-use-ssh-fallback-for-remote-hosts + (nrepl--ssh-tunnel-connect host port)) + ;; fallback is either not enabled or it failed as well + (error "[nREPL] Cannot connect to %s:%s" host port)) + ;; `nrepl-force-ssh-for-remote-hosts' is non-nil + (nrepl--ssh-tunnel-connect host port))))) (defun nrepl--direct-connect (host port &optional no-error) "If HOST and PORT are given, try to `open-network-stream'. |