正在显示
18 个修改的文件
包含
99 行增加
和
20 行删除
| @@ -124,7 +124,7 @@ fi | @@ -124,7 +124,7 @@ fi | ||
| 124 | #Core Module | 124 | #Core Module |
| 125 | MODULE_ID="CORE" | 125 | MODULE_ID="CORE" |
| 126 | MODULE_DEPENDS=() | 126 | MODULE_DEPENDS=() |
| 127 | -ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS}) | 127 | +ModuleLibIncs=(${SRS_OBJS}) |
| 128 | MODULE_FILES=("srs_core") | 128 | MODULE_FILES=("srs_core") |
| 129 | MODULE_DIR="src/core" . auto/modules.sh | 129 | MODULE_DIR="src/core" . auto/modules.sh |
| 130 | CORE_OBJS="${MODULE_OBJS[@]}" | 130 | CORE_OBJS="${MODULE_OBJS[@]}" |
| @@ -141,7 +141,8 @@ MODULE_FILES=("srs_core_log" "srs_core_server" | @@ -141,7 +141,8 @@ MODULE_FILES=("srs_core_log" "srs_core_server" | ||
| 141 | "srs_core_handshake" "srs_core_pithy_print" | 141 | "srs_core_handshake" "srs_core_pithy_print" |
| 142 | "srs_core_config" "srs_core_refer" "srs_core_reload" | 142 | "srs_core_config" "srs_core_refer" "srs_core_reload" |
| 143 | "srs_core_hls" "srs_core_forward" "srs_core_encoder" | 143 | "srs_core_hls" "srs_core_forward" "srs_core_encoder" |
| 144 | - "srs_core_http" "srs_core_thread" "srs_core_bandwidth") | 144 | + "srs_core_http" "srs_core_thread" "srs_core_bandwidth" |
| 145 | + "srs_core_st") | ||
| 145 | MODULE_DIR="src/app" . auto/modules.sh | 146 | MODULE_DIR="src/app" . auto/modules.sh |
| 146 | APP_OBJS="${MODULE_OBJS[@]}" | 147 | APP_OBJS="${MODULE_OBJS[@]}" |
| 147 | # | 148 | # |
| @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | +#include <srs_core_st.hpp> | ||
| 33 | + | ||
| 32 | class SrsRequest; | 34 | class SrsRequest; |
| 33 | class SrsRtmp; | 35 | class SrsRtmp; |
| 34 | 36 |
| @@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 30 | 30 | ||
| 31 | #include <srs_core.hpp> | 31 | #include <srs_core.hpp> |
| 32 | 32 | ||
| 33 | +#include <srs_core_st.hpp> | ||
| 33 | #include <srs_core_conn.hpp> | 34 | #include <srs_core_conn.hpp> |
| 34 | #include <srs_core_reload.hpp> | 35 | #include <srs_core_reload.hpp> |
| 35 | 36 |
| @@ -30,6 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -30,6 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 30 | 30 | ||
| 31 | #include <srs_core.hpp> | 31 | #include <srs_core.hpp> |
| 32 | 32 | ||
| 33 | +#include <srs_core_st.hpp> | ||
| 34 | + | ||
| 33 | class SrsServer; | 35 | class SrsServer; |
| 34 | class SrsConnection | 36 | class SrsConnection |
| 35 | { | 37 | { |
| @@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 31 | 31 | ||
| 32 | #include <string> | 32 | #include <string> |
| 33 | 33 | ||
| 34 | +#include <srs_core_st.hpp> | ||
| 34 | #include <srs_core_thread.hpp> | 35 | #include <srs_core_thread.hpp> |
| 35 | 36 | ||
| 36 | class SrsSharedPtrMessage; | 37 | class SrsSharedPtrMessage; |
| @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | +#include <srs_core_st.hpp> | ||
| 33 | + | ||
| 32 | #ifdef SRS_HTTP | 34 | #ifdef SRS_HTTP |
| 33 | 35 | ||
| 34 | class SrsRequest; | 36 | class SrsRequest; |
| @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | #include <string> | 29 | #include <string> |
| 30 | #include <map> | 30 | #include <map> |
| 31 | 31 | ||
| 32 | +#include <st.h> | ||
| 33 | + | ||
| 32 | ILogContext::ILogContext() | 34 | ILogContext::ILogContext() |
| 33 | { | 35 | { |
| 34 | } | 36 | } |
| @@ -33,6 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -33,6 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 33 | #include <map> | 33 | #include <map> |
| 34 | #include <string> | 34 | #include <string> |
| 35 | 35 | ||
| 36 | +#include <srs_core_st.hpp> | ||
| 36 | #include <srs_core_log.hpp> | 37 | #include <srs_core_log.hpp> |
| 37 | #include <srs_core_error.hpp> | 38 | #include <srs_core_error.hpp> |
| 38 | 39 |
| @@ -32,6 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -32,6 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 32 | 32 | ||
| 33 | #include <string> | 33 | #include <string> |
| 34 | 34 | ||
| 35 | +#include <srs_core_st.hpp> | ||
| 36 | + | ||
| 35 | class SrsProtocol; | 37 | class SrsProtocol; |
| 36 | class ISrsMessage; | 38 | class ISrsMessage; |
| 37 | class SrsCommonMessage; | 39 | class SrsCommonMessage; |
| @@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 32 | 32 | ||
| 33 | #include <vector> | 33 | #include <vector> |
| 34 | 34 | ||
| 35 | +#include <srs_core_st.hpp> | ||
| 35 | #include <srs_core_reload.hpp> | 36 | #include <srs_core_reload.hpp> |
| 36 | #include <srs_core_thread.hpp> | 37 | #include <srs_core_thread.hpp> |
| 37 | 38 |
| @@ -30,6 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -30,6 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 30 | 30 | ||
| 31 | #include <srs_core.hpp> | 31 | #include <srs_core.hpp> |
| 32 | 32 | ||
| 33 | +#include <srs_core_st.hpp> | ||
| 34 | + | ||
| 33 | /** | 35 | /** |
| 34 | * the socket provides TCP socket over st, | 36 | * the socket provides TCP socket over st, |
| 35 | * that is, the sync socket mechanism. | 37 | * that is, the sync socket mechanism. |
| @@ -34,6 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -34,6 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 34 | #include <vector> | 34 | #include <vector> |
| 35 | #include <string> | 35 | #include <string> |
| 36 | 36 | ||
| 37 | +#include <srs_core_st.hpp> | ||
| 37 | #include <srs_core_reload.hpp> | 38 | #include <srs_core_reload.hpp> |
| 38 | 39 | ||
| 39 | class SrsSource; | 40 | class SrsSource; |
trunk/src/app/srs_core_st.cpp
0 → 100644
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013-2014 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#include <srs_core_st.hpp> | ||
| 25 | + | ||
| 26 | +void srs_close_stfd(st_netfd_t& stfd) | ||
| 27 | +{ | ||
| 28 | + if (stfd) { | ||
| 29 | + int fd = st_netfd_fileno(stfd); | ||
| 30 | + st_netfd_close(stfd); | ||
| 31 | + stfd = NULL; | ||
| 32 | + | ||
| 33 | + // st does not close it sometimes, | ||
| 34 | + // close it manually. | ||
| 35 | + close(fd); | ||
| 36 | + } | ||
| 37 | +} |
trunk/src/app/srs_core_st.hpp
0 → 100644
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013-2014 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#ifndef SRS_CORE_ST_HPP | ||
| 25 | +#define SRS_CORE_ST_HPP | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | +#include <srs_core_st.hpp> | ||
| 29 | +*/ | ||
| 30 | + | ||
| 31 | +#include <srs_core.hpp> | ||
| 32 | + | ||
| 33 | +#include <st.h> | ||
| 34 | + | ||
| 35 | +// close the netfd, and close the underlayer fd. | ||
| 36 | +extern void srs_close_stfd(st_netfd_t& stfd); | ||
| 37 | + | ||
| 38 | +#endif |
| @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -29,6 +29,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 29 | */ | 29 | */ |
| 30 | #include <srs_core.hpp> | 30 | #include <srs_core.hpp> |
| 31 | 31 | ||
| 32 | +#include <srs_core_st.hpp> | ||
| 33 | + | ||
| 32 | /** | 34 | /** |
| 33 | * the handler for the thread, callback interface. | 35 | * the handler for the thread, callback interface. |
| 34 | * the thread model defines as: | 36 | * the thread model defines as: |
| @@ -109,16 +109,3 @@ void srs_vhost_resolve(std::string& vhost, std::string& app) | @@ -109,16 +109,3 @@ void srs_vhost_resolve(std::string& vhost, std::string& app) | ||
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | -void srs_close_stfd(st_netfd_t& stfd) | ||
| 113 | -{ | ||
| 114 | - if (stfd) { | ||
| 115 | - int fd = st_netfd_fileno(stfd); | ||
| 116 | - st_netfd_close(stfd); | ||
| 117 | - stfd = NULL; | ||
| 118 | - | ||
| 119 | - // st does not close it sometimes, | ||
| 120 | - // close it manually. | ||
| 121 | - close(fd); | ||
| 122 | - } | ||
| 123 | -} | ||
| 124 | - |
| @@ -46,8 +46,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -46,8 +46,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 46 | #include <stddef.h> | 46 | #include <stddef.h> |
| 47 | #include <sys/types.h> | 47 | #include <sys/types.h> |
| 48 | 48 | ||
| 49 | -#include <st.h> | ||
| 50 | - | ||
| 51 | // generated by configure. | 49 | // generated by configure. |
| 52 | #include <srs_auto_headers.hpp> | 50 | #include <srs_auto_headers.hpp> |
| 53 | 51 | ||
| @@ -104,9 +102,6 @@ extern std::string srs_dns_resolve(std::string host); | @@ -104,9 +102,6 @@ extern std::string srs_dns_resolve(std::string host); | ||
| 104 | // app...vhost...request_vhost | 102 | // app...vhost...request_vhost |
| 105 | extern void srs_vhost_resolve(std::string& vhost, std::string& app); | 103 | extern void srs_vhost_resolve(std::string& vhost, std::string& app); |
| 106 | 104 | ||
| 107 | -// close the netfd, and close the underlayer fd. | ||
| 108 | -extern void srs_close_stfd(st_netfd_t& stfd); | ||
| 109 | - | ||
| 110 | /** | 105 | /** |
| 111 | * disable copy constructor of class | 106 | * disable copy constructor of class |
| 112 | */ | 107 | */ |
| @@ -52,6 +52,8 @@ file | @@ -52,6 +52,8 @@ file | ||
| 52 | ..\app\srs_core_thread.cpp, | 52 | ..\app\srs_core_thread.cpp, |
| 53 | ..\app\srs_core_server.hpp, | 53 | ..\app\srs_core_server.hpp, |
| 54 | ..\app\srs_core_server.cpp, | 54 | ..\app\srs_core_server.cpp, |
| 55 | + ..\app\srs_core_st.hpp, | ||
| 56 | + ..\app\srs_core_st.cpp, | ||
| 55 | ..\app\srs_core_stream.hpp, | 57 | ..\app\srs_core_stream.hpp, |
| 56 | ..\app\srs_core_stream.cpp, | 58 | ..\app\srs_core_stream.cpp, |
| 57 | ..\app\srs_core_socket.hpp, | 59 | ..\app\srs_core_socket.hpp, |
-
请 注册 或 登录 后发表评论