mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
API: Fix the same 'client_id' error when asynchronous call (#2665)
This commit is contained in:
parent
9517ef123d
commit
974bed6b26
2 changed files with 66 additions and 47 deletions
|
@ -351,22 +351,22 @@ srs_error_t SrsRtcPLIWorker::cycle()
|
|||
|
||||
return err;
|
||||
}
|
||||
|
||||
SrsRtcAsyncCallOnStop::SrsRtcAsyncCallOnStop(SrsContextId c, SrsRequest * r)
|
||||
{
|
||||
|
||||
SrsRtcAsyncCallOnStop::SrsRtcAsyncCallOnStop(SrsContextId c, SrsRequest * r)
|
||||
{
|
||||
cid = c;
|
||||
req = r->copy();
|
||||
}
|
||||
|
||||
SrsRtcAsyncCallOnStop::~SrsRtcAsyncCallOnStop()
|
||||
{
|
||||
srs_freep(req);
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcAsyncCallOnStop::call()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
req = r->copy();
|
||||
}
|
||||
|
||||
SrsRtcAsyncCallOnStop::~SrsRtcAsyncCallOnStop()
|
||||
{
|
||||
srs_freep(req);
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcAsyncCallOnStop::call()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
|
||||
return err;
|
||||
}
|
||||
|
@ -386,17 +386,20 @@ srs_error_t SrsRtcAsyncCallOnStop::call()
|
|||
hooks = conf->args;
|
||||
}
|
||||
|
||||
SrsContextRestore(_srs_context->get_id());
|
||||
_srs_context->set_id(cid);
|
||||
|
||||
for (int i = 0; i < (int)hooks.size(); i++) {
|
||||
std::string url = hooks.at(i);
|
||||
SrsHttpHooks::on_stop(url, req);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
std::string SrsRtcAsyncCallOnStop::to_string()
|
||||
{
|
||||
return std::string("");
|
||||
return err;
|
||||
}
|
||||
|
||||
std::string SrsRtcAsyncCallOnStop::to_string()
|
||||
{
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
SrsRtcPlayStream::SrsRtcPlayStream(SrsRtcConnection* s, const SrsContextId& cid)
|
||||
|
@ -997,21 +1000,21 @@ srs_error_t SrsRtcPublishTwccTimer::on_timer(srs_utime_t interval)
|
|||
}
|
||||
|
||||
|
||||
SrsRtcAsyncCallOnUnpublish::SrsRtcAsyncCallOnUnpublish(SrsContextId c, SrsRequest * r)
|
||||
{
|
||||
SrsRtcAsyncCallOnUnpublish::SrsRtcAsyncCallOnUnpublish(SrsContextId c, SrsRequest * r)
|
||||
{
|
||||
cid = c;
|
||||
req = r->copy();
|
||||
}
|
||||
|
||||
SrsRtcAsyncCallOnUnpublish::~SrsRtcAsyncCallOnUnpublish()
|
||||
{
|
||||
srs_freep(req);
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcAsyncCallOnUnpublish::call()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
req = r->copy();
|
||||
}
|
||||
|
||||
SrsRtcAsyncCallOnUnpublish::~SrsRtcAsyncCallOnUnpublish()
|
||||
{
|
||||
srs_freep(req);
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcAsyncCallOnUnpublish::call()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (!_srs_config->get_vhost_http_hooks_enabled(req->vhost)) {
|
||||
return err;
|
||||
}
|
||||
|
@ -1031,17 +1034,20 @@ srs_error_t SrsRtcAsyncCallOnUnpublish::call()
|
|||
hooks = conf->args;
|
||||
}
|
||||
|
||||
SrsContextRestore(_srs_context->get_id());
|
||||
_srs_context->set_id(cid);
|
||||
|
||||
for (int i = 0; i < (int)hooks.size(); i++) {
|
||||
std::string url = hooks.at(i);
|
||||
SrsHttpHooks::on_unpublish(url, req);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
std::string SrsRtcAsyncCallOnUnpublish::to_string()
|
||||
{
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
std::string SrsRtcAsyncCallOnUnpublish::to_string()
|
||||
{
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
SrsRtcPublishStream::SrsRtcPublishStream(SrsRtcConnection* session, const SrsContextId& cid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue