diff --git a/README.md b/README.md index 1c5e1577b..fb2398638 100755 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ url: rtmp://127.0.0.1:1935/live/livestream * nginx v1.5.0: 139524 lines
### History +* v0.4, 2013-11-10, support config and reload the pithy print. * v0.4, 2013-11-09, support reload config(vhost and its detail). * v0.4, 2013-11-09, support reload config(listen and chunk_size) by SIGHUP(1). * v0.4, 2013-11-09, support longtime(>4.6hours) publish/play. diff --git a/trunk/3rdparty/http-parser-2.1.zip b/trunk/3rdparty/http-parser-2.1.zip new file mode 100644 index 000000000..e8452f83b Binary files /dev/null and b/trunk/3rdparty/http-parser-2.1.zip differ diff --git a/trunk/auto/modules.sh b/trunk/auto/modules.sh old mode 100644 new mode 100755 index faa097ac9..6a30d706e --- a/trunk/auto/modules.sh +++ b/trunk/auto/modules.sh @@ -15,15 +15,15 @@ FILE=${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} # INCS INCS_NAME="${MODULE_ID}_INCS" echo "# the ${MODULE_ID} module." >> ${FILE} -echo "${MODULE_ID}_MODULE_INCS = -I ${MODULE_DIR} " >> ${FILE} -echo -n "${INCS_NAME} = -I ${MODULE_DIR} " >> ${FILE} +echo "${MODULE_ID}_MODULE_INCS = -I${MODULE_DIR} " >> ${FILE} +echo -n "${INCS_NAME} = -I${MODULE_DIR} " >> ${FILE} for item in ${MODULE_DEPENDS[*]}; do DEP_INCS_NAME="${item}_INCS"do DEP_INCS_NAME="${item}_MODULE_INCS" echo -n "\$(${DEP_INCS_NAME}) " >> ${FILE} done for item in ${ModuleLibIncs[*]}; do - echo -n "-I ${item} " >> ${FILE} + echo -n "-I${item} " >> ${FILE} done echo "" >> ${FILE} @@ -50,7 +50,7 @@ for item in ${MODULE_FILES[*]}; do MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}" if [ -f ${CPP_FILE} ]; then echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE} - echo " \$(GCC) -c \$(CXXFLAGS) \$(${INCS_NAME}) -o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE} + echo " \$(GCC) -c \$(CXXFLAGS) \$(${INCS_NAME})-o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE} fi done echo "" >> ${FILE} diff --git a/trunk/conf/srs.conf b/trunk/conf/srs.conf index 7e8bfeb81..633848f8a 100755 --- a/trunk/conf/srs.conf +++ b/trunk/conf/srs.conf @@ -1,11 +1,11 @@ # the listen ports, split by space. -listen 1935; +listen 1935; # the default chunk size is 128, max is 65536, # some client does not support chunk size change, # however, most clients supports it and it can improve # performance about 10%. # if not specified, set to 4096. -chunk_size 65000; +chunk_size 65000; # vhost list, the __defaultVhost__ is the default vhost # for which cannot identify the required vhost. vhost __defaultVhost__ { @@ -47,4 +47,15 @@ vhost refer.anti_suck.com { # default: not specified. refer_play github.com github.io; } +# config for the pithy print, +# which always print constant message specified by interval, +# whatever the clients in concurrency. +pithy_print { + # shared print interval for all publish clients, in milliseconds. + # if not specified, set to 1100. + publish 2000; + # shared print interval for all play clients, in milliseconds. + # if not specified, set to 1300. + play 3000; +} diff --git a/trunk/configure b/trunk/configure index 71876c391..431e8c537 100755 --- a/trunk/configure +++ b/trunk/configure @@ -16,13 +16,36 @@ if [[ -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.a && -f ${GLOBAL_DIR_OBJS}/st-1.9/o echo "st-1.9t is ok."; else echo "build st-1.9t"; - (rm -rf ${GLOBAL_DIR_OBJS}/st-1.9 && cd ${GLOBAL_DIR_OBJS} && unzip ../3rdparty/st-1.9.zip && cd st-1.9 && make linux-debug) + ( + rm -rf ${GLOBAL_DIR_OBJS}/st-1.9 && cd ${GLOBAL_DIR_OBJS} && + unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && make linux-debug && + cd .. && rm -f st && ln -sf st-1.9/obj st + ) fi # check status ret=$?; if [[ $ret -ne 0 ]]; then echo "build st-1.9 failed, ret=$ret"; exit $ret; fi if [ ! -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.a ]; then echo "build st-1.9 failed."; exit -1; fi if [ ! -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.so ]; then echo "build st-1.9 failed."; exit -1; fi +# http-parser-2.1 +if [[ -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/http_parser.h && -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then + echo "http-parser-2.1 is ok."; +else + echo "build http-parser-2.1"; + ( + rm -rf ${GLOBAL_DIR_OBJS}/http-parser-2.1 && cd ${GLOBAL_DIR_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip && + cd http-parser-2.1 && + sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile && + sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile && + make package && + cd .. && rm -f hp && ln -sf http-parser-2.1 hp + ) +fi +# check status +ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi +if [[ ! -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi +if [[ ! -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi + ##################################################################################### # generate Makefile. ##################################################################################### @@ -53,18 +76,16 @@ END echo 'generate Makefile ok!' # the performance analysis, uncomments the following when use gperf to analysis the performance. see third-party/readme.txt -#Performance="-pg" -#PerformanceLink="-pg" +Performance="-pg" # enable gdb debug GDBDebug="-g -O0" # the warning level. -WarnLevel="-Wall -Wextra" +WarnLevel="-Wall" # the compile standard. -CppStd="-std=c++98" -# other macros defined -UserMacros="" +CppStd="-ansi" # the cxx flag generated. -CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance} ${UserMacros}" +CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug}" +#CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance}" cat << END > ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} CXXFLAGS = ${CXXFLAGS} GCC = g++ @@ -78,19 +99,21 @@ default: END # Libraries -LibSTRoot="${GLOBAL_DIR_OBJS}/st-1.9/obj" +LibSTRoot="${GLOBAL_DIR_OBJS}/st" LibSTfile="${LibSTRoot}/libst.a" +LibHttpParserRoot="${GLOBAL_DIR_OBJS}/hp" +LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a" #Core Module MODULE_ID="CORE" MODULE_DEPENDS=() -ModuleLibIncs=(${LibSTRoot}) +ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot}) MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" "srs_core_error" "srs_core_conn" "srs_core_client" "srs_core_rtmp" "srs_core_socket" "srs_core_buffer" - "srs_core_auto_free" "srs_core_protocol" "srs_core_amf0" + "srs_core_autofree" "srs_core_protocol" "srs_core_amf0" "srs_core_stream" "srs_core_source" "srs_core_codec" - "srs_core_complex_handshake" "srs_core_pithy_print" + "srs_core_handshake" "srs_core_pithy_print" "srs_core_config" "srs_core_refer" "srs_core_reload") MODULE_DIR="src/core" . auto/modules.sh CORE_OBJS="${MODULE_OBJS[@]}" @@ -107,7 +130,7 @@ MAIN_OBJS="${MODULE_OBJS[@].o}" MAIN_ENTRANCES=("srs_main_server") # srs(simple rtmp server) over st(state-threads) -ModuleLibFiles=(${LibSTfile}) +ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile}) MODULE_OBJS="${CORE_OBJS[@]} ${CONFIG_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}" BUILD_KEY="simple_rtmp_server" APP_MAIN="srs_main_server" APP_NAME="simple_rtmp_server" LINK_OPTIONS="-ldl -lssl" SO_PATH="" . auto/apps.sh diff --git a/trunk/src/core/srs_core_auto_free.cpp b/trunk/src/core/srs_core_autofree.cpp similarity index 94% rename from trunk/src/core/srs_core_auto_free.cpp rename to trunk/src/core/srs_core_autofree.cpp index 6e2b42276..3e04c6e12 100755 --- a/trunk/src/core/srs_core_auto_free.cpp +++ b/trunk/src/core/srs_core_autofree.cpp @@ -21,4 +21,4 @@ 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 diff --git a/trunk/src/core/srs_core_auto_free.hpp b/trunk/src/core/srs_core_autofree.hpp similarity index 94% rename from trunk/src/core/srs_core_auto_free.hpp rename to trunk/src/core/srs_core_autofree.hpp index 65cafead7..9581bd952 100755 --- a/trunk/src/core/srs_core_auto_free.hpp +++ b/trunk/src/core/srs_core_autofree.hpp @@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SRS_CORE_AUTO_FREE_HPP /* -#include +#include */ #include diff --git a/trunk/src/core/srs_core_client.cpp b/trunk/src/core/srs_core_client.cpp index ebcc9e541..8aba9e23c 100755 --- a/trunk/src/core/srs_core_client.cpp +++ b/trunk/src/core/srs_core_client.cpp @@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#include +#include #include #include #include diff --git a/trunk/src/core/srs_core_config.cpp b/trunk/src/core/srs_core_config.cpp index 67feb6414..415e9f50b 100755 --- a/trunk/src/core/srs_core_config.cpp +++ b/trunk/src/core/srs_core_config.cpp @@ -38,7 +38,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include +#include #define FILE_OFFSET(fd) lseek(fd, 0, SEEK_CUR) @@ -455,6 +455,18 @@ int SrsConfig::reload() return ret; } } + srs_trace("reload listen success."); + } + // merge config: pithy_print + if (!srs_directive_equals(root->get("pithy_print"), old_root->get("pithy_print"))) { + for (it = subscribes.begin(); it != subscribes.end(); ++it) { + SrsReloadHandler* subscribe = *it; + if ((ret = subscribe->on_reload_pithy_print()) != ERROR_SUCCESS) { + srs_error("notify subscribes pithy_print listen failed. ret=%d", ret); + return ret; + } + } + srs_trace("reload pithy_print success."); } return ret; @@ -593,6 +605,26 @@ SrsConfDirective* SrsConfig::get_chunk_size() return root->get("chunk_size"); } +SrsConfDirective* SrsConfig::get_pithy_print_publish() +{ + SrsConfDirective* pithy = root->get("pithy_print"); + if (!pithy) { + return NULL; + } + + return pithy->get("publish"); +} + +SrsConfDirective* SrsConfig::get_pithy_print_play() +{ + SrsConfDirective* pithy = root->get("pithy_print"); + if (!pithy) { + return NULL; + } + + return pithy->get("play"); +} + int SrsConfig::parse_file(const char* filename) { int ret = ERROR_SUCCESS; diff --git a/trunk/src/core/srs_core_config.hpp b/trunk/src/core/srs_core_config.hpp index 2c8c34c83..cf48b8766 100755 --- a/trunk/src/core/srs_core_config.hpp +++ b/trunk/src/core/srs_core_config.hpp @@ -114,6 +114,8 @@ public: virtual SrsConfDirective* get_refer_publish(std::string vhost); virtual SrsConfDirective* get_listen(); virtual SrsConfDirective* get_chunk_size(); + virtual SrsConfDirective* get_pithy_print_publish(); + virtual SrsConfDirective* get_pithy_print_play(); private: virtual int parse_file(const char* filename); virtual int parse_argv(int& i, char** argv); diff --git a/trunk/src/core/srs_core_complex_handshake.cpp b/trunk/src/core/srs_core_handshake.cpp similarity index 90% rename from trunk/src/core/srs_core_complex_handshake.cpp rename to trunk/src/core/srs_core_handshake.cpp index dd2fba174..67d3dc2d4 100755 --- a/trunk/src/core/srs_core_complex_handshake.cpp +++ b/trunk/src/core/srs_core_handshake.cpp @@ -21,14 +21,14 @@ 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 #include -#include +#include #include // 68bytes FMS key which is used to sign the sever packet. @@ -1058,6 +1058,72 @@ void c1s1::destroy_blocks() } } +SrsSimpleHandshake::SrsSimpleHandshake() +{ +} + +SrsSimpleHandshake::~SrsSimpleHandshake() +{ +} + +int SrsSimpleHandshake::handshake(SrsSocket& skt) +{ + int ret = ERROR_SUCCESS; + + ssize_t nsize; + + char* c0c1 = new char[1537]; + SrsAutoFree(char, c0c1, true); + if ((ret = skt.read_fully(c0c1, 1537, &nsize)) != ERROR_SUCCESS) { + srs_warn("read c0c1 failed. ret=%d", ret); + return ret; + } + srs_verbose("read c0c1 success."); + + // plain text required. + if (c0c1[0] != 0x03) { + ret = ERROR_RTMP_PLAIN_REQUIRED; + srs_warn("only support rtmp plain text. ret=%d", ret); + return ret; + } + srs_verbose("check c0 success, required plain text."); + + // try complex handshake + SrsComplexHandshake complex_handshake; + ret = complex_handshake.handshake(skt, c0c1 + 1); + if (ret == ERROR_SUCCESS) { + srs_trace("complex handshake success."); + return ret; + } + if (ret != ERROR_RTMP_TRY_SIMPLE_HS) { + srs_error("complex handshake failed. ret=%d", ret); + return ret; + } + srs_info("complex handhskae failed, try simple. ret=%d", ret); + + char* s0s1s2 = new char[3073]; + SrsAutoFree(char, s0s1s2, true); + // plain text required. + s0s1s2[0] = 0x03; + if ((ret = skt.write(s0s1s2, 3073, &nsize)) != ERROR_SUCCESS) { + srs_warn("simple handshake send s0s1s2 failed. ret=%d", ret); + return ret; + } + srs_verbose("simple handshake send s0s1s2 success."); + + char* c2 = new char[1536]; + SrsAutoFree(char, c2, true); + if ((ret = skt.read_fully(c2, 1536, &nsize)) != ERROR_SUCCESS) { + srs_warn("simple handshake read c2 failed. ret=%d", ret); + return ret; + } + srs_verbose("simple handshake read c2 success."); + + srs_trace("simple handshake success."); + + return ret; +} + SrsComplexHandshake::SrsComplexHandshake() { } diff --git a/trunk/src/core/srs_core_complex_handshake.hpp b/trunk/src/core/srs_core_handshake.hpp similarity index 81% rename from trunk/src/core/srs_core_complex_handshake.hpp rename to trunk/src/core/srs_core_handshake.hpp index 5ed6c2df6..e5ba22b7c 100755 --- a/trunk/src/core/srs_core_complex_handshake.hpp +++ b/trunk/src/core/srs_core_handshake.hpp @@ -21,8 +21,8 @@ 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_COMPLEX_HANDSHKAE_HPP -#define SRS_CORE_COMPLEX_HANDSHKAE_HPP +#ifndef SRS_CORE_HANDSHKAE_HPP +#define SRS_CORE_HANDSHKAE_HPP /* #include @@ -32,6 +32,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. class SrsSocket; +/** +* try complex handshake, if failed, fallback to simple handshake. +*/ +class SrsSimpleHandshake +{ +public: + SrsSimpleHandshake(); + virtual ~SrsSimpleHandshake(); +public: + /** + * simple handshake. + */ + virtual int handshake(SrsSocket& skt); +}; + /** * rtmp complex handshake, * @see also crtmp(crtmpserver) or librtmp, diff --git a/trunk/src/core/srs_core_pithy_print.cpp b/trunk/src/core/srs_core_pithy_print.cpp index e2917fb0a..96954c41f 100755 --- a/trunk/src/core/srs_core_pithy_print.cpp +++ b/trunk/src/core/srs_core_pithy_print.cpp @@ -23,15 +23,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include +#include #include #include +#include +#include +#include #define SRS_STAGE_DEFAULT_INTERVAL_MS 1200 #define SRS_STAGE_PLAY_USER_INTERVAL_MS 1300 #define SRS_STAGE_PUBLISH_USER_INTERVAL_MS 1100 -struct SrsStageInfo +struct SrsStageInfo : public SrsReloadHandler { int stage_id; int pithy_print_time_ms; @@ -40,19 +44,46 @@ struct SrsStageInfo SrsStageInfo(int _stage_id) { stage_id = _stage_id; - - switch (_stage_id) { - case SRS_STAGE_PLAY_USER: + nb_clients = 0; + + update_print_time(); + + config->subscribe(this); + } + virtual ~SrsStageInfo() + { + config->unsubscribe(this); + } + void update_print_time() + { + switch (stage_id) { + case SRS_STAGE_PLAY_USER: { pithy_print_time_ms = SRS_STAGE_PLAY_USER_INTERVAL_MS; - case SRS_STAGE_PUBLISH_USER: - pithy_print_time_ms = SRS_STAGE_PUBLISH_USER_INTERVAL_MS; + SrsConfDirective* conf = config->get_pithy_print_play(); + if (conf && !conf->arg0().empty()) { + pithy_print_time_ms = ::atoi(conf->arg0().c_str()); + } break; - default: + } + case SRS_STAGE_PUBLISH_USER: { + pithy_print_time_ms = SRS_STAGE_PUBLISH_USER_INTERVAL_MS; + SrsConfDirective* conf = config->get_pithy_print_publish(); + if (conf && !conf->arg0().empty()) { + pithy_print_time_ms = ::atoi(conf->arg0().c_str()); + } + break; + } + default: { pithy_print_time_ms = SRS_STAGE_DEFAULT_INTERVAL_MS; break; + } } - - nb_clients = 0; + } +public: + virtual int on_reload_pithy_print() + { + update_print_time(); + return ERROR_SUCCESS; } }; static std::map _srs_stages; diff --git a/trunk/src/core/srs_core_protocol.cpp b/trunk/src/core/srs_core_protocol.cpp index 45f84df4d..4cc512dbb 100755 --- a/trunk/src/core/srs_core_protocol.cpp +++ b/trunk/src/core/srs_core_protocol.cpp @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#include +#include /**************************************************************************** ***************************************************************************** diff --git a/trunk/src/core/srs_core_reload.cpp b/trunk/src/core/srs_core_reload.cpp index 52b7c2df2..56b115652 100755 --- a/trunk/src/core/srs_core_reload.cpp +++ b/trunk/src/core/srs_core_reload.cpp @@ -35,7 +35,11 @@ SrsReloadHandler::~SrsReloadHandler() int SrsReloadHandler::on_reload_listen() { - int ret = ERROR_SUCCESS; - return ret; + return ERROR_SUCCESS; +} + +int SrsReloadHandler::on_reload_pithy_print() +{ + return ERROR_SUCCESS; } diff --git a/trunk/src/core/srs_core_reload.hpp b/trunk/src/core/srs_core_reload.hpp index be48e19b5..8748ea7c3 100755 --- a/trunk/src/core/srs_core_reload.hpp +++ b/trunk/src/core/srs_core_reload.hpp @@ -39,6 +39,7 @@ public: virtual ~SrsReloadHandler(); public: virtual int on_reload_listen(); + virtual int on_reload_pithy_print(); }; #endif \ No newline at end of file diff --git a/trunk/src/core/srs_core_rtmp.cpp b/trunk/src/core/srs_core_rtmp.cpp index eda853f0b..838ea742f 100755 --- a/trunk/src/core/srs_core_rtmp.cpp +++ b/trunk/src/core/srs_core_rtmp.cpp @@ -27,9 +27,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include -#include +#include #include -#include +#include /** * the signature for packets to client. @@ -167,13 +167,11 @@ SrsRtmp::SrsRtmp(st_netfd_t client_stfd) { protocol = new SrsProtocol(client_stfd); stfd = client_stfd; - complex_handshake = new SrsComplexHandshake(); } SrsRtmp::~SrsRtmp() { srs_freep(protocol); - srs_freep(complex_handshake); } void SrsRtmp::set_recv_timeout(int64_t timeout_us) @@ -225,58 +223,14 @@ int SrsRtmp::handshake() { int ret = ERROR_SUCCESS; - ssize_t nsize; SrsSocket skt(stfd); - char* c0c1 = new char[1537]; - SrsAutoFree(char, c0c1, true); - if ((ret = skt.read_fully(c0c1, 1537, &nsize)) != ERROR_SUCCESS) { - srs_warn("read c0c1 failed. ret=%d", ret); + SrsSimpleHandshake hs; + if ((ret = hs.handshake(skt)) != ERROR_SUCCESS) { return ret; } - srs_verbose("read c0c1 success."); - - // plain text required. - if (c0c1[0] != 0x03) { - ret = ERROR_RTMP_PLAIN_REQUIRED; - srs_warn("only support rtmp plain text. ret=%d", ret); - return ret; - } - srs_verbose("check c0 success, required plain text."); - // try complex handshake - ret = complex_handshake->handshake(skt, c0c1 + 1); - if (ret == ERROR_SUCCESS) { - srs_trace("complex handshake success."); - return ret; - } - if (ret != ERROR_RTMP_TRY_SIMPLE_HS) { - srs_error("complex handshake failed. ret=%d", ret); - return ret; - } - srs_info("complex handhskae failed, try simple. ret=%d", ret); - - char* s0s1s2 = new char[3073]; - SrsAutoFree(char, s0s1s2, true); - // plain text required. - s0s1s2[0] = 0x03; - if ((ret = skt.write(s0s1s2, 3073, &nsize)) != ERROR_SUCCESS) { - srs_warn("simple handshake send s0s1s2 failed. ret=%d", ret); - return ret; - } - srs_verbose("simple handshake send s0s1s2 success."); - - char* c2 = new char[1536]; - SrsAutoFree(char, c2, true); - if ((ret = skt.read_fully(c2, 1536, &nsize)) != ERROR_SUCCESS) { - srs_warn("simple handshake read c2 failed. ret=%d", ret); - return ret; - } - srs_verbose("simple handshake read c2 success."); - - srs_trace("simple handshake success."); - - return ret; + return ret; } int SrsRtmp::connect_app(SrsRequest* req) diff --git a/trunk/src/core/srs_core_rtmp.hpp b/trunk/src/core/srs_core_rtmp.hpp index 707ebc0f0..7590de411 100755 --- a/trunk/src/core/srs_core_rtmp.hpp +++ b/trunk/src/core/srs_core_rtmp.hpp @@ -39,7 +39,6 @@ class ISrsMessage; class SrsCommonMessage; class SrsCreateStreamPacket; class SrsFMLEStartPacket; -class SrsComplexHandshake; class SrsPublishPacket; /** @@ -101,7 +100,6 @@ enum SrsClientType class SrsRtmp { private: - SrsComplexHandshake* complex_handshake; SrsProtocol* protocol; st_netfd_t stfd; public: diff --git a/trunk/src/core/srs_core_source.cpp b/trunk/src/core/srs_core_source.cpp index eb40f62b9..cc28286ff 100755 --- a/trunk/src/core/srs_core_source.cpp +++ b/trunk/src/core/srs_core_source.cpp @@ -27,7 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include +#include #include #include diff --git a/trunk/src/srs/srs.upp b/trunk/src/srs/srs.upp index 66a7817a8..6cb7f96c1 100755 --- a/trunk/src/srs/srs.upp +++ b/trunk/src/srs/srs.upp @@ -6,8 +6,8 @@ file ..\core\srs_core.cpp, ..\core\srs_core_error.hpp, ..\core\srs_core_error.cpp, - ..\core\srs_core_auto_free.hpp, - ..\core\srs_core_auto_free.cpp, + ..\core\srs_core_autofree.hpp, + ..\core\srs_core_autofree.cpp, ..\core\srs_core_server.hpp, ..\core\srs_core_server.cpp, ..\core\srs_core_reload.hpp, @@ -26,8 +26,8 @@ file ..\core\srs_core_codec.cpp, ..\core\srs_core_rtmp.hpp, ..\core\srs_core_rtmp.cpp, - ..\core\srs_core_complex_handshake.hpp, - ..\core\srs_core_complex_handshake.cpp, + ..\core\srs_core_handshake.hpp, + ..\core\srs_core_handshake.cpp, ..\core\srs_core_protocol.hpp, ..\core\srs_core_protocol.cpp, ..\core\srs_core_amf0.hpp,