? src/org/globus/myproxy/.MyProxy.java.swp
Index: etc/cog.properties.sample
===================================================================
RCS file: /home/dsl/cog/CVS/jglobus/etc/cog.properties.sample,v
retrieving revision 1.8
diff -a -u -r1.8 cog.properties.sample
--- etc/cog.properties.sample 8 Oct 2002 02:18:49 -0000 1.8
+++ etc/cog.properties.sample 23 Oct 2008 18:39:08 -0000
@@ -35,6 +35,10 @@
# dtd.location=http://www-unix.globus.org/cog/public_data/rsl.dtd
#
+# ----------------------------------------------------------------------
+# timeout (in seconds) when attempting to connect to a myproxy host
+# defaults to 10 seconds
+# sockettimeout=10
# ----------------------------------------------------------------------
Index: src/org/globus/common/CoGProperties.java
===================================================================
RCS file: /home/dsl/cog/CVS/jglobus/src/org/globus/common/CoGProperties.java,v
retrieving revision 1.14
diff -a -u -r1.14 CoGProperties.java
--- src/org/globus/common/CoGProperties.java 27 Feb 2008 05:34:10 -0000 1.14
+++ src/org/globus/common/CoGProperties.java 23 Oct 2008 18:39:08 -0000
@@ -40,6 +40,7 @@
*
the location of the proxy file
* the tcp port range
* the local ip address for DHCP systems
+ * the socket timeout when connecting to a myproxy host
*
*/
public class CoGProperties extends Properties {
@@ -518,6 +519,46 @@
DEFAULT_RANDOM_ALGORITHM);
}
+ /**
+ * Returns the timeout (in seconds) for creating a new socket connection
+ * to a MyProxy host. The socket timeout property can be set either as
+ * the Java system property "MYPROXY_SOCKET_TIMEOUT" (i.e. via the '-D'
+ * command line option or environment variable) or via the
+ * "sockettimeout" property in the cog.properties file. If no such
+ * property is found, the default timeout of 10 seconds is returned.
+ *
+ * @return The timeout for creating a socket connectino to a MyProxy
+ * host. Defaults to 10 seconds.
+ */
+ public int getSocketTimeout() {
+ int timeoutInt = -1; // -1 indicates it hasn't been set yet
+ String timeoutStr = System.getProperty("MYPROXY_SOCKET_TIMEOUT");
+ if (timeoutStr != null && timeoutStr.length() > 0) {
+ int parsedTimeoutInt = Integer.parseInt(timeoutStr);
+ if (parsedTimeoutInt >= 0) {
+ timeoutInt = parsedTimeoutInt;
+ }
+ }
+ if (timeoutInt == -1) { // Didn't find a system property
+ timeoutStr = getProperty("sockettimeout");
+ if (timeoutStr != null && timeoutStr.length() > 0) {
+ int parsedTimeoutInt = Integer.parseInt(timeoutStr);
+ if (parsedTimeoutInt >= 0) {
+ timeoutInt = parsedTimeoutInt;
+ }
+ }
+ }
+ if (timeoutInt == -1) { // Didn't find any property at all
+ timeoutInt = 10;
+ }
+ return timeoutInt;
+ }
+
+ public void setSocketTimeout(int socketTimeout) {
+ put("sockettimeout", String.valueOf(socketTimeout));
+ }
+
+
// -------------------------------------------------------
public int getProxyStrength() {
Index: src/org/globus/myproxy/MyProxy.java
===================================================================
RCS file: /home/dsl/cog/CVS/jglobus/src/org/globus/myproxy/MyProxy.java,v
retrieving revision 1.33
diff -a -u -r1.33 MyProxy.java
--- src/org/globus/myproxy/MyProxy.java 23 Oct 2006 19:12:36 -0000 1.33
+++ src/org/globus/myproxy/MyProxy.java 23 Oct 2008 18:39:08 -0000
@@ -26,13 +26,15 @@
import java.util.Iterator;
import java.net.Socket;
import java.net.InetAddress;
+import java.net.InetSocketAddress;
import java.security.KeyPair;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.cert.X509Certificate;
import java.security.Signature;
-import org.globus.net.SocketFactory;
+import org.globus.common.CoGProperties;
+
import org.globus.gsi.GlobusCredential;
import org.globus.gsi.GSIConstants;
import org.globus.gsi.CertUtil;
@@ -212,31 +214,63 @@
// no delegation
this.context.requestCredDeleg(false);
- SocketFactory factory = SocketFactory.getDefault();
- InetAddress addrs[] = InetAddress.getAllByName(host);
-
IOException exception = null;
Socket socket = null;
- for (int i=0; i