From 3d0d43c5dc1bd219fc6fcea6f23e8e21cc422572 Mon Sep 17 00:00:00 2001 From: tufang14 Date: Tue, 2 Dec 2014 14:38:54 +0800 Subject: [PATCH 1/4] token bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 多级origin-edge模式,edge上功能不生效 --- trunk/src/app/srs_app_rtmp_conn.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 97aefb326..35b19f902 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -244,6 +244,16 @@ int SrsRtmpConn::service_cycle() return bandwidth->bandwidth_check(rtmp, skt, req, local_ip); } + // do token traverse before serve it. + bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost); + bool edge_traverse = _srs_config->get_vhost_edge_token_traverse(req->vhost); + if (vhost_is_edge && edge_traverse) { + if ((ret = check_edge_token_traverse_auth()) != ERROR_SUCCESS) { + srs_warn("token auth failed, ret=%d", ret); + return ret; + } + } + if ((ret = rtmp->response_connect_app(req, local_ip.c_str())) != ERROR_SUCCESS) { srs_error("response connect app failed. ret=%d", ret); return ret; @@ -326,15 +336,7 @@ int SrsRtmpConn::stream_service_cycle() } srs_info("set chunk_size=%d success", chunk_size); - // do token traverse before serve it. bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost); - bool edge_traverse = _srs_config->get_vhost_edge_token_traverse(req->vhost); - if (vhost_is_edge && edge_traverse) { - if ((ret = check_edge_token_traverse_auth()) != ERROR_SUCCESS) { - srs_warn("token auth failed, ret=%d", ret); - return ret; - } - } // find a source to serve. SrsSource* source = NULL; From 304208f822f30248998e5bf6d0145dccf2abb2a7 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 2 Dec 2014 15:27:36 +0800 Subject: [PATCH 2/4] fix #239, traverse the token before response connect. 1.0.10. --- AUTHORS.txt | 1 + README.md | 1 + trunk/src/core/srs_core.hpp | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 07f3b07d0..20ebd7610 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -20,3 +20,4 @@ CONTRIBUTORS ordered by first contribution. * karthikeyan "Bug fixed" * StevenLiu "Build SRS on Darwin OSX" * zhengfl "Bug fixed" +* tufang14 "Bug fixed" diff --git a/README.md b/README.md index 225b23c15..d41a6aeb3 100755 --- a/README.md +++ b/README.md @@ -372,6 +372,7 @@ Supported operating systems and hardware: * 2013-10-17, Created.
## History +* v1.0, 2014-11-13, hotfix [#239](https://github.com/winlinvip/simple-rtmp-server/pull/239), traverse the token before response connect. 1.0.10. * v1.0, 2014-11-25, update PRIMARY, AUTHORS, CONTRIBUTORS of SRS. 1.0.8. * v1.0, 2014-11-18, all wiki translated to English. 1.0.7. * v1.0, 2014-11-13, hotfix [#200](https://github.com/winlinvip/simple-rtmp-server/issues/200), deadloop when read/write 0 and ETIME. 1.0.6. diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 5af31f923..d20fb6a99 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 1 #define VERSION_MINOR 0 -#define VERSION_REVISION 9 +#define VERSION_REVISION 10 // server info. #define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_ROLE "origin/edge server" From 24815e4efe0ba91f4314aede948419842b90ad80 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 2 Dec 2014 15:33:22 +0800 Subject: [PATCH 3/4] refine code for bug #239 --- trunk/src/app/srs_app_rtmp_conn.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 35b19f902..9ac1d3340 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -245,6 +245,7 @@ int SrsRtmpConn::service_cycle() } // do token traverse before serve it. + // @see https://github.com/winlinvip/simple-rtmp-server/pull/239 bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost); bool edge_traverse = _srs_config->get_vhost_edge_token_traverse(req->vhost); if (vhost_is_edge && edge_traverse) { @@ -254,6 +255,7 @@ int SrsRtmpConn::service_cycle() } } + // response the client connect ok. if ((ret = rtmp->response_connect_app(req, local_ip.c_str())) != ERROR_SUCCESS) { srs_error("response connect app failed. ret=%d", ret); return ret; From 9bda56cb423590c2503b6373427cac83ad312d66 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 2 Dec 2014 15:39:32 +0800 Subject: [PATCH 4/4] update readme for bug #239 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d41a6aeb3..def5a22d3 100755 --- a/README.md +++ b/README.md @@ -372,7 +372,7 @@ Supported operating systems and hardware: * 2013-10-17, Created.
## History -* v1.0, 2014-11-13, hotfix [#239](https://github.com/winlinvip/simple-rtmp-server/pull/239), traverse the token before response connect. 1.0.10. +* v1.0, 2014-12-02, hotfix [#239](https://github.com/winlinvip/simple-rtmp-server/pull/239), traverse the token before response connect. 1.0.10. * v1.0, 2014-11-25, update PRIMARY, AUTHORS, CONTRIBUTORS of SRS. 1.0.8. * v1.0, 2014-11-18, all wiki translated to English. 1.0.7. * v1.0, 2014-11-13, hotfix [#200](https://github.com/winlinvip/simple-rtmp-server/issues/200), deadloop when read/write 0 and ETIME. 1.0.6.