Browse Source

Fixed silly bug with not giving proper warnings when already listening on a port

M. Ian Graham 18 years ago
parent
commit
59c6d5137a
1 changed files with 15 additions and 0 deletions
  1. 15 0
      direct/src/http/WebRequest.py

+ 15 - 0
direct/src/http/WebRequest.py

@@ -2,6 +2,7 @@ import direct
 from pandac.PandaModules import HttpRequest
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.task.TaskManagerGlobal import taskMgr
+from direct.task import Task
 
 notify = directNotify.newCategory('WebRequestDispatcher')
 
@@ -184,3 +185,17 @@ class WebRequestDispatcher(object):
             uri = "/" + uri
         self.uriToHandler.pop(uri,None)
         
+
+    # -- Poll task wrappers
+
+    def pollHTTPTask(self,task):
+        self.poll()
+        return Task.again
+        
+    def startCheckingIncomingHTTP(self, interval=0.3):
+        taskMgr.remove('pollHTTPTask')
+        taskMgr.doMethodLater(interval,self.pollHTTPTask,'pollHTTPTask')
+
+    def stopCheckingIncomingHTTP(self):
+        taskMgr.remove('pollHTTPTask')
+