diff --git a/trunk/configure b/trunk/configure index 78b7b869e..6f6d4950e 100755 --- a/trunk/configure +++ b/trunk/configure @@ -124,7 +124,7 @@ fi #Core Module MODULE_ID="CORE" MODULE_DEPENDS=() -ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS}) +ModuleLibIncs=(${SRS_OBJS}) MODULE_FILES=("srs_core") MODULE_DIR="src/core" . auto/modules.sh CORE_OBJS="${MODULE_OBJS[@]}" @@ -141,7 +141,8 @@ MODULE_FILES=("srs_core_log" "srs_core_server" "srs_core_handshake" "srs_core_pithy_print" "srs_core_config" "srs_core_refer" "srs_core_reload" "srs_core_hls" "srs_core_forward" "srs_core_encoder" - "srs_core_http" "srs_core_thread" "srs_core_bandwidth") + "srs_core_http" "srs_core_thread" "srs_core_bandwidth" + "srs_core_st") MODULE_DIR="src/app" . auto/modules.sh APP_OBJS="${MODULE_OBJS[@]}" # diff --git a/trunk/src/app/srs_core_bandwidth.hpp b/trunk/src/app/srs_core_bandwidth.hpp index 0f375bdc5..967f73897 100644 --- a/trunk/src/app/srs_core_bandwidth.hpp +++ b/trunk/src/app/srs_core_bandwidth.hpp @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#include + class SrsRequest; class SrsRtmp; diff --git a/trunk/src/app/srs_core_client.hpp b/trunk/src/app/srs_core_client.hpp index fe1d1475e..e7a16f82a 100644 --- a/trunk/src/app/srs_core_client.hpp +++ b/trunk/src/app/srs_core_client.hpp @@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include +#include #include #include diff --git a/trunk/src/app/srs_core_conn.hpp b/trunk/src/app/srs_core_conn.hpp index 8ac78f8d3..b520f8e68 100644 --- a/trunk/src/app/srs_core_conn.hpp +++ b/trunk/src/app/srs_core_conn.hpp @@ -30,6 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include +#include + class SrsServer; class SrsConnection { diff --git a/trunk/src/app/srs_core_forward.hpp b/trunk/src/app/srs_core_forward.hpp index 34bfbfb95..afc1217af 100644 --- a/trunk/src/app/srs_core_forward.hpp +++ b/trunk/src/app/srs_core_forward.hpp @@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include +#include #include class SrsSharedPtrMessage; diff --git a/trunk/src/app/srs_core_http.hpp b/trunk/src/app/srs_core_http.hpp index 67a05088d..c7250d430 100644 --- a/trunk/src/app/srs_core_http.hpp +++ b/trunk/src/app/srs_core_http.hpp @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#include + #ifdef SRS_HTTP class SrsRequest; diff --git a/trunk/src/app/srs_core_log.cpp b/trunk/src/app/srs_core_log.cpp index 64f0c9294..d072dcda0 100644 --- a/trunk/src/app/srs_core_log.cpp +++ b/trunk/src/app/srs_core_log.cpp @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +#include + ILogContext::ILogContext() { } diff --git a/trunk/src/app/srs_core_protocol.hpp b/trunk/src/app/srs_core_protocol.hpp index f7735be55..cc79f10f2 100644 --- a/trunk/src/app/srs_core_protocol.hpp +++ b/trunk/src/app/srs_core_protocol.hpp @@ -33,6 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +#include #include #include diff --git a/trunk/src/app/srs_core_rtmp.hpp b/trunk/src/app/srs_core_rtmp.hpp index bd39e550a..8c79661ca 100644 --- a/trunk/src/app/srs_core_rtmp.hpp +++ b/trunk/src/app/srs_core_rtmp.hpp @@ -32,6 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include +#include + class SrsProtocol; class ISrsMessage; class SrsCommonMessage; diff --git a/trunk/src/app/srs_core_server.hpp b/trunk/src/app/srs_core_server.hpp index 13599b465..0e588ef1c 100644 --- a/trunk/src/app/srs_core_server.hpp +++ b/trunk/src/app/srs_core_server.hpp @@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include +#include #include #include diff --git a/trunk/src/app/srs_core_socket.hpp b/trunk/src/app/srs_core_socket.hpp index 8b25c39dd..f027287b4 100644 --- a/trunk/src/app/srs_core_socket.hpp +++ b/trunk/src/app/srs_core_socket.hpp @@ -30,6 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include +#include + /** * the socket provides TCP socket over st, * that is, the sync socket mechanism. diff --git a/trunk/src/app/srs_core_source.hpp b/trunk/src/app/srs_core_source.hpp index 3f8d62796..e280af9ee 100644 --- a/trunk/src/app/srs_core_source.hpp +++ b/trunk/src/app/srs_core_source.hpp @@ -34,6 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +#include #include class SrsSource; diff --git a/trunk/src/app/srs_core_st.cpp b/trunk/src/app/srs_core_st.cpp new file mode 100644 index 000000000..761d56791 --- /dev/null +++ b/trunk/src/app/srs_core_st.cpp @@ -0,0 +1,37 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013-2014 winlin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +void srs_close_stfd(st_netfd_t& stfd) +{ + if (stfd) { + int fd = st_netfd_fileno(stfd); + st_netfd_close(stfd); + stfd = NULL; + + // st does not close it sometimes, + // close it manually. + close(fd); + } +} diff --git a/trunk/src/app/srs_core_st.hpp b/trunk/src/app/srs_core_st.hpp new file mode 100644 index 000000000..473586b59 --- /dev/null +++ b/trunk/src/app/srs_core_st.hpp @@ -0,0 +1,38 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013-2014 winlin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef SRS_CORE_ST_HPP +#define SRS_CORE_ST_HPP + +/* +#include +*/ + +#include + +#include + +// close the netfd, and close the underlayer fd. +extern void srs_close_stfd(st_netfd_t& stfd); + +#endif diff --git a/trunk/src/app/srs_core_thread.hpp b/trunk/src/app/srs_core_thread.hpp index 3210dcb56..0db59f68b 100644 --- a/trunk/src/app/srs_core_thread.hpp +++ b/trunk/src/app/srs_core_thread.hpp @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#include + /** * the handler for the thread, callback interface. * the thread model defines as: diff --git a/trunk/src/core/srs_core.cpp b/trunk/src/core/srs_core.cpp index 4d2cfbf66..1099e346e 100644 --- a/trunk/src/core/srs_core.cpp +++ b/trunk/src/core/srs_core.cpp @@ -109,16 +109,3 @@ void srs_vhost_resolve(std::string& vhost, std::string& app) } } -void srs_close_stfd(st_netfd_t& stfd) -{ - if (stfd) { - int fd = st_netfd_fileno(stfd); - st_netfd_close(stfd); - stfd = NULL; - - // st does not close it sometimes, - // close it manually. - close(fd); - } -} - diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 08409c2e3..c76ae5007 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -46,8 +46,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include - // generated by configure. #include @@ -104,9 +102,6 @@ extern std::string srs_dns_resolve(std::string host); // app...vhost...request_vhost extern void srs_vhost_resolve(std::string& vhost, std::string& app); -// close the netfd, and close the underlayer fd. -extern void srs_close_stfd(st_netfd_t& stfd); - /** * disable copy constructor of class */ diff --git a/trunk/src/srs/srs.upp b/trunk/src/srs/srs.upp index 860556546..e61b00d6f 100755 --- a/trunk/src/srs/srs.upp +++ b/trunk/src/srs/srs.upp @@ -52,6 +52,8 @@ file ..\app\srs_core_thread.cpp, ..\app\srs_core_server.hpp, ..\app\srs_core_server.cpp, + ..\app\srs_core_st.hpp, + ..\app\srs_core_st.cpp, ..\app\srs_core_stream.hpp, ..\app\srs_core_stream.cpp, ..\app\srs_core_socket.hpp,