OSDN Git Service

HLS試作
[iptd/iPTd.git] / src / net / HTTPDaemon.cpp
index 911e4e8..d3aaa2e 100644 (file)
@@ -3,8 +3,8 @@
 //\r
 \r
 #define DBG_LEVEL 0\r
-#include <Raym/Log.h>\r
-#include <Raym/Raym.h>\r
+#include "Raym/Log.h"\r
+#include "Raym/Raym.h"\r
 #include "net/HTTPDaemon.h"\r
 \r
 using namespace Raym;\r
@@ -179,6 +179,10 @@ HTTPResponse *HTTPDaemon::responseWithPath(String *path, HTTPRequest *request)
             {\r
                 header->setFieldBodyWithName("application/x-mpegURL", "Content-Type");\r
             }\r
+            else if (ext->isEqualToString("ts"))\r
+            {\r
+                header->setFieldBodyWithName("video/mp2t", "Content-Type");\r
+            }\r
             else\r
             {\r
                 header->setFieldBodyWithName("application/octet-stream", "Content-Type");\r
@@ -477,7 +481,7 @@ void HTTPDaemon::session(SOCKET sock, struct sockaddr_in *client)
         }\r
         else\r
         {\r
-            DebugLog3("reauest is null");\r
+            DebugLog3("request is null");\r
             done = true;\r
         }\r
 \r
@@ -627,19 +631,22 @@ void HTTPDaemon::run()
     // セッションの終了待ち\r
     if (_sockets->count() > 0)\r
     {\r
+        DebugLog2("wait for session close 00");\r
         // 残存セッションを終了させる為、ソケットを閉じる\r
         for (uint i = 0; i < _sockets->count(); ++i)\r
         {\r
             SOCKET s = (SOCKET)((Number *)_sockets->objectAtIndex(i))->intValue();\r
             closesocket(s);\r
         }\r
+        DebugLog2("wait for session close 01");\r
         // セッションが終了して_socketからオブジェクトを削除するのを待つ\r
         while (_sockets->count() > 0)\r
         {\r
             LeaveCriticalSection(&_cs);\r
-            Sleep(20);\r
+            ::Sleep(200);\r
             EnterCriticalSection(&_cs);\r
         }\r
+        DebugLog2("wait for session close 02");\r
     }\r
 \r
     DebugLog2("HTTPDaemon::run() session close done.");\r
@@ -717,7 +724,7 @@ bool HTTPDaemon::start()
 \r
 void HTTPDaemon::stop()\r
 {\r
-    DebugLog2("HTTPDaemon::stop()", __FUNCTION__);\r
+    DebugLog2("HTTPDaemon::stop()");\r
 \r
     EnterCriticalSection(&_cs);\r
     if (_state == ST_RUN)\r
@@ -727,10 +734,13 @@ void HTTPDaemon::stop()
     LeaveCriticalSection(&_cs);\r
 \r
     wait();\r
+\r
+    DebugLog2("HTTPDaemon::stop() done.");\r
 }\r
 \r
 void HTTPDaemon::wait()\r
 {\r
+    DebugLog2("HTTPDaemon::wait()");\r
     bool done = false;\r
     while (!done)\r
     {\r
@@ -742,6 +752,7 @@ void HTTPDaemon::wait()
             ::Sleep(100);\r
         }\r
     }\r
+    DebugLog2("HTTPDaemon::wait() done.");\r
 }\r
 \r
 const char *HTTPDaemon::className()\r