winlin

Merge pull request #239 from tufang14/1.0release

token traverse bug, tranverse token then response the connect request.
@@ -244,6 +244,16 @@ int SrsRtmpConn::service_cycle() @@ -244,6 +244,16 @@ int SrsRtmpConn::service_cycle()
244 return bandwidth->bandwidth_check(rtmp, skt, req, local_ip); 244 return bandwidth->bandwidth_check(rtmp, skt, req, local_ip);
245 } 245 }
246 246
  247 + // do token traverse before serve it.
  248 + bool vhost_is_edge = _srs_config->get_vhost_is_edge(req->vhost);
  249 + bool edge_traverse = _srs_config->get_vhost_edge_token_traverse(req->vhost);
  250 + if (vhost_is_edge && edge_traverse) {
  251 + if ((ret = check_edge_token_traverse_auth()) != ERROR_SUCCESS) {
  252 + srs_warn("token auth failed, ret=%d", ret);
  253 + return ret;
  254 + }
  255 + }
  256 +
247 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) {
248 srs_error("response connect app failed. ret=%d", ret); 258 srs_error("response connect app failed. ret=%d", ret);
249 return ret; 259 return ret;
@@ -326,15 +336,7 @@ int SrsRtmpConn::stream_service_cycle() @@ -326,15 +336,7 @@ int SrsRtmpConn::stream_service_cycle()
326 } 336 }
327 srs_info("set chunk_size=%d success", chunk_size); 337 srs_info("set chunk_size=%d success", chunk_size);
328 338
329 - // do token traverse before serve it.  
330 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);
331 - bool edge_traverse = _srs_config->get_vhost_edge_token_traverse(req->vhost);  
332 - if (vhost_is_edge && edge_traverse) {  
333 - if ((ret = check_edge_token_traverse_auth()) != ERROR_SUCCESS) {  
334 - srs_warn("token auth failed, ret=%d", ret);  
335 - return ret;  
336 - }  
337 - }  
338 340
339 // find a source to serve. 341 // find a source to serve.
340 SrsSource* source = NULL; 342 SrsSource* source = NULL;