Slave catches all exceptions, to avoid dying
authoradamch <adamch>
Sun, 9 Dec 2007 13:25:40 +0000 (13:25 +0000)
committeradamch <adamch>
Sun, 9 Dec 2007 13:25:40 +0000 (13:25 +0000)
src/main.sml

index ba60764..feaab16 100644 (file)
@@ -1636,7 +1636,7 @@ fun slave () =
                          | _ => (OpenSSL.close bio;
                                  loop ())
                end handle OpenSSL.OpenSSL s =>
-                          (print ("OpenSSL error: "^ s ^ "\n");
+                          (print ("OpenSSL error: " ^ s ^ "\n");
                            OpenSSL.close bio
                                          handle OpenSSL.OpenSSL _ => ();
                            loop ())
@@ -1646,6 +1646,17 @@ fun slave () =
                            OpenSSL.close bio
                            handle OpenSSL.OpenSSL _ => ();
                            loop ())
+                        | IO.Io {function, name, ...} =>
+                          (print ("IO error: " ^ function ^ ": " ^ name ^ "\n");
+                           OpenSSL.close bio
+                           handle OpenSSL.OpenSSL _ => ();
+                           loop ())
+                        | e =>
+                          (app (fn s => print (s ^ "\n")) (SMLofNJ.exnHistory e);
+                           print "Uncaught exception!\n";
+                           OpenSSL.close bio
+                           handle OpenSSL.OpenSSL _ => ();
+                           loop ())
     in
        loop ();
        OpenSSL.shutdown sock