2003/12/10 01:18:07
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:42:41 +0000 (07:42 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:42:41 +0000 (07:42 +0000)
darcs-hash:20040130074241-2ba56-fde865da3e23c98556a311b79d0e709e7e8d1a94.gz

src/org/xwt/TinySSL.java

index cf9f901..db082fa 100644 (file)
@@ -165,6 +165,12 @@ public class TinySSL extends Socket {
     public TinySSL(String host, int port, boolean negotiateImmediately) throws IOException { this(host, port, negotiateImmediately, false); }
     public TinySSL(String host, int port, boolean negotiateImmediately, boolean ignoreUntrustedCert) throws IOException {
         super(host, port);
+        if (!initializationFinished) {
+            synchronized(TinySSL.class) {
+                while (!initializationFinished)
+                    try { TinySSL.class.wait(); } catch (Exception e) { }
+            }
+        }
         hostname = host;
         this.ignoreUntrustedCert = ignoreUntrustedCert;
         if (negotiateImmediately) negotiate();
@@ -1522,8 +1528,8 @@ public class TinySSL extends Socket {
         }
     }
     
+    private static volatile boolean initializationFinished = false;
     static { 
-
         entropySpinner[] spinners = new entropySpinner[10];
         for(int i=0; i<spinners.length; i++) spinners[i] = new entropySpinner();
 
@@ -1573,6 +1579,8 @@ public class TinySSL extends Socket {
         md5.doFinal(randpool, 0);
 
         if (Log.on) Log.log(TinySSL.class, "TinySSL is initialized."); 
+        initializationFinished = true;
+        TinySSL.class.notifyAll();
     }