winlin

fix fms token traverse bug, always update the token by the latest valid client.

@@ -439,7 +439,14 @@ int SrsSource::find(SrsRequest* req, SrsSource** ppsource) @@ -439,7 +439,14 @@ int SrsSource::find(SrsRequest* req, SrsSource** ppsource)
439 srs_info("create new source for url=%s, vhost=%s", stream_url.c_str(), vhost.c_str()); 439 srs_info("create new source for url=%s, vhost=%s", stream_url.c_str(), vhost.c_str());
440 } 440 }
441 441
442 - *ppsource = pool[stream_url]; 442 + // we always update the request of resource,
  443 + // for origin auth is on, the token in request maybe invalid,
  444 + // and we only need to update the token of request, it's simple.
  445 + if (true) {
  446 + SrsSource* source = pool[stream_url];
  447 + source->_req->update_auth(req);
  448 + *ppsource = source;
  449 + }
443 450
444 return ret; 451 return ret;
445 } 452 }
@@ -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 "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "130" 34 +#define VERSION_REVISION "131"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -108,6 +108,22 @@ SrsRequest* SrsRequest::copy() @@ -108,6 +108,22 @@ SrsRequest* SrsRequest::copy()
108 return cp; 108 return cp;
109 } 109 }
110 110
  111 +void SrsRequest::update_auth(SrsRequest* req)
  112 +{
  113 + pageUrl = req->pageUrl;
  114 + swfUrl = req->swfUrl;
  115 + tcUrl = req->tcUrl;
  116 +
  117 + if (args) {
  118 + srs_freep(args);
  119 + }
  120 + if (req->args) {
  121 + args = req->args->copy()->to_object();
  122 + }
  123 +
  124 + srs_info("update req of soruce for auth ok");
  125 +}
  126 +
111 int SrsRequest::discovery_app() 127 int SrsRequest::discovery_app()
112 { 128 {
113 int ret = ERROR_SUCCESS; 129 int ret = ERROR_SUCCESS;
@@ -91,6 +91,13 @@ public: @@ -91,6 +91,13 @@ public:
91 virtual SrsRequest* copy(); 91 virtual SrsRequest* copy();
92 92
93 /** 93 /**
  94 + * update the auth info of request,
  95 + * to keep the current request ptr is ok,
  96 + * for many components use the ptr of request.
  97 + */
  98 + virtual void update_auth(SrsRequest* req);
  99 +
  100 + /**
94 * disconvery vhost/app from tcUrl. 101 * disconvery vhost/app from tcUrl.
95 */ 102 */
96 virtual int discovery_app(); 103 virtual int discovery_app();