Author: remi
Date: 2008-09-17 19:44:49 +0200 (Wed, 17 Sep 2008)
New Revision: 1888

Modified:
   
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/httpserver/TDHTTPServer.py
Log:
* improved the HTTP server stability

Modified: 
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/httpserver/TDHTTPServer.py
===================================================================
--- 
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/httpserver/TDHTTPServer.py
  2008-09-17 16:23:54 UTC (rev 1887)
+++ 
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/httpserver/TDHTTPServer.py
  2008-09-17 17:44:49 UTC (rev 1888)
@@ -22,6 +22,7 @@
 from tuxisalive.lib.logger import *
 
 tdServices = []
+myMutex = threading.Lock()
 
 class TDHTTPServer(object):
     """
@@ -164,6 +165,8 @@
         return params
             
     def __getHeaderAndContent(self):
+        global myMutex
+        
         try:
             self.path = urllib.unquote_plus(self.path)
             service, paramStr, id = self.__matchService(tdServices, self.path)
@@ -172,7 +175,14 @@
                 id = -1 
             if service != None:
                 if service['service_callback']:
-                    return service['service_callback'](id, paramDict)
+                    myMutex.acquire()
+                    try:
+                        ret = service['service_callback'](id, paramDict)
+                    except:
+                        myMutex.release()
+                        return None, None
+                    myMutex.release()
+                    return ret
             else:
                 self.__logger = SimpleLogger("httpserver")
                 self.__logger.setLevel(LOG_LEVEL_DEBUG)


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to