winlin

merge from 1.0release, traverse the token before response connect. 2.0.45.

@@ -20,3 +20,4 @@ CONTRIBUTORS ordered by first contribution. @@ -20,3 +20,4 @@ CONTRIBUTORS ordered by first contribution.
20 * karthikeyan<keyanmca@gmail.com> "Bug fixed" 20 * karthikeyan<keyanmca@gmail.com> "Bug fixed"
21 * StevenLiu<lq@chinaffmpeg.org> "Build SRS on Darwin OSX" 21 * StevenLiu<lq@chinaffmpeg.org> "Build SRS on Darwin OSX"
22 * zhengfl<zhengfl_1989@126.com> "Bug fixed" 22 * zhengfl<zhengfl_1989@126.com> "Bug fixed"
  23 +* tufang14<breadbean1449@gmail.com> "Bug fixed"
@@ -485,6 +485,7 @@ Supported operating systems and hardware: @@ -485,6 +485,7 @@ Supported operating systems and hardware:
485 * 2013-10-17, Created.<br/> 485 * 2013-10-17, Created.<br/>
486 486
487 ## History 487 ## History
  488 +* v2.0, 2014-12-02, merge [#239](https://github.com/winlinvip/simple-rtmp-server/pull/239), traverse the token before response connect. 2.0.45.
488 * v2.0, 2014-12-02, srs-librtmp support hijack io apis for st-load. 2.0.42. 489 * v2.0, 2014-12-02, srs-librtmp support hijack io apis for st-load. 2.0.42.
489 * v2.0, 2014-12-01, for [#237](https://github.com/winlinvip/simple-rtmp-server/issues/237), refine syscall for recv, supports 1.5k clients. 2.0.41. 490 * v2.0, 2014-12-01, for [#237](https://github.com/winlinvip/simple-rtmp-server/issues/237), refine syscall for recv, supports 1.5k clients. 2.0.41.
490 * v2.0, 2014-11-30, add qtcreate project file trunk/src/qt/srs/srs-qt.pro. 2.0.39. 491 * v2.0, 2014-11-30, add qtcreate project file trunk/src/qt/srs/srs-qt.pro. 2.0.39.
@@ -242,6 +242,18 @@ int SrsRtmpConn::service_cycle() @@ -242,6 +242,18 @@ int SrsRtmpConn::service_cycle()
242 return bandwidth->bandwidth_check(rtmp, skt, req, local_ip); 242 return bandwidth->bandwidth_check(rtmp, skt, req, local_ip);
243 } 243 }
244 244
  245 + // do token traverse before serve it.
  246 + // @see https://github.com/winlinvip/simple-rtmp-server/pull/239
  247 + bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost);
  248 + bool edge_traverse = _srs_config->get_vhost_edge_token_traverse(req->vhost);
  249 + if (vhost_is_edge && edge_traverse) {
  250 + if ((ret = check_edge_token_traverse_auth()) != ERROR_SUCCESS) {
  251 + srs_warn("token auth failed, ret=%d", ret);
  252 + return ret;
  253 + }
  254 + }
  255 +
  256 + // response the client connect ok.
245 if ((ret = rtmp->response_connect_app(req, local_ip.c_str())) != ERROR_SUCCESS) { 257 if ((ret = rtmp->response_connect_app(req, local_ip.c_str())) != ERROR_SUCCESS) {
246 srs_error("response connect app failed. ret=%d", ret); 258 srs_error("response connect app failed. ret=%d", ret);
247 return ret; 259 return ret;
@@ -324,15 +336,7 @@ int SrsRtmpConn::stream_service_cycle() @@ -324,15 +336,7 @@ int SrsRtmpConn::stream_service_cycle()
324 } 336 }
325 srs_info("set chunk_size=%d success", chunk_size); 337 srs_info("set chunk_size=%d success", chunk_size);
326 338
327 - // do token traverse before serve it.  
328 bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost); 339 bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost);
329 - bool edge_traverse = _srs_config->get_vhost_edge_token_traverse(req->vhost);  
330 - if (vhost_is_edge && edge_traverse) {  
331 - if ((ret = check_edge_token_traverse_auth()) != ERROR_SUCCESS) {  
332 - srs_warn("token auth failed, ret=%d", ret);  
333 - return ret;  
334 - }  
335 - }  
336 340
337 // find a source to serve. 341 // find a source to serve.
338 SrsSource* source = NULL; 342 SrsSource* source = NULL;
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 44 34 +#define VERSION_REVISION 45
35 // server info. 35 // server info.
36 #define RTMP_SIG_SRS_KEY "SRS" 36 #define RTMP_SIG_SRS_KEY "SRS"
37 #define RTMP_SIG_SRS_ROLE "origin/edge server" 37 #define RTMP_SIG_SRS_ROLE "origin/edge server"