1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

NetworkUpload. use ipAddress to start jSch session

Fixes #9097
This commit is contained in:
Martino Facchin 2019-07-30 10:25:59 +02:00
parent f0722843f6
commit adabb08390

View File

@ -46,7 +46,6 @@ public class SSHConfigFileSetup implements SSHClientSetupChainRing {
@Override @Override
public Session setup(BoardPort port, JSch jSch) throws JSchException, IOException { public Session setup(BoardPort port, JSch jSch) throws JSchException, IOException {
String ipAddress = port.getAddress(); String ipAddress = port.getAddress();
String hostname = port.getBoardName().contains(".local") ? port.getBoardName() : port.getBoardName() + ".local";
File sshFolder = new File(System.getProperty("user.home"), ".ssh"); File sshFolder = new File(System.getProperty("user.home"), ".ssh");
File sshConfig = new File(sshFolder, "config"); File sshConfig = new File(sshFolder, "config");
@ -62,7 +61,7 @@ public class SSHConfigFileSetup implements SSHClientSetupChainRing {
jSch.setConfigRepository(new OpenSSHConfigWrapper(configRepository, ipAddress)); jSch.setConfigRepository(new OpenSSHConfigWrapper(configRepository, ipAddress));
return jSch.getSession(hostname); return jSch.getSession(ipAddress);
} }
public static class OpenSSHConfigWrapper implements ConfigRepository { public static class OpenSSHConfigWrapper implements ConfigRepository {