From a9d28122f4027460d2da85511e74a9f075d22af7 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 6 Aug 2014 13:57:55 +0800 Subject: [PATCH] refine code, refine the handshake, refine the log of source_id --- trunk/src/app/srs_app_rtmp_conn.cpp | 5 +++-- trunk/src/app/srs_app_source.cpp | 2 +- trunk/src/rtmp/srs_protocol_handshake.cpp | 10 ++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 5e7997a20..c34553a65 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -365,8 +365,9 @@ int SrsRtmpConn::stream_service_cycle() } bool enabled_cache = _srs_config->get_gop_cache(req->vhost); - srs_trace("source url=%s, ip=%s, cache=%d, is_edge=%d, id=%d", - req->get_stream_url().c_str(), ip.c_str(), enabled_cache, vhost_is_edge, source->source_id()); + srs_trace("source url=%s, ip=%s, cache=%d, is_edge=%d, source_id=%d[%d]", + req->get_stream_url().c_str(), ip.c_str(), enabled_cache, vhost_is_edge, + source->source_id(), source->source_id()); source->set_cache(enabled_cache); switch (type) { diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index e977aa0d8..7133141b6 100644 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -338,7 +338,7 @@ int SrsConsumer::dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, int& c srs_assert(max_count > 0); if (should_update_source_id) { - srs_trace("update source_id=%d", source->source_id()); + srs_trace("update source_id=%d[%d]", source->source_id(), source->source_id()); should_update_source_id = false; } diff --git a/trunk/src/rtmp/srs_protocol_handshake.cpp b/trunk/src/rtmp/srs_protocol_handshake.cpp index 6fa3f86ac..c80f464ed 100644 --- a/trunk/src/rtmp/srs_protocol_handshake.cpp +++ b/trunk/src/rtmp/srs_protocol_handshake.cpp @@ -866,17 +866,15 @@ namespace _srs_internal if (schema == srs_schema0) { srs_key_block_init(&block0.key); srs_digest_block_init(&block1.digest); - } else { - srs_digest_block_init(&block0.digest); - srs_key_block_init(&block1.key); - } - - if (schema == srs_schema0) { + if ((ret = openssl_generate_key(c1->block0.key.key, block0.key.key, 128)) != ERROR_SUCCESS) { srs_error("calc s1 key failed. ret=%d", ret); return ret; } } else { + srs_digest_block_init(&block0.digest); + srs_key_block_init(&block1.key); + if ((ret = openssl_generate_key(c1->block1.key.key, block1.key.key, 128)) != ERROR_SUCCESS) { srs_error("calc s1 key failed. ret=%d", ret); return ret;