Parcourir la source

[1852] When opening a HTTP socket is unexpectedly failed due to a socket error e.g. Address already in use, it explicitly closes the CC Session already opened before it shuts down.

Naoki Kambe il y a 13 ans
Parent
commit
ed1f3349ee
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. 6 1
      src/bin/stats/stats_httpd.py.in

+ 6 - 1
src/bin/stats/stats_httpd.py.in

@@ -189,7 +189,12 @@ class StatsHttpd:
         self.load_config()
         self.http_addrs = []
         self.mccs.start()
-        self.open_httpd()
+        try:
+            self.open_httpd()
+        except HttpServerError:
+            # if some exception, e.g. address in use, is raised, then it closes mccs and httpd
+            self.close_mccs()
+            raise
 
     def open_mccs(self):
         """Opens a ModuleCCSession object"""