Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryamanaka2003-11-26 10:34:04 -0500
committeryamanaka2003-11-26 10:34:04 -0500
commitef70e233afa955d58eba190e4f4b1c95aaf7d7c0 (patch)
treef5d73faf6fa16597edba36a7b6efac01ced94549
parentdaff7fcf4169e0deb42b6fcd57eb6b330d9e0b84 (diff)
downloadeclipse.platform.team-ef70e233afa955d58eba190e4f4b1c95aaf7d7c0.tar.gz
eclipse.platform.team-ef70e233afa955d58eba190e4f4b1c95aaf7d7c0.tar.xz
eclipse.platform.team-ef70e233afa955d58eba190e4f4b1c95aaf7d7c0.zip
* handling a progress monitor
* using Util.createSocket in JSchSession.java
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2ServerConnection.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/JSchSession.java30
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2ServerConnection.java4
3 files changed, 35 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2ServerConnection.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2ServerConnection.java
index cec941c1c..9c02bc7a4 100644
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2ServerConnection.java
+++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/CVSSSH2ServerConnection.java
@@ -54,6 +54,8 @@ public class CVSSSH2ServerConnection implements IServerConnection {
public void open(IProgressMonitor monitor) throws IOException,
CVSAuthenticationException {
+ monitor.subTask("CVSSSH2ServerConnection.open");
+ monitor.worked(1);
try{
String hostname=location.getHost();
String username=location.getUsername();
@@ -66,7 +68,7 @@ public class CVSSSH2ServerConnection implements IServerConnection {
InputStream channel_in;
while(true){
- session=JSchSession.getSession(username, password, hostname, port);
+ session=JSchSession.getSession(username, password, hostname, port, monitor);
channel=session.openChannel("exec");
((ChannelExec)channel).setCommand(COMMAND);
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/JSchSession.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/JSchSession.java
index 5af5ccb3d..fcd963e3a 100644
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/JSchSession.java
+++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/JSchSession.java
@@ -13,7 +13,14 @@ package org.eclipse.team.cvs.ssh2;
import java.util.Enumeration;
import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.IOException;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import org.eclipse.team.internal.ccvs.core.util.Util;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.widgets.Display;
@@ -39,7 +46,8 @@ class JSchSession{
private static String current_ssh_home=null;
static Session getSession(String username, String password,
- String hostname, int port) throws JSchException{
+ String hostname, int port,
+ final IProgressMonitor monitor) throws JSchException{
if(port==0) port=SSH_DEFAULT_PORT;
if(jsch==null){
jsch=new JSch();
@@ -115,6 +123,26 @@ class JSchSession{
UserInfo ui=new MyUserInfo(username);
session.setUserInfo(ui);
+
+ session.setSocketFactory(new SocketFactory(){
+ InputStream in=null;
+ OutputStream out=null;
+ public Socket createSocket(String host, int port) throws IOException,
+ UnknownHostException{
+ Socket socket=null;
+ socket=Util.createSocket(host, port, monitor);
+ return socket;
+ }
+ public InputStream getInputStream(Socket socket) throws IOException{
+ if(in==null) in=socket.getInputStream();
+ return in;
+ }
+ public OutputStream getOutputStream(Socket socket) throws IOException{
+ if(out==null) out=socket.getOutputStream();
+ return out;
+ }
+ });
+
session.connect();
pool.put(key, session);
}
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2ServerConnection.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2ServerConnection.java
index 54d9bfeb9..d57c6838e 100644
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2ServerConnection.java
+++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/ccvs/ssh2/PServerSSH2ServerConnection.java
@@ -64,6 +64,8 @@ public class PServerSSH2ServerConnection implements IServerConnection {
public void open(IProgressMonitor monitor) throws IOException,
CVSAuthenticationException {
+ monitor.subTask("PServerSSH2ServerConnection.open");
+ monitor.worked(1);
String cvs_root=location.getRootDirectory();
int cvs_port=location.getPort();
if(cvs_port==0) cvs_port=2401;
@@ -103,7 +105,7 @@ public class PServerSSH2ServerConnection implements IServerConnection {
int retry=1;
while(true){
try{
- session=JSchSession.getSession(ssh_user, "", ssh_host, ssh_port);
+ session=JSchSession.getSession(ssh_user, "", ssh_host, ssh_port, monitor);
String[] list=session.getPortForwardingL();
String name=":"+rhost+":"+rport;
boolean done=false;

Back to the top