]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/Gigi.java
UPD: Notify domainPinger by interrupting when work is ready.
[gigi.git] / src / org / cacert / gigi / Gigi.java
index 53685824528db4caf546e8a6d61f921d05160fb9..632757d7691a95c7530e11fa80dc61912d79f195 100644 (file)
@@ -2,6 +2,7 @@ package org.cacert.gigi;
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.security.KeyStore;
 import java.util.Calendar;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -63,14 +64,15 @@ public class Gigi extends HttpServlet {
 
     private static Gigi instance;
 
-    private PingerDaemon pinger = new PingerDaemon();
+    private PingerDaemon pinger;
 
-    public Gigi(Properties conf) {
+    public Gigi(Properties conf, KeyStore truststore) {
         if (instance != null) {
             throw new IllegalStateException("Multiple Gigi instances!");
         }
         instance = this;
         DatabaseConnection.init(conf);
+        pinger = new PingerDaemon(truststore);
         pinger.start();
     }
 
@@ -156,7 +158,7 @@ public class Gigi extends HttpServlet {
         final Page p = getPage(req.getPathInfo());
 
         if (p != null) {
-            if (!isSecure && (p.needsLogin() || p instanceof LoginPage || p instanceof RegisterPage)) {
+            if ( !isSecure && (p.needsLogin() || p instanceof LoginPage || p instanceof RegisterPage)) {
                 resp.sendRedirect("https://" + ServerConstants.getWwwHostNamePortSecure() + req.getPathInfo());
                 return;
             }
@@ -287,4 +289,8 @@ public class Gigi extends HttpServlet {
         return instance.reveresePages.get(p).replaceFirst("/?\\*$", "");
     }
 
+    public static void notifyPinger() {
+        instance.pinger.interrupt();
+    }
+
 }