mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
completed the edge reload, to 0.9.79
This commit is contained in:
parent
c681098949
commit
23b04e2a57
7 changed files with 25 additions and 5 deletions
|
@ -763,6 +763,18 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
|
||||||
SrsConfDirective* old_vhost = old_root->get("vhost", vhost);
|
SrsConfDirective* old_vhost = old_root->get("vhost", vhost);
|
||||||
SrsConfDirective* new_vhost = root->get("vhost", vhost);
|
SrsConfDirective* new_vhost = root->get("vhost", vhost);
|
||||||
|
|
||||||
|
// mode, never supports reload.
|
||||||
|
// first, for the origin and edge role change is too complex.
|
||||||
|
// second, the vhosts in origin device group normally are all origin,
|
||||||
|
// they never change to edge sometimes.
|
||||||
|
// third, the origin or upnode device can always be restart,
|
||||||
|
// edge will retry and the users connected to edge are ok.
|
||||||
|
if (get_vhost_is_edge(old_vhost) != get_vhost_is_edge(new_vhost)) {
|
||||||
|
ret = ERROR_RTMP_EDGE_RELOAD;
|
||||||
|
srs_error("reload never supports mode changed. ret=%d", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// DISABLED => ENABLED
|
// DISABLED => ENABLED
|
||||||
if (!get_vhost_enabled(old_vhost) && get_vhost_enabled(new_vhost)) {
|
if (!get_vhost_enabled(old_vhost) && get_vhost_enabled(new_vhost)) {
|
||||||
srs_trace("vhost %s added, reload it.", vhost.c_str());
|
srs_trace("vhost %s added, reload it.", vhost.c_str());
|
||||||
|
@ -1823,6 +1835,12 @@ int SrsConfig::get_bw_check_limit_kbps(const string &vhost)
|
||||||
bool SrsConfig::get_vhost_is_edge(std::string vhost)
|
bool SrsConfig::get_vhost_is_edge(std::string vhost)
|
||||||
{
|
{
|
||||||
SrsConfDirective* conf = get_vhost(vhost);
|
SrsConfDirective* conf = get_vhost(vhost);
|
||||||
|
return get_vhost_is_edge(conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SrsConfig::get_vhost_is_edge(SrsConfDirective* vhost)
|
||||||
|
{
|
||||||
|
SrsConfDirective* conf = vhost;
|
||||||
|
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -195,6 +195,7 @@ public:
|
||||||
// vhost edge section
|
// vhost edge section
|
||||||
public:
|
public:
|
||||||
virtual bool get_vhost_is_edge(std::string vhost);
|
virtual bool get_vhost_is_edge(std::string vhost);
|
||||||
|
virtual bool get_vhost_is_edge(SrsConfDirective* vhost);
|
||||||
virtual SrsConfDirective* get_vhost_edge_origin(std::string vhost);
|
virtual SrsConfDirective* get_vhost_edge_origin(std::string vhost);
|
||||||
// vhost transcode section
|
// vhost transcode section
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -252,7 +252,6 @@ int SrsEdgeIngester::connect_server()
|
||||||
// reopen
|
// reopen
|
||||||
close_underlayer_socket();
|
close_underlayer_socket();
|
||||||
|
|
||||||
// TODO: FIXME: support reload
|
|
||||||
SrsConfDirective* conf = _srs_config->get_vhost_edge_origin(_req->vhost);
|
SrsConfDirective* conf = _srs_config->get_vhost_edge_origin(_req->vhost);
|
||||||
srs_assert(conf);
|
srs_assert(conf);
|
||||||
|
|
||||||
|
@ -494,6 +493,7 @@ int SrsEdgeForwarder::proxy(SrsCommonMessage* msg)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: FIXME: use utility to copy msg to shared ptr msg.
|
||||||
SrsSharedPtrMessage* copy = new SrsSharedPtrMessage();
|
SrsSharedPtrMessage* copy = new SrsSharedPtrMessage();
|
||||||
SrsAutoFree(SrsSharedPtrMessage, copy, false);
|
SrsAutoFree(SrsSharedPtrMessage, copy, false);
|
||||||
if ((ret = copy->initialize(msg)) != ERROR_SUCCESS) {
|
if ((ret = copy->initialize(msg)) != ERROR_SUCCESS) {
|
||||||
|
@ -522,7 +522,6 @@ int SrsEdgeForwarder::connect_server()
|
||||||
// reopen
|
// reopen
|
||||||
close_underlayer_socket();
|
close_underlayer_socket();
|
||||||
|
|
||||||
// TODO: FIXME: support reload
|
|
||||||
SrsConfDirective* conf = _srs_config->get_vhost_edge_origin(_req->vhost);
|
SrsConfDirective* conf = _srs_config->get_vhost_edge_origin(_req->vhost);
|
||||||
srs_assert(conf);
|
srs_assert(conf);
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,6 @@ private:
|
||||||
* play edge control service.
|
* play edge control service.
|
||||||
* downloading edge speed-up.
|
* downloading edge speed-up.
|
||||||
*/
|
*/
|
||||||
// TODO: FIXME: support reload
|
|
||||||
class SrsPlayEdge
|
class SrsPlayEdge
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -183,7 +182,6 @@ public:
|
||||||
* publish edge control service.
|
* publish edge control service.
|
||||||
* uploading edge speed-up.
|
* uploading edge speed-up.
|
||||||
*/
|
*/
|
||||||
// TODO: FIXME: support reload
|
|
||||||
class SrsPublishEdge
|
class SrsPublishEdge
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -34,6 +34,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
/**
|
/**
|
||||||
* the handler for config reload.
|
* the handler for config reload.
|
||||||
* when reload callback, the config is updated yet.
|
* when reload callback, the config is updated yet.
|
||||||
|
*
|
||||||
|
* features not support reload,
|
||||||
|
* @see: https://github.com/winlinvip/simple-rtmp-server/wiki/Reload#notsupportedfeatures
|
||||||
*/
|
*/
|
||||||
class ISrsReloadHandler
|
class ISrsReloadHandler
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// current release version
|
// current release version
|
||||||
#define VERSION_MAJOR "0"
|
#define VERSION_MAJOR "0"
|
||||||
#define VERSION_MINOR "9"
|
#define VERSION_MINOR "9"
|
||||||
#define VERSION_REVISION "78"
|
#define VERSION_REVISION "79"
|
||||||
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
|
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
|
||||||
// server info.
|
// server info.
|
||||||
#define RTMP_SIG_SRS_KEY "srs"
|
#define RTMP_SIG_SRS_KEY "srs"
|
||||||
|
|
|
@ -82,6 +82,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// invalid state for client to publish edge stream.
|
// invalid state for client to publish edge stream.
|
||||||
#define ERROR_RTMP_EDGE_PUBLISH_STATE 321
|
#define ERROR_RTMP_EDGE_PUBLISH_STATE 321
|
||||||
#define ERROR_RTMP_EDGE_PROXY_PULL 322
|
#define ERROR_RTMP_EDGE_PROXY_PULL 322
|
||||||
|
#define ERROR_RTMP_EDGE_RELOAD 323
|
||||||
|
|
||||||
#define ERROR_SYSTEM_STREAM_INIT 400
|
#define ERROR_SYSTEM_STREAM_INIT 400
|
||||||
#define ERROR_SYSTEM_PACKET_INVALID 401
|
#define ERROR_SYSTEM_PACKET_INVALID 401
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue