diff --git a/trunk/configure b/trunk/configure index e850a4bee..732f2f6d8 100755 --- a/trunk/configure +++ b/trunk/configure @@ -82,7 +82,7 @@ LibSTfile="${LibSTRoot}/libst.a" MODULE_ID="CORE" MODULE_DEPENDS=() ModuleLibIncs=(${LibSTRoot}) -MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" "srs_core_error" "srs_core_conn") +MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" "srs_core_error" "srs_core_conn" "srs_core_conn_rtmp") MODULE_DIR="src/core" . auto/modules.sh CORE_OBJS="${MODULE_OBJS[@]}" diff --git a/trunk/src/core/srs_core_conn.cpp b/trunk/src/core/srs_core_conn.cpp index 865067325..4da3967bd 100755 --- a/trunk/src/core/srs_core_conn.cpp +++ b/trunk/src/core/srs_core_conn.cpp @@ -51,12 +51,6 @@ int SrsConnection::start() return ret; } -int SrsConnection::do_cycle() -{ - int ret = ERROR_SUCCESS; - return ret; -} - void SrsConnection::cycle() { int ret = ERROR_SUCCESS; diff --git a/trunk/src/core/srs_core_conn.hpp b/trunk/src/core/srs_core_conn.hpp index 054d30511..8cf2b1a20 100755 --- a/trunk/src/core/srs_core_conn.hpp +++ b/trunk/src/core/srs_core_conn.hpp @@ -43,8 +43,9 @@ public: virtual ~SrsConnection(); public: virtual int start(); +protected: + virtual int do_cycle() = 0; private: - virtual int do_cycle(); virtual void cycle(); static void* cycle_thread(void* arg); }; diff --git a/trunk/src/core/srs_core_conn_rtmp.cpp b/trunk/src/core/srs_core_conn_rtmp.cpp new file mode 100755 index 000000000..0c15f0dff --- /dev/null +++ b/trunk/src/core/srs_core_conn_rtmp.cpp @@ -0,0 +1,42 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013 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 + +#include + +SrsRtmpConnection::SrsRtmpConnection(SrsServer* srs_server, st_netfd_t client_stfd) + : SrsConnection(srs_server, client_stfd) +{ +} + +SrsRtmpConnection::~SrsRtmpConnection() +{ +} + +int SrsRtmpConnection::do_cycle() +{ + int ret = ERROR_SUCCESS; + return ret; +} + diff --git a/trunk/src/core/srs_core_conn_rtmp.hpp b/trunk/src/core/srs_core_conn_rtmp.hpp new file mode 100755 index 000000000..6e5330012 --- /dev/null +++ b/trunk/src/core/srs_core_conn_rtmp.hpp @@ -0,0 +1,42 @@ +/* +The MIT License (MIT) + +Copyright (c) 2013 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_CONN_RTMP_HPP +#define SRS_CORE_CONN_RTMP_HPP + +/* +#include +*/ + +#include + +class SrsRtmpConnection : public SrsConnection +{ +public: + SrsRtmpConnection(SrsServer* srs_server, st_netfd_t client_stfd); + virtual ~SrsRtmpConnection(); +protected: + virtual int do_cycle(); +}; + +#endif \ No newline at end of file diff --git a/trunk/src/core/srs_core_server.cpp b/trunk/src/core/srs_core_server.cpp index f721b0e7c..55d1b66c2 100755 --- a/trunk/src/core/srs_core_server.cpp +++ b/trunk/src/core/srs_core_server.cpp @@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include +#include #define SERVER_LISTEN_BACKLOG 10 @@ -135,6 +135,7 @@ int SrsServer::start(int port) int SrsServer::cycle() { int ret = ERROR_SUCCESS; + // TODO: canbe a api thread. st_thread_exit(NULL); return ret; } @@ -156,7 +157,7 @@ int SrsServer::accept_client(st_netfd_t client_stfd) { int ret = ERROR_SUCCESS; - SrsConnection* conn = new SrsConnection(this, client_stfd); + SrsConnection* conn = new SrsRtmpConnection(this, client_stfd); // directly enqueue, the cycle thread will remove the client. conns.push_back(conn); diff --git a/trunk/src/main/srs_main_server.cpp b/trunk/src/main/srs_main_server.cpp index 548022706..1e7524a22 100755 --- a/trunk/src/main/srs_main_server.cpp +++ b/trunk/src/main/srs_main_server.cpp @@ -21,12 +21,12 @@ 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 - #include #include #include +#include + int main(int /*argc*/, char** /*argv*/){ int ret = ERROR_SUCCESS; diff --git a/trunk/src/srs/srs.upp b/trunk/src/srs/srs.upp index cd84fb5ac..2badd3b79 100755 --- a/trunk/src/srs/srs.upp +++ b/trunk/src/srs/srs.upp @@ -10,6 +10,8 @@ file ..\core\srs_core_server.cpp, ..\core\srs_core_conn.hpp, ..\core\srs_core_conn.cpp, + ..\core\srs_core_conn_rtmp.hpp, + ..\core\srs_core_conn_rtmp.cpp, ..\core\srs_core_log.hpp, ..\core\srs_core_log.cpp; mainconfig