diff --git a/trunk/src/app/srs_app_edge.cpp b/trunk/src/app/srs_app_edge.cpp index 2dc6211e2..c67c2561e 100644 --- a/trunk/src/app/srs_app_edge.cpp +++ b/trunk/src/app/srs_app_edge.cpp @@ -306,7 +306,7 @@ int SrsEdgeIngester::connect_server() srs_freep(io); srs_assert(stfd); - io = new SrsSocket(stfd); + io = new SrsStSocket(stfd); client = new SrsRtmpClient(io); kbps->set_io(io, io); @@ -559,7 +559,7 @@ int SrsEdgeForwarder::connect_server() srs_freep(io); srs_assert(stfd); - io = new SrsSocket(stfd); + io = new SrsStSocket(stfd); client = new SrsRtmpClient(io); kbps->set_io(io, io); diff --git a/trunk/src/app/srs_app_edge.hpp b/trunk/src/app/srs_app_edge.hpp index a5d0e2997..6bcc7cbf2 100644 --- a/trunk/src/app/srs_app_edge.hpp +++ b/trunk/src/app/srs_app_edge.hpp @@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -class SrsSocket; +class SrsStSocket; class SrsRtmpServer; class SrsSource; class SrsRequest; diff --git a/trunk/src/app/srs_app_forward.cpp b/trunk/src/app/srs_app_forward.cpp index bbec67539..4e8e36a84 100644 --- a/trunk/src/app/srs_app_forward.cpp +++ b/trunk/src/app/srs_app_forward.cpp @@ -266,7 +266,7 @@ int SrsForwarder::connect_server() srs_freep(io); srs_assert(stfd); - io = new SrsSocket(stfd); + io = new SrsStSocket(stfd); client = new SrsRtmpClient(io); kbps->set_io(io, io); diff --git a/trunk/src/app/srs_app_http.cpp b/trunk/src/app/srs_app_http.cpp index 4710ebb1b..70b6f87f6 100644 --- a/trunk/src/app/srs_app_http.cpp +++ b/trunk/src/app/srs_app_http.cpp @@ -97,7 +97,7 @@ bool SrsHttpHandler::can_handle(const char* /*path*/, int /*length*/, const char return false; } -int SrsHttpHandler::process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsHttpHandler::process_request(SrsStSocket* skt, SrsHttpMessage* req) { if (req->method() == SRS_CONSTS_HTTP_OPTIONS) { req->set_requires_crossdomain(true); @@ -136,13 +136,13 @@ bool SrsHttpHandler::is_handler_valid(SrsHttpMessage* req, int& status_code, str return true; } -int SrsHttpHandler::do_process_request(SrsSocket* /*skt*/, SrsHttpMessage* /*req*/) +int SrsHttpHandler::do_process_request(SrsStSocket* /*skt*/, SrsHttpMessage* /*req*/) { int ret = ERROR_SUCCESS; return ret; } -int SrsHttpHandler::response_error(SrsSocket* skt, SrsHttpMessage* req, int code, string desc) +int SrsHttpHandler::response_error(SrsStSocket* skt, SrsHttpMessage* req, int code, string desc) { std::stringstream ss; ss << __SRS_JOBJECT_START @@ -334,12 +334,12 @@ SrsHttpHandler* SrsHttpHandler::res_body(stringstream& ss, string body) return this; } -int SrsHttpHandler::res_flush(SrsSocket* skt, stringstream& ss) +int SrsHttpHandler::res_flush(SrsStSocket* skt, stringstream& ss) { return skt->write((void*)ss.str().c_str(), ss.str().length(), NULL); } -int SrsHttpHandler::res_options(SrsSocket* skt) +int SrsHttpHandler::res_options(SrsStSocket* skt) { std::stringstream ss; @@ -350,7 +350,7 @@ int SrsHttpHandler::res_options(SrsSocket* skt) return res_flush(skt, ss); } -int SrsHttpHandler::res_text(SrsSocket* skt, SrsHttpMessage* req, string body) +int SrsHttpHandler::res_text(SrsStSocket* skt, SrsHttpMessage* req, string body) { std::stringstream ss; @@ -367,7 +367,7 @@ int SrsHttpHandler::res_text(SrsSocket* skt, SrsHttpMessage* req, string body) return res_flush(skt, ss); } -int SrsHttpHandler::res_xml(SrsSocket* skt, SrsHttpMessage* req, string body) +int SrsHttpHandler::res_xml(SrsStSocket* skt, SrsHttpMessage* req, string body) { std::stringstream ss; @@ -384,7 +384,7 @@ int SrsHttpHandler::res_xml(SrsSocket* skt, SrsHttpMessage* req, string body) return res_flush(skt, ss); } -int SrsHttpHandler::res_javascript(SrsSocket* skt, SrsHttpMessage* req, string body) +int SrsHttpHandler::res_javascript(SrsStSocket* skt, SrsHttpMessage* req, string body) { std::stringstream ss; @@ -401,7 +401,7 @@ int SrsHttpHandler::res_javascript(SrsSocket* skt, SrsHttpMessage* req, string b return res_flush(skt, ss); } -int SrsHttpHandler::res_swf(SrsSocket* skt, SrsHttpMessage* req, string body) +int SrsHttpHandler::res_swf(SrsStSocket* skt, SrsHttpMessage* req, string body) { std::stringstream ss; @@ -418,7 +418,7 @@ int SrsHttpHandler::res_swf(SrsSocket* skt, SrsHttpMessage* req, string body) return res_flush(skt, ss); } -int SrsHttpHandler::res_css(SrsSocket* skt, SrsHttpMessage* req, string body) +int SrsHttpHandler::res_css(SrsStSocket* skt, SrsHttpMessage* req, string body) { std::stringstream ss; @@ -435,7 +435,7 @@ int SrsHttpHandler::res_css(SrsSocket* skt, SrsHttpMessage* req, string body) return res_flush(skt, ss); } -int SrsHttpHandler::res_ico(SrsSocket* skt, SrsHttpMessage* req, string body) +int SrsHttpHandler::res_ico(SrsStSocket* skt, SrsHttpMessage* req, string body) { std::stringstream ss; @@ -452,7 +452,7 @@ int SrsHttpHandler::res_ico(SrsSocket* skt, SrsHttpMessage* req, string body) return res_flush(skt, ss); } -int SrsHttpHandler::res_m3u8(SrsSocket* skt, SrsHttpMessage* req, string body) +int SrsHttpHandler::res_m3u8(SrsStSocket* skt, SrsHttpMessage* req, string body) { std::stringstream ss; @@ -469,7 +469,7 @@ int SrsHttpHandler::res_m3u8(SrsSocket* skt, SrsHttpMessage* req, string body) return res_flush(skt, ss); } -int SrsHttpHandler::res_mpegts(SrsSocket* skt, SrsHttpMessage* req, string body) +int SrsHttpHandler::res_mpegts(SrsStSocket* skt, SrsHttpMessage* req, string body) { std::stringstream ss; @@ -486,7 +486,7 @@ int SrsHttpHandler::res_mpegts(SrsSocket* skt, SrsHttpMessage* req, string body) return res_flush(skt, ss); } -int SrsHttpHandler::res_json(SrsSocket* skt, SrsHttpMessage* req, string json) +int SrsHttpHandler::res_json(SrsStSocket* skt, SrsHttpMessage* req, string json) { std::stringstream ss; @@ -503,7 +503,7 @@ int SrsHttpHandler::res_json(SrsSocket* skt, SrsHttpMessage* req, string json) return res_flush(skt, ss); } -int SrsHttpHandler::res_error(SrsSocket* skt, SrsHttpMessage* req, int code, string reason_phrase, string body) +int SrsHttpHandler::res_error(SrsStSocket* skt, SrsHttpMessage* req, int code, string reason_phrase, string body) { std::stringstream ss; @@ -829,7 +829,7 @@ int SrsHttpParser::initialize(enum http_parser_type type) return ret; } -int SrsHttpParser::parse_message(SrsSocket* skt, SrsHttpMessage** ppmsg) +int SrsHttpParser::parse_message(SrsStSocket* skt, SrsHttpMessage** ppmsg) { *ppmsg = NULL; @@ -861,7 +861,7 @@ int SrsHttpParser::parse_message(SrsSocket* skt, SrsHttpMessage** ppmsg) return ret; } -int SrsHttpParser::parse_message_imp(SrsSocket* skt) +int SrsHttpParser::parse_message_imp(SrsStSocket* skt) { int ret = ERROR_SUCCESS; diff --git a/trunk/src/app/srs_app_http.hpp b/trunk/src/app/srs_app_http.hpp index 365272b21..ae7f8206d 100644 --- a/trunk/src/app/srs_app_http.hpp +++ b/trunk/src/app/srs_app_http.hpp @@ -41,7 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. class SrsBuffer; class SrsRequest; -class SrsSocket; +class SrsStSocket; class SrsHttpUri; class SrsHttpMessage; class SrsHttpHandler; @@ -123,7 +123,7 @@ public: * use the handler to process the request. * @remark sub classes should override the do_process_request. */ - virtual int process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int process_request(SrsStSocket* skt, SrsHttpMessage* req); public: /** * find the best matched handler @@ -143,12 +143,12 @@ protected: * do the actual process of request., format as, for example: * {"code":0, "data":{}} */ - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); /** * response error, format as, for example: * {"code":100, "desc":"description"} */ - virtual int response_error(SrsSocket* skt, SrsHttpMessage* req, int code, std::string desc); + virtual int response_error(SrsStSocket* skt, SrsHttpMessage* req, int code, std::string desc); // response writer public: virtual SrsHttpHandler* res_status_line(std::stringstream& ss); @@ -167,19 +167,19 @@ public: virtual SrsHttpHandler* res_enable_crossdomain(std::stringstream& ss); virtual SrsHttpHandler* res_header_eof(std::stringstream& ss); virtual SrsHttpHandler* res_body(std::stringstream& ss, std::string body); - virtual int res_flush(SrsSocket* skt, std::stringstream& ss); + virtual int res_flush(SrsStSocket* skt, std::stringstream& ss); public: - virtual int res_options(SrsSocket* skt); - virtual int res_text(SrsSocket* skt, SrsHttpMessage* req, std::string body); - virtual int res_xml(SrsSocket* skt, SrsHttpMessage* req, std::string body); - virtual int res_javascript(SrsSocket* skt, SrsHttpMessage* req, std::string body); - virtual int res_swf(SrsSocket* skt, SrsHttpMessage* req, std::string body); - virtual int res_css(SrsSocket* skt, SrsHttpMessage* req, std::string body); - virtual int res_ico(SrsSocket* skt, SrsHttpMessage* req, std::string body); - virtual int res_m3u8(SrsSocket* skt, SrsHttpMessage* req, std::string body); - virtual int res_mpegts(SrsSocket* skt, SrsHttpMessage* req, std::string body); - virtual int res_json(SrsSocket* skt, SrsHttpMessage* req, std::string json); - virtual int res_error(SrsSocket* skt, SrsHttpMessage* req, int code, std::string reason_phrase, std::string body); + virtual int res_options(SrsStSocket* skt); + virtual int res_text(SrsStSocket* skt, SrsHttpMessage* req, std::string body); + virtual int res_xml(SrsStSocket* skt, SrsHttpMessage* req, std::string body); + virtual int res_javascript(SrsStSocket* skt, SrsHttpMessage* req, std::string body); + virtual int res_swf(SrsStSocket* skt, SrsHttpMessage* req, std::string body); + virtual int res_css(SrsStSocket* skt, SrsHttpMessage* req, std::string body); + virtual int res_ico(SrsStSocket* skt, SrsHttpMessage* req, std::string body); + virtual int res_m3u8(SrsStSocket* skt, SrsHttpMessage* req, std::string body); + virtual int res_mpegts(SrsStSocket* skt, SrsHttpMessage* req, std::string body); + virtual int res_json(SrsStSocket* skt, SrsHttpMessage* req, std::string json); + virtual int res_error(SrsStSocket* skt, SrsHttpMessage* req, int code, std::string reason_phrase, std::string body); // object creator public: /** @@ -313,12 +313,12 @@ public: * or error and *ppmsg must be NULL. * @remark, if success, *ppmsg always NOT-NULL, *ppmsg always is_complete(). */ - virtual int parse_message(SrsSocket* skt, SrsHttpMessage** ppmsg); + virtual int parse_message(SrsStSocket* skt, SrsHttpMessage** ppmsg); private: /** * parse the HTTP message to member field: msg. */ - virtual int parse_message_imp(SrsSocket* skt); + virtual int parse_message_imp(SrsStSocket* skt); private: static int on_message_begin(http_parser* parser); static int on_headers_complete(http_parser* parser); diff --git a/trunk/src/app/srs_app_http_api.cpp b/trunk/src/app/srs_app_http_api.cpp index d54779159..1e015b655 100644 --- a/trunk/src/app/srs_app_http_api.cpp +++ b/trunk/src/app/srs_app_http_api.cpp @@ -72,7 +72,7 @@ bool SrsApiRoot::can_handle(const char* path, int length, const char** pchild) return srs_path_equals("/", path, 1); } -int SrsApiRoot::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiRoot::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; @@ -100,7 +100,7 @@ bool SrsApiApi::can_handle(const char* path, int length, const char** /*pchild*/ return srs_path_equals("/api", path, length); } -int SrsApiApi::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiApi::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; @@ -135,7 +135,7 @@ bool SrsApiV1::can_handle(const char* path, int length, const char** /*pchild*/) return srs_path_equals("/v1", path, length); } -int SrsApiV1::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiV1::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; @@ -169,7 +169,7 @@ bool SrsApiRequests::can_handle(const char* path, int length, const char** /*pch return srs_path_equals("/requests", path, length); } -int SrsApiRequests::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiRequests::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; @@ -233,7 +233,7 @@ bool SrsApiVersion::can_handle(const char* path, int length, const char** /*pchi return srs_path_equals("/versions", path, length); } -int SrsApiVersion::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiVersion::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; @@ -263,7 +263,7 @@ bool SrsApiSummaries::can_handle(const char* path, int length, const char** /*pc return srs_path_equals("/summaries", path, length); } -int SrsApiSummaries::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiSummaries::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; srs_api_dump_summaries(ss); @@ -283,7 +283,7 @@ bool SrsApiRusages::can_handle(const char* path, int length, const char** /*pchi return srs_path_equals("/rusages", path, length); } -int SrsApiRusages::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiRusages::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; @@ -329,7 +329,7 @@ bool SrsApiSelfProcStats::can_handle(const char* path, int length, const char** return srs_path_equals("/self_proc_stats", path, length); } -int SrsApiSelfProcStats::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiSelfProcStats::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; @@ -404,7 +404,7 @@ bool SrsApiSystemProcStats::can_handle(const char* path, int length, const char* return srs_path_equals("/system_proc_stats", path, length); } -int SrsApiSystemProcStats::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiSystemProcStats::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; @@ -444,7 +444,7 @@ bool SrsApiMemInfos::can_handle(const char* path, int length, const char** /*pch return srs_path_equals("/meminfos", path, length); } -int SrsApiMemInfos::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiMemInfos::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; @@ -485,7 +485,7 @@ bool SrsApiAuthors::can_handle(const char* path, int length, const char** /*pchi return srs_path_equals("/authors", path, length); } -int SrsApiAuthors::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsApiAuthors::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { std::stringstream ss; @@ -544,7 +544,7 @@ int SrsHttpApi::do_cycle() } // underlayer socket - SrsSocket skt(stfd); + SrsStSocket skt(stfd); // process http messages. for (;;) { @@ -571,7 +571,7 @@ int SrsHttpApi::do_cycle() return ret; } -int SrsHttpApi::process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsHttpApi::process_request(SrsStSocket* skt, SrsHttpMessage* req) { int ret = ERROR_SUCCESS; diff --git a/trunk/src/app/srs_app_http_api.hpp b/trunk/src/app/srs_app_http_api.hpp index 52d02c17d..279e1762d 100644 --- a/trunk/src/app/srs_app_http_api.hpp +++ b/trunk/src/app/srs_app_http_api.hpp @@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef SRS_AUTO_HTTP_API -class SrsSocket; +class SrsStSocket; class SrsHttpMessage; class SrsHttpParser; class SrsHttpHandler; @@ -51,7 +51,7 @@ public: virtual bool is_handler_valid(SrsHttpMessage* req, int& status_code, std::string& reason_phrase); protected: virtual bool can_handle(const char* path, int length, const char** pchild); - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsApiApi : public SrsHttpHandler @@ -62,7 +62,7 @@ public: public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsApiV1 : public SrsHttpHandler @@ -73,7 +73,7 @@ public: public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsApiRequests : public SrsHttpHandler @@ -84,7 +84,7 @@ public: public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsApiVersion : public SrsHttpHandler @@ -95,7 +95,7 @@ public: public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsApiSummaries : public SrsHttpHandler @@ -106,7 +106,7 @@ public: public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsApiRusages : public SrsHttpHandler @@ -117,7 +117,7 @@ public: public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsApiSelfProcStats : public SrsHttpHandler @@ -128,7 +128,7 @@ public: public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsApiSystemProcStats : public SrsHttpHandler @@ -139,7 +139,7 @@ public: public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsApiMemInfos : public SrsHttpHandler @@ -150,7 +150,7 @@ public: public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsApiAuthors : public SrsHttpHandler @@ -161,7 +161,7 @@ public: public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsHttpApi : public SrsConnection @@ -182,7 +182,7 @@ public: protected: virtual int do_cycle(); private: - virtual int process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int process_request(SrsStSocket* skt, SrsHttpMessage* req); }; #endif diff --git a/trunk/src/app/srs_app_http_client.cpp b/trunk/src/app/srs_app_http_client.cpp index d1e0c1bce..befa14c85 100644 --- a/trunk/src/app/srs_app_http_client.cpp +++ b/trunk/src/app/srs_app_http_client.cpp @@ -85,7 +85,7 @@ int SrsHttpClient::post(SrsHttpUri* uri, string req, string& res) << __SRS_CRLF << req; - SrsSocket skt(stfd); + SrsStSocket skt(stfd); std::string data = ss.str(); if ((ret = skt.write((void*)data.c_str(), data.length(), NULL)) != ERROR_SUCCESS) { diff --git a/trunk/src/app/srs_app_http_conn.cpp b/trunk/src/app/srs_app_http_conn.cpp index cb19518e6..17c8c8aea 100644 --- a/trunk/src/app/srs_app_http_conn.cpp +++ b/trunk/src/app/srs_app_http_conn.cpp @@ -124,7 +124,7 @@ bool SrsHttpRoot::is_handler_valid(SrsHttpMessage* req, int& status_code, std::s return false; } -int SrsHttpRoot::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsHttpRoot::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { int ret = ERROR_SUCCESS; return ret; @@ -161,7 +161,7 @@ bool SrsHttpVhost::is_handler_valid(SrsHttpMessage* req, int& status_code, std:: return true; } -int SrsHttpVhost::do_process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsHttpVhost::do_process_request(SrsStSocket* skt, SrsHttpMessage* req) { int ret = ERROR_SUCCESS; @@ -188,7 +188,7 @@ int SrsHttpVhost::do_process_request(SrsSocket* skt, SrsHttpMessage* req) return ret; } -int SrsHttpVhost::response_regular_file(SrsSocket* skt, SrsHttpMessage* req, string fullpath) +int SrsHttpVhost::response_regular_file(SrsStSocket* skt, SrsHttpMessage* req, string fullpath) { int ret = ERROR_SUCCESS; @@ -235,7 +235,7 @@ int SrsHttpVhost::response_regular_file(SrsSocket* skt, SrsHttpMessage* req, str return ret; } -int SrsHttpVhost::response_flv_file(SrsSocket* skt, SrsHttpMessage* req, string fullpath) +int SrsHttpVhost::response_flv_file(SrsStSocket* skt, SrsHttpMessage* req, string fullpath) { int ret = ERROR_SUCCESS; @@ -286,7 +286,7 @@ int SrsHttpVhost::response_flv_file(SrsSocket* skt, SrsHttpMessage* req, string return ret; } -int SrsHttpVhost::response_flv_file2(SrsSocket* skt, SrsHttpMessage* req, string fullpath, int offset) +int SrsHttpVhost::response_flv_file2(SrsStSocket* skt, SrsHttpMessage* req, string fullpath, int offset) { int ret = ERROR_SUCCESS; @@ -390,7 +390,7 @@ int SrsHttpVhost::response_flv_file2(SrsSocket* skt, SrsHttpMessage* req, string return ret; } -int SrsHttpVhost::response_ts_file(SrsSocket* skt, SrsHttpMessage* req, string fullpath) +int SrsHttpVhost::response_ts_file(SrsStSocket* skt, SrsHttpMessage* req, string fullpath) { int ret = ERROR_SUCCESS; @@ -524,7 +524,7 @@ int SrsHttpConn::do_cycle() } // underlayer socket - SrsSocket skt(stfd); + SrsStSocket skt(stfd); // process http messages. for (;;) { @@ -551,7 +551,7 @@ int SrsHttpConn::do_cycle() return ret; } -int SrsHttpConn::process_request(SrsSocket* skt, SrsHttpMessage* req) +int SrsHttpConn::process_request(SrsStSocket* skt, SrsHttpMessage* req) { int ret = ERROR_SUCCESS; diff --git a/trunk/src/app/srs_app_http_conn.hpp b/trunk/src/app/srs_app_http_conn.hpp index 0dc35d0da..9957fcb5f 100644 --- a/trunk/src/app/srs_app_http_conn.hpp +++ b/trunk/src/app/srs_app_http_conn.hpp @@ -36,7 +36,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -class SrsSocket; +class SrsStSocket; class SrsHttpParser; class SrsHttpMessage; class SrsHttpHandler; @@ -52,7 +52,7 @@ public: virtual int best_match(const char* path, int length, SrsHttpHandlerMatch** ppmatch); protected: virtual bool is_handler_valid(SrsHttpMessage* req, int& status_code, std::string& reason_phrase); - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); }; class SrsHttpVhost : public SrsHttpHandler @@ -68,12 +68,12 @@ public: virtual bool can_handle(const char* path, int length, const char** pchild); protected: virtual bool is_handler_valid(SrsHttpMessage* req, int& status_code, std::string& reason_phrase); - virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int do_process_request(SrsStSocket* skt, SrsHttpMessage* req); private: - virtual int response_regular_file(SrsSocket* skt, SrsHttpMessage* req, std::string fullpath); - virtual int response_flv_file(SrsSocket* skt, SrsHttpMessage* req, std::string fullpath); - virtual int response_flv_file2(SrsSocket* skt, SrsHttpMessage* req, std::string fullpath, int offset); - virtual int response_ts_file(SrsSocket* skt, SrsHttpMessage* req, std::string fullpath); + virtual int response_regular_file(SrsStSocket* skt, SrsHttpMessage* req, std::string fullpath); + virtual int response_flv_file(SrsStSocket* skt, SrsHttpMessage* req, std::string fullpath); + virtual int response_flv_file2(SrsStSocket* skt, SrsHttpMessage* req, std::string fullpath, int offset); + virtual int response_ts_file(SrsStSocket* skt, SrsHttpMessage* req, std::string fullpath); virtual std::string get_request_file(SrsHttpMessage* req); public: virtual std::string vhost(); @@ -99,7 +99,7 @@ public: protected: virtual int do_cycle(); private: - virtual int process_request(SrsSocket* skt, SrsHttpMessage* req); + virtual int process_request(SrsStSocket* skt, SrsHttpMessage* req); }; #endif diff --git a/trunk/src/app/srs_app_http_hooks.hpp b/trunk/src/app/srs_app_http_hooks.hpp index 091233f20..014729a94 100644 --- a/trunk/src/app/srs_app_http_hooks.hpp +++ b/trunk/src/app/srs_app_http_hooks.hpp @@ -36,7 +36,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include class SrsHttpUri; -class SrsSocket; +class SrsStSocket; class SrsRequest; class SrsHttpParser; class SrsFlvSegment; diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index deb1f60ac..3c7cb3981 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -79,7 +79,7 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd) { req = new SrsRequest(); res = new SrsResponse(); - skt = new SrsSocket(client_stfd); + skt = new SrsStSocket(client_stfd); rtmp = new SrsRtmpServer(skt); refer = new SrsRefer(); bandwidth = new SrsBandwidth(); @@ -910,7 +910,7 @@ int SrsRtmpConn::check_edge_token_traverse_auth() } srs_assert(stsock); - SrsSocket* io = new SrsSocket(stsock); + SrsStSocket* io = new SrsStSocket(stsock); SrsRtmpClient* client = new SrsRtmpClient(io); ret = do_token_traverse_auth(io, client); @@ -956,7 +956,7 @@ int SrsRtmpConn::connect_server(int origin_index, st_netfd_t* pstsock) return ret; } -int SrsRtmpConn::do_token_traverse_auth(SrsSocket* io, SrsRtmpClient* client) +int SrsRtmpConn::do_token_traverse_auth(SrsStSocket* io, SrsRtmpClient* client) { int ret = ERROR_SUCCESS; diff --git a/trunk/src/app/srs_app_rtmp_conn.hpp b/trunk/src/app/srs_app_rtmp_conn.hpp index fde77f068..65cfb4538 100644 --- a/trunk/src/app/srs_app_rtmp_conn.hpp +++ b/trunk/src/app/srs_app_rtmp_conn.hpp @@ -41,7 +41,7 @@ class SrsSource; class SrsRefer; class SrsConsumer; class SrsMessage; -class SrsSocket; +class SrsStSocket; #ifdef SRS_AUTO_HTTP_CALLBACK class SrsHttpHooks; #endif @@ -58,7 +58,7 @@ class SrsRtmpConn : public virtual SrsConnection, public virtual ISrsReloadHandl private: SrsRequest* req; SrsResponse* res; - SrsSocket* skt; + SrsStSocket* skt; SrsRtmpServer* rtmp; SrsRefer* refer; SrsBandwidth* bandwidth; @@ -95,7 +95,7 @@ private: private: virtual int check_edge_token_traverse_auth(); virtual int connect_server(int origin_index, st_netfd_t* pstsock); - virtual int do_token_traverse_auth(SrsSocket* io, SrsRtmpClient* client); + virtual int do_token_traverse_auth(SrsStSocket* io, SrsRtmpClient* client); private: virtual int http_hooks_on_connect(); virtual void http_hooks_on_close(); diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index bec0e7043..b2efce47b 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -45,7 +45,7 @@ class SrsOnMetaDataPacket; class SrsSharedPtrMessage; class SrsForwarder; class SrsRequest; -class SrsSocket; +class SrsStSocket; class SrsRtmpServer; class SrsEdgeProxyContext; #ifdef SRS_AUTO_HLS diff --git a/trunk/src/app/srs_app_st_socket.cpp b/trunk/src/app/srs_app_st_socket.cpp index 885360d84..dd8c06aea 100644 --- a/trunk/src/app/srs_app_st_socket.cpp +++ b/trunk/src/app/srs_app_st_socket.cpp @@ -26,53 +26,53 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -SrsSocket::SrsSocket(st_netfd_t client_stfd) +SrsStSocket::SrsStSocket(st_netfd_t client_stfd) { stfd = client_stfd; send_timeout = recv_timeout = ST_UTIME_NO_TIMEOUT; recv_bytes = send_bytes = 0; } -SrsSocket::~SrsSocket() +SrsStSocket::~SrsStSocket() { } -bool SrsSocket::is_never_timeout(int64_t timeout_us) +bool SrsStSocket::is_never_timeout(int64_t timeout_us) { return timeout_us == (int64_t)ST_UTIME_NO_TIMEOUT; } -void SrsSocket::set_recv_timeout(int64_t timeout_us) +void SrsStSocket::set_recv_timeout(int64_t timeout_us) { recv_timeout = timeout_us; } -int64_t SrsSocket::get_recv_timeout() +int64_t SrsStSocket::get_recv_timeout() { return recv_timeout; } -void SrsSocket::set_send_timeout(int64_t timeout_us) +void SrsStSocket::set_send_timeout(int64_t timeout_us) { send_timeout = timeout_us; } -int64_t SrsSocket::get_send_timeout() +int64_t SrsStSocket::get_send_timeout() { return send_timeout; } -int64_t SrsSocket::get_recv_bytes() +int64_t SrsStSocket::get_recv_bytes() { return recv_bytes; } -int64_t SrsSocket::get_send_bytes() +int64_t SrsStSocket::get_send_bytes() { return send_bytes; } -int SrsSocket::read(void* buf, size_t size, ssize_t* nread) +int SrsStSocket::read(void* buf, size_t size, ssize_t* nread) { int ret = ERROR_SUCCESS; @@ -100,7 +100,7 @@ int SrsSocket::read(void* buf, size_t size, ssize_t* nread) return ret; } -int SrsSocket::read_fully(void* buf, size_t size, ssize_t* nread) +int SrsStSocket::read_fully(void* buf, size_t size, ssize_t* nread) { int ret = ERROR_SUCCESS; @@ -128,7 +128,7 @@ int SrsSocket::read_fully(void* buf, size_t size, ssize_t* nread) return ret; } -int SrsSocket::write(void* buf, size_t size, ssize_t* nwrite) +int SrsStSocket::write(void* buf, size_t size, ssize_t* nwrite) { int ret = ERROR_SUCCESS; @@ -150,7 +150,7 @@ int SrsSocket::write(void* buf, size_t size, ssize_t* nwrite) return ret; } -int SrsSocket::writev(const iovec *iov, int iov_size, ssize_t* nwrite) +int SrsStSocket::writev(const iovec *iov, int iov_size, ssize_t* nwrite) { int ret = ERROR_SUCCESS; diff --git a/trunk/src/app/srs_app_st_socket.hpp b/trunk/src/app/srs_app_st_socket.hpp index a267f558e..92357e305 100644 --- a/trunk/src/app/srs_app_st_socket.hpp +++ b/trunk/src/app/srs_app_st_socket.hpp @@ -37,7 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * the socket provides TCP socket over st, * that is, the sync socket mechanism. */ -class SrsSocket : public ISrsProtocolReaderWriter +class SrsStSocket : public ISrsProtocolReaderWriter { private: int64_t recv_timeout; @@ -46,8 +46,8 @@ private: int64_t send_bytes; st_netfd_t stfd; public: - SrsSocket(st_netfd_t client_stfd); - virtual ~SrsSocket(); + SrsStSocket(st_netfd_t client_stfd); + virtual ~SrsStSocket(); public: virtual bool is_never_timeout(int64_t timeout_us); virtual void set_recv_timeout(int64_t timeout_us);