mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine the order.
This commit is contained in:
parent
7b2b11e932
commit
1fd83d9314
30 changed files with 985 additions and 751 deletions
File diff suppressed because it is too large
Load diff
|
@ -31,9 +31,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <srs_app_reload.hpp>
|
#include <srs_app_reload.hpp>
|
||||||
|
#include <srs_app_async_call.hpp>
|
||||||
|
#include <srs_app_thread.hpp>
|
||||||
|
|
||||||
class SrsRequest;
|
class SrsRequest;
|
||||||
class SrsFileWriter;
|
class SrsFileWriter;
|
||||||
|
@ -41,10 +44,89 @@ class SrsAmf0Object;
|
||||||
class SrsAmf0StrictArray;
|
class SrsAmf0StrictArray;
|
||||||
class SrsAmf0Any;
|
class SrsAmf0Any;
|
||||||
|
|
||||||
|
class SrsConfig;
|
||||||
|
class SrsRequest;
|
||||||
|
class SrsJsonArray;
|
||||||
|
class SrsConfDirective;
|
||||||
|
|
||||||
|
|
||||||
namespace _srs_internal
|
namespace _srs_internal
|
||||||
{
|
{
|
||||||
class SrsConfigBuffer;
|
/**
|
||||||
}
|
* the buffer of config content.
|
||||||
|
*/
|
||||||
|
class SrsConfigBuffer
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
// last available position.
|
||||||
|
char* last;
|
||||||
|
// end of buffer.
|
||||||
|
char* end;
|
||||||
|
// start of buffer.
|
||||||
|
char* start;
|
||||||
|
public:
|
||||||
|
// current consumed position.
|
||||||
|
char* pos;
|
||||||
|
// current parsed line.
|
||||||
|
int line;
|
||||||
|
public:
|
||||||
|
SrsConfigBuffer();
|
||||||
|
virtual ~SrsConfigBuffer();
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* fullfill the buffer with content of file specified by filename.
|
||||||
|
*/
|
||||||
|
virtual int fullfill(const char* filename);
|
||||||
|
/**
|
||||||
|
* whether buffer is empty.
|
||||||
|
*/
|
||||||
|
virtual bool empty();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deep compare directive.
|
||||||
|
*/
|
||||||
|
extern bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b);
|
||||||
|
extern bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b, std::string except);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* helper utilities, used for compare the consts values.
|
||||||
|
*/
|
||||||
|
extern bool srs_config_hls_is_on_error_ignore(std::string strategy);
|
||||||
|
extern bool srs_config_hls_is_on_error_continue(std::string strategy);
|
||||||
|
extern bool srs_config_ingest_is_file(std::string type);
|
||||||
|
extern bool srs_config_ingest_is_stream(std::string type);
|
||||||
|
extern bool srs_config_dvr_is_plan_segment(std::string plan);
|
||||||
|
extern bool srs_config_dvr_is_plan_session(std::string plan);
|
||||||
|
extern bool srs_config_dvr_is_plan_append(std::string plan);
|
||||||
|
extern bool srs_stream_caster_is_udp(std::string caster);
|
||||||
|
extern bool srs_stream_caster_is_rtsp(std::string caster);
|
||||||
|
extern bool srs_stream_caster_is_flv(std::string caster);
|
||||||
|
// whether the dvr_apply active the stream specified by req.
|
||||||
|
extern bool srs_config_apply_filter(SrsConfDirective* dvr_apply, SrsRequest* req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* convert bool in str to on/off
|
||||||
|
*/
|
||||||
|
extern std::string srs_config_bool2switch(const std::string& sbool);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* parse loaded vhost directives to compatible mode.
|
||||||
|
* for exmaple, SRS1/2 use the follow refer style:
|
||||||
|
* refer a.domain.com b.domain.com;
|
||||||
|
* while SRS3 use the following:
|
||||||
|
* refer {
|
||||||
|
* enabled on;
|
||||||
|
* all a.domain.com b.domain.com;
|
||||||
|
* }
|
||||||
|
* so we must transform the vhost directive anytime load the config.
|
||||||
|
* @param root the root directive to transform, in and out parameter.
|
||||||
|
*/
|
||||||
|
extern int srs_config_transform_vhost(SrsConfDirective* root);
|
||||||
|
|
||||||
|
// global config
|
||||||
|
extern SrsConfig* _srs_config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the config directive.
|
* the config directive.
|
||||||
|
@ -103,6 +185,13 @@ public:
|
||||||
public:
|
public:
|
||||||
SrsConfDirective();
|
SrsConfDirective();
|
||||||
virtual ~SrsConfDirective();
|
virtual ~SrsConfDirective();
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* deep copy the directive, for SrsConfig to use it to support reload in upyun cluster,
|
||||||
|
* for when reload the upyun dynamic config, the root will be changed,
|
||||||
|
* so need to copy it to an old root directive, and use the copy result to do reload.
|
||||||
|
*/
|
||||||
|
virtual SrsConfDirective* copy();
|
||||||
// args
|
// args
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -189,10 +278,6 @@ private:
|
||||||
* 3. if ret flag indicates there are child-directives, read_conf(directive, block) recursively.
|
* 3. if ret flag indicates there are child-directives, read_conf(directive, block) recursively.
|
||||||
*/
|
*/
|
||||||
virtual int parse_conf(_srs_internal::SrsConfigBuffer* buffer, SrsDirectiveType type);
|
virtual int parse_conf(_srs_internal::SrsConfigBuffer* buffer, SrsDirectiveType type);
|
||||||
/**
|
|
||||||
* deep copy the directive.
|
|
||||||
*/
|
|
||||||
virtual SrsConfDirective* copy();
|
|
||||||
/**
|
/**
|
||||||
* read a token from buffer.
|
* read a token from buffer.
|
||||||
* a token, is the directive args and a flag indicates whether has child-directives.
|
* a token, is the directive args and a flag indicates whether has child-directives.
|
||||||
|
@ -1291,83 +1376,5 @@ public:
|
||||||
virtual SrsConfDirective* get_stats_disk_device();
|
virtual SrsConfDirective* get_stats_disk_device();
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace _srs_internal
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* the buffer of config content.
|
|
||||||
*/
|
|
||||||
class SrsConfigBuffer
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
// last available position.
|
|
||||||
char* last;
|
|
||||||
// end of buffer.
|
|
||||||
char* end;
|
|
||||||
// start of buffer.
|
|
||||||
char* start;
|
|
||||||
public:
|
|
||||||
// current consumed position.
|
|
||||||
char* pos;
|
|
||||||
// current parsed line.
|
|
||||||
int line;
|
|
||||||
public:
|
|
||||||
SrsConfigBuffer();
|
|
||||||
virtual ~SrsConfigBuffer();
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* fullfill the buffer with content of file specified by filename.
|
|
||||||
*/
|
|
||||||
virtual int fullfill(const char* filename);
|
|
||||||
/**
|
|
||||||
* whether buffer is empty.
|
|
||||||
*/
|
|
||||||
virtual bool empty();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* deep compare directive.
|
|
||||||
*/
|
|
||||||
extern bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b);
|
|
||||||
extern bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b, std::string except);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* helper utilities, used for compare the consts values.
|
|
||||||
*/
|
|
||||||
extern bool srs_config_hls_is_on_error_ignore(std::string strategy);
|
|
||||||
extern bool srs_config_hls_is_on_error_continue(std::string strategy);
|
|
||||||
extern bool srs_config_ingest_is_file(std::string type);
|
|
||||||
extern bool srs_config_ingest_is_stream(std::string type);
|
|
||||||
extern bool srs_config_dvr_is_plan_segment(std::string plan);
|
|
||||||
extern bool srs_config_dvr_is_plan_session(std::string plan);
|
|
||||||
extern bool srs_config_dvr_is_plan_append(std::string plan);
|
|
||||||
extern bool srs_stream_caster_is_udp(std::string caster);
|
|
||||||
extern bool srs_stream_caster_is_rtsp(std::string caster);
|
|
||||||
extern bool srs_stream_caster_is_flv(std::string caster);
|
|
||||||
// whether the dvr_apply active the stream specified by req.
|
|
||||||
extern bool srs_config_apply_filter(SrsConfDirective* dvr_apply, SrsRequest* req);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* convert bool in str to on/off
|
|
||||||
*/
|
|
||||||
extern std::string srs_config_bool2switch(const std::string& sbool);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* parse loaded vhost directives to compatible mode.
|
|
||||||
* for exmaple, SRS1/2 use the follow refer style:
|
|
||||||
* refer a.domain.com b.domain.com;
|
|
||||||
* while SRS3 use the following:
|
|
||||||
* refer {
|
|
||||||
* enabled on;
|
|
||||||
* all a.domain.com b.domain.com;
|
|
||||||
* }
|
|
||||||
* so we must transform the vhost directive anytime load the config.
|
|
||||||
* @param root the root directive to transform, in and out parameter.
|
|
||||||
*/
|
|
||||||
extern int srs_config_transform_vhost(SrsConfDirective* root);
|
|
||||||
|
|
||||||
// global config
|
|
||||||
extern SrsConfig* _srs_config;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <srs_kernel_log.hpp>
|
#include <srs_kernel_log.hpp>
|
||||||
#include <srs_kernel_error.hpp>
|
#include <srs_kernel_error.hpp>
|
||||||
#include <srs_app_utility.hpp>
|
#include <srs_app_utility.hpp>
|
||||||
|
#include <srs_kernel_utility.hpp>
|
||||||
|
|
||||||
IConnectionManager::IConnectionManager()
|
IConnectionManager::IConnectionManager()
|
||||||
{
|
{
|
||||||
|
@ -42,7 +43,12 @@ SrsConnection::SrsConnection(IConnectionManager* cm, st_netfd_t c)
|
||||||
stfd = c;
|
stfd = c;
|
||||||
disposed = false;
|
disposed = false;
|
||||||
expired = false;
|
expired = false;
|
||||||
|
create_time = srs_get_system_time_ms();
|
||||||
|
|
||||||
|
skt = new SrsStSocket(c);
|
||||||
|
kbps = new SrsKbps();
|
||||||
|
kbps->set_io(skt, skt);
|
||||||
|
|
||||||
// the client thread should reap itself,
|
// the client thread should reap itself,
|
||||||
// so we never use joinable.
|
// so we never use joinable.
|
||||||
// TODO: FIXME: maybe other thread need to stop it.
|
// TODO: FIXME: maybe other thread need to stop it.
|
||||||
|
@ -53,10 +59,32 @@ SrsConnection::SrsConnection(IConnectionManager* cm, st_netfd_t c)
|
||||||
SrsConnection::~SrsConnection()
|
SrsConnection::~SrsConnection()
|
||||||
{
|
{
|
||||||
dispose();
|
dispose();
|
||||||
|
|
||||||
|
srs_freep(kbps);
|
||||||
|
srs_freep(skt);
|
||||||
srs_freep(pthread);
|
srs_freep(pthread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SrsConnection::resample()
|
||||||
|
{
|
||||||
|
kbps->resample();
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t SrsConnection::get_send_bytes_delta()
|
||||||
|
{
|
||||||
|
return kbps->get_send_bytes_delta();
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t SrsConnection::get_recv_bytes_delta()
|
||||||
|
{
|
||||||
|
return kbps->get_recv_bytes_delta();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SrsConnection::cleanup()
|
||||||
|
{
|
||||||
|
kbps->cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
void SrsConnection::dispose()
|
void SrsConnection::dispose()
|
||||||
{
|
{
|
||||||
if (disposed) {
|
if (disposed) {
|
||||||
|
@ -86,7 +114,7 @@ int SrsConnection::cycle()
|
||||||
|
|
||||||
ip = srs_get_peer_ip(st_netfd_fileno(stfd));
|
ip = srs_get_peer_ip(st_netfd_fileno(stfd));
|
||||||
|
|
||||||
ret = do_cycle();
|
int oret = ret = do_cycle();
|
||||||
|
|
||||||
// if socket io error, set to closed.
|
// if socket io error, set to closed.
|
||||||
if (srs_is_client_gracefully_close(ret)) {
|
if (srs_is_client_gracefully_close(ret)) {
|
||||||
|
@ -100,7 +128,7 @@ int SrsConnection::cycle()
|
||||||
|
|
||||||
// client close peer.
|
// client close peer.
|
||||||
if (ret == ERROR_SOCKET_CLOSED) {
|
if (ret == ERROR_SOCKET_CLOSED) {
|
||||||
srs_warn("client disconnect peer. ret=%d", ret);
|
srs_warn("client disconnect peer. oret=%d, ret=%d", oret, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
|
|
@ -93,9 +93,31 @@ protected:
|
||||||
* when expired, the connection must never be served and quit ASAP.
|
* when expired, the connection must never be served and quit ASAP.
|
||||||
*/
|
*/
|
||||||
bool expired;
|
bool expired;
|
||||||
|
/**
|
||||||
|
* the underlayer socket.
|
||||||
|
*/
|
||||||
|
SrsStSocket* skt;
|
||||||
|
/**
|
||||||
|
* connection total kbps.
|
||||||
|
* not only the rtmp or http connection, all type of connection are
|
||||||
|
* need to statistic the kbps of io.
|
||||||
|
* the SrsStatistic will use it indirectly to statistic the bytes delta of current connection.
|
||||||
|
*/
|
||||||
|
SrsKbps* kbps;
|
||||||
|
/**
|
||||||
|
* the create time in milliseconds.
|
||||||
|
* for current connection to log self create time and calculate the living time.
|
||||||
|
*/
|
||||||
|
int64_t create_time;
|
||||||
public:
|
public:
|
||||||
SrsConnection(IConnectionManager* cm, st_netfd_t c);
|
SrsConnection(IConnectionManager* cm, st_netfd_t c);
|
||||||
virtual ~SrsConnection();
|
virtual ~SrsConnection();
|
||||||
|
// interface IKbpsDelta
|
||||||
|
public:
|
||||||
|
virtual void resample();
|
||||||
|
virtual int64_t get_send_bytes_delta();
|
||||||
|
virtual int64_t get_recv_bytes_delta();
|
||||||
|
virtual void cleanup();
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* to dipose the connection.
|
* to dipose the connection.
|
||||||
|
|
|
@ -70,6 +70,7 @@ SrsEdgeIngester::SrsEdgeIngester()
|
||||||
origin_index = 0;
|
origin_index = 0;
|
||||||
stream_id = 0;
|
stream_id = 0;
|
||||||
stfd = NULL;
|
stfd = NULL;
|
||||||
|
curr_origin_server = "";
|
||||||
pthread = new SrsReusableThread2("edge-igs", this, SRS_EDGE_INGESTER_SLEEP_US);
|
pthread = new SrsReusableThread2("edge-igs", this, SRS_EDGE_INGESTER_SLEEP_US);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +119,11 @@ void SrsEdgeIngester::stop()
|
||||||
_source->on_unpublish();
|
_source->on_unpublish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string SrsEdgeIngester::get_curr_origin()
|
||||||
|
{
|
||||||
|
return curr_origin_server;
|
||||||
|
}
|
||||||
|
|
||||||
int SrsEdgeIngester::cycle()
|
int SrsEdgeIngester::cycle()
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
@ -205,7 +211,7 @@ int SrsEdgeIngester::ingest()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,9 +358,9 @@ int SrsEdgeIngester::connect_server(string& ep_server, string& ep_port)
|
||||||
}
|
}
|
||||||
|
|
||||||
// select the origin.
|
// select the origin.
|
||||||
std::string server = conf->args.at(origin_index % conf->args.size());
|
std::string server = curr_origin_server = conf->args.at(origin_index % conf->args.size());
|
||||||
origin_index = (origin_index + 1) % conf->args.size();
|
origin_index = (origin_index + 1) % conf->args.size();
|
||||||
|
|
||||||
std::string s_port = SRS_CONSTS_RTMP_DEFAULT_PORT;
|
std::string s_port = SRS_CONSTS_RTMP_DEFAULT_PORT;
|
||||||
int port = ::atoi(SRS_CONSTS_RTMP_DEFAULT_PORT);
|
int port = ::atoi(SRS_CONSTS_RTMP_DEFAULT_PORT);
|
||||||
size_t pos = server.find(":");
|
size_t pos = server.find(":");
|
||||||
|
@ -754,6 +760,11 @@ void SrsPlayEdge::on_all_client_stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string SrsPlayEdge::get_curr_origin()
|
||||||
|
{
|
||||||
|
return ingester->get_curr_origin();
|
||||||
|
}
|
||||||
|
|
||||||
int SrsPlayEdge::on_ingest_play()
|
int SrsPlayEdge::on_ingest_play()
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
|
@ -89,6 +89,8 @@ private:
|
||||||
SrsKbps* kbps;
|
SrsKbps* kbps;
|
||||||
SrsRtmpClient* client;
|
SrsRtmpClient* client;
|
||||||
int origin_index;
|
int origin_index;
|
||||||
|
// current origin server of current source.
|
||||||
|
std::string curr_origin_server;
|
||||||
public:
|
public:
|
||||||
SrsEdgeIngester();
|
SrsEdgeIngester();
|
||||||
virtual ~SrsEdgeIngester();
|
virtual ~SrsEdgeIngester();
|
||||||
|
@ -96,6 +98,7 @@ public:
|
||||||
virtual int initialize(SrsSource* source, SrsPlayEdge* edge, SrsRequest* req);
|
virtual int initialize(SrsSource* source, SrsPlayEdge* edge, SrsRequest* req);
|
||||||
virtual int start();
|
virtual int start();
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
|
virtual std::string get_curr_origin();
|
||||||
// interface ISrsReusableThread2Handler
|
// interface ISrsReusableThread2Handler
|
||||||
public:
|
public:
|
||||||
virtual int cycle();
|
virtual int cycle();
|
||||||
|
@ -182,6 +185,7 @@ public:
|
||||||
* when all client stopped play, disconnect to origin.
|
* when all client stopped play, disconnect to origin.
|
||||||
*/
|
*/
|
||||||
virtual void on_all_client_stop();
|
virtual void on_all_client_stop();
|
||||||
|
virtual std::string get_curr_origin();
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* when ingester start to play stream.
|
* when ingester start to play stream.
|
||||||
|
|
|
@ -387,13 +387,13 @@ int SrsHlsMuxer::deviation()
|
||||||
int SrsHlsMuxer::initialize(ISrsHlsHandler* h)
|
int SrsHlsMuxer::initialize(ISrsHlsHandler* h)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
handler = h;
|
handler = h;
|
||||||
|
|
||||||
if ((ret = async->start()) != ERROR_SUCCESS) {
|
if ((ret = async->start()) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,7 +724,7 @@ int SrsHlsMuxer::segment_close(string log_desc)
|
||||||
// when too large, it maybe timestamp corrupt.
|
// when too large, it maybe timestamp corrupt.
|
||||||
if (current->duration * 1000 >= SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS && (int)current->duration <= max_td) {
|
if (current->duration * 1000 >= SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS && (int)current->duration <= max_td) {
|
||||||
segments.push_back(current);
|
segments.push_back(current);
|
||||||
|
|
||||||
// use async to call the http hooks, for it will cause thread switch.
|
// use async to call the http hooks, for it will cause thread switch.
|
||||||
if ((ret = async->execute(new SrsDvrAsyncCallOnHls(
|
if ((ret = async->execute(new SrsDvrAsyncCallOnHls(
|
||||||
_srs_context->get_id(), req,
|
_srs_context->get_id(), req,
|
||||||
|
@ -733,12 +733,12 @@ int SrsHlsMuxer::segment_close(string log_desc)
|
||||||
{
|
{
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use async to call the http hooks, for it will cause thread switch.
|
// use async to call the http hooks, for it will cause thread switch.
|
||||||
if ((ret = async->execute(new SrsDvrAsyncCallOnHlsNotify(_srs_context->get_id(), req, current->uri))) != ERROR_SUCCESS) {
|
if ((ret = async->execute(new SrsDvrAsyncCallOnHlsNotify(_srs_context->get_id(), req, current->uri))) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_info("%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64,
|
srs_info("%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64,
|
||||||
log_desc.c_str(), current->sequence_no, current->uri.c_str(), current->duration,
|
log_desc.c_str(), current->sequence_no, current->uri.c_str(), current->duration,
|
||||||
current->segment_start_dts);
|
current->segment_start_dts);
|
||||||
|
@ -749,12 +749,12 @@ int SrsHlsMuxer::segment_close(string log_desc)
|
||||||
srs_error("notify handler for update ts failed. ret=%d", ret);
|
srs_error("notify handler for update ts failed. ret=%d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// close the muxer of finished segment.
|
// close the muxer of finished segment.
|
||||||
srs_freep(current->muxer);
|
srs_freep(current->muxer);
|
||||||
std::string full_path = current->full_path;
|
std::string full_path = current->full_path;
|
||||||
current = NULL;
|
current = NULL;
|
||||||
|
|
||||||
// rename from tmp to real path
|
// rename from tmp to real path
|
||||||
std::string tmp_file = full_path + ".tmp";
|
std::string tmp_file = full_path + ".tmp";
|
||||||
if (should_write_file && rename(tmp_file.c_str(), full_path.c_str()) < 0) {
|
if (should_write_file && rename(tmp_file.c_str(), full_path.c_str()) < 0) {
|
||||||
|
@ -766,11 +766,11 @@ int SrsHlsMuxer::segment_close(string log_desc)
|
||||||
} else {
|
} else {
|
||||||
// reuse current segment index.
|
// reuse current segment index.
|
||||||
_sequence_no--;
|
_sequence_no--;
|
||||||
|
|
||||||
srs_trace("%s drop ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64"",
|
srs_trace("%s drop ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64"",
|
||||||
log_desc.c_str(), current->sequence_no, current->uri.c_str(), current->duration,
|
log_desc.c_str(), current->sequence_no, current->uri.c_str(), current->duration,
|
||||||
current->segment_start_dts);
|
current->segment_start_dts);
|
||||||
|
|
||||||
// rename from tmp to real path
|
// rename from tmp to real path
|
||||||
std::string tmp_file = current->full_path + ".tmp";
|
std::string tmp_file = current->full_path + ".tmp";
|
||||||
if (should_write_file) {
|
if (should_write_file) {
|
||||||
|
@ -778,13 +778,13 @@ int SrsHlsMuxer::segment_close(string log_desc)
|
||||||
srs_warn("ignore unlink path failed, file=%s.", tmp_file.c_str());
|
srs_warn("ignore unlink path failed, file=%s.", tmp_file.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_freep(current);
|
srs_freep(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
// the segments to remove
|
// the segments to remove
|
||||||
std::vector<SrsHlsSegment*> segment_to_remove;
|
std::vector<SrsHlsSegment*> segment_to_remove;
|
||||||
|
|
||||||
// shrink the segments.
|
// shrink the segments.
|
||||||
double duration = 0;
|
double duration = 0;
|
||||||
int remove_index = -1;
|
int remove_index = -1;
|
||||||
|
@ -802,7 +802,7 @@ int SrsHlsMuxer::segment_close(string log_desc)
|
||||||
segments.erase(segments.begin());
|
segments.erase(segments.begin());
|
||||||
segment_to_remove.push_back(segment);
|
segment_to_remove.push_back(segment);
|
||||||
}
|
}
|
||||||
|
|
||||||
// refresh the m3u8, donot contains the removed ts
|
// refresh the m3u8, donot contains the removed ts
|
||||||
ret = refresh_m3u8();
|
ret = refresh_m3u8();
|
||||||
|
|
||||||
|
@ -815,24 +815,24 @@ int SrsHlsMuxer::segment_close(string log_desc)
|
||||||
srs_warn("cleanup unlink path failed, file=%s.", segment->full_path.c_str());
|
srs_warn("cleanup unlink path failed, file=%s.", segment->full_path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (should_write_cache) {
|
if (should_write_cache) {
|
||||||
if ((ret = handler->on_remove_ts(req, segment->uri)) != ERROR_SUCCESS) {
|
if ((ret = handler->on_remove_ts(req, segment->uri)) != ERROR_SUCCESS) {
|
||||||
srs_warn("remove the ts from ram hls failed. ret=%d", ret);
|
srs_warn("remove the ts from ram hls failed. ret=%d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_freep(segment);
|
srs_freep(segment);
|
||||||
}
|
}
|
||||||
segment_to_remove.clear();
|
segment_to_remove.clear();
|
||||||
|
|
||||||
// check ret of refresh m3u8
|
// check ret of refresh m3u8
|
||||||
if (ret != ERROR_SUCCESS) {
|
if (ret != ERROR_SUCCESS) {
|
||||||
srs_error("refresh m3u8 failed. ret=%d", ret);
|
srs_error("refresh m3u8 failed. ret=%d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ SrsHttpClient::SrsHttpClient()
|
||||||
skt = NULL;
|
skt = NULL;
|
||||||
parser = NULL;
|
parser = NULL;
|
||||||
timeout_us = 0;
|
timeout_us = 0;
|
||||||
|
port = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsHttpClient::~SrsHttpClient()
|
SrsHttpClient::~SrsHttpClient()
|
||||||
|
@ -56,6 +57,11 @@ int SrsHttpClient::initialize(string h, int p, int64_t t_us)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
// disconnect first when h:p changed.
|
||||||
|
if ((!host.empty() && host != h) || (port != 0 && port != p)) {
|
||||||
|
disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
srs_freep(parser);
|
srs_freep(parser);
|
||||||
parser = new SrsHttpParser();
|
parser = new SrsHttpParser();
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,9 @@ using namespace std;
|
||||||
#include <srs_app_http_static.hpp>
|
#include <srs_app_http_static.hpp>
|
||||||
#include <srs_app_http_stream.hpp>
|
#include <srs_app_http_stream.hpp>
|
||||||
#include <srs_app_http_api.hpp>
|
#include <srs_app_http_api.hpp>
|
||||||
|
#include <srs_protocol_json.hpp>
|
||||||
|
#include <srs_app_http_hooks.hpp>
|
||||||
|
#include <srs_rtmp_amf0.hpp>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1204,47 +1207,57 @@ int SrsHttpConn::do_cycle()
|
||||||
srs_error("http initialize http parser failed. ret=%d", ret);
|
srs_error("http initialize http parser failed. ret=%d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// underlayer socket
|
|
||||||
SrsStSocket skt(stfd);
|
|
||||||
|
|
||||||
// set the recv timeout, for some clients never disconnect the connection.
|
// set the recv timeout, for some clients never disconnect the connection.
|
||||||
// @see https://github.com/simple-rtmp-server/srs/issues/398
|
// @see https://github.com/simple-rtmp-server/srs/issues/398
|
||||||
skt.set_recv_timeout(SRS_HTTP_RECV_TIMEOUT_US);
|
skt->set_recv_timeout(SRS_HTTP_RECV_TIMEOUT_US);
|
||||||
|
|
||||||
|
SrsRequest* last_req = NULL;
|
||||||
|
SrsAutoFree(SrsRequest, last_req);
|
||||||
|
|
||||||
// process http messages.
|
// process http messages.
|
||||||
while (!disposed) {
|
while (!disposed) {
|
||||||
ISrsHttpMessage* req = NULL;
|
ISrsHttpMessage* req = NULL;
|
||||||
|
|
||||||
// get a http message
|
// get a http message
|
||||||
if ((ret = parser->parse_message(&skt, this, &req)) != ERROR_SUCCESS) {
|
if ((ret = parser->parse_message(skt, this, &req)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if SUCCESS, always NOT-NULL.
|
// if SUCCESS, always NOT-NULL.
|
||||||
srs_assert(req);
|
srs_assert(req);
|
||||||
|
|
||||||
// always free it in this scope.
|
// always free it in this scope.
|
||||||
SrsAutoFree(ISrsHttpMessage, req);
|
SrsAutoFree(ISrsHttpMessage, req);
|
||||||
|
|
||||||
|
// get the last request, for report the info of request on connection disconnect.
|
||||||
|
delete last_req;
|
||||||
|
SrsHttpMessage* hreq = dynamic_cast<SrsHttpMessage*>(req);
|
||||||
|
last_req = hreq->to_request(hreq->host());
|
||||||
|
|
||||||
// may should discard the body.
|
// may should discard the body.
|
||||||
if ((ret = on_got_http_message(req)) != ERROR_SUCCESS) {
|
if ((ret = on_got_http_message(req)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ok, handle http request.
|
// ok, handle http request.
|
||||||
SrsHttpResponseWriter writer(&skt);
|
SrsHttpResponseWriter writer(skt);
|
||||||
if ((ret = process_request(&writer, req)) != ERROR_SUCCESS) {
|
if ((ret = process_request(&writer, req)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// donot keep alive, disconnect it.
|
// donot keep alive, disconnect it.
|
||||||
// @see https://github.com/simple-rtmp-server/srs/issues/399
|
// @see https://github.com/simple-rtmp-server/srs/issues/399
|
||||||
if (!req->is_keep_alive()) {
|
if (!req->is_keep_alive()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int disc_ret = ERROR_SUCCESS;
|
||||||
|
if ((disc_ret = on_disconnect(last_req)) != ERROR_SUCCESS) {
|
||||||
|
srs_warn("connection on disconnect peer failed, but ignore this error. disc_ret=%d, ret=%d", disc_ret, ret);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1266,6 +1279,13 @@ int SrsHttpConn::process_request(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SrsHttpConn::on_disconnect(SrsRequest* req)
|
||||||
|
{
|
||||||
|
int ret = ERROR_SUCCESS;
|
||||||
|
// TODO: implements it.s
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
SrsResponseOnlyHttpConn::SrsResponseOnlyHttpConn(IConnectionManager* cm, st_netfd_t fd, ISrsHttpServeMux* m)
|
SrsResponseOnlyHttpConn::SrsResponseOnlyHttpConn(IConnectionManager* cm, st_netfd_t fd, ISrsHttpServeMux* m)
|
||||||
: SrsHttpConn(cm, fd, m)
|
: SrsHttpConn(cm, fd, m)
|
||||||
{
|
{
|
||||||
|
|
|
@ -406,6 +406,12 @@ protected:
|
||||||
virtual int on_got_http_message(ISrsHttpMessage* msg) = 0;
|
virtual int on_got_http_message(ISrsHttpMessage* msg) = 0;
|
||||||
private:
|
private:
|
||||||
virtual int process_request(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
|
virtual int process_request(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
|
||||||
|
/**
|
||||||
|
* when the connection disconnect, call this method.
|
||||||
|
* e.g. log msg of connection and report to other system.
|
||||||
|
* @param request: request which is converted by the last http message.
|
||||||
|
*/
|
||||||
|
virtual int on_disconnect(SrsRequest* req);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -474,13 +474,13 @@ int SrsHttpHooks::do_post(SrsHttpClient* hc, std::string url, std::string req, i
|
||||||
srs_error("res code error, ret=%d", ret);
|
srs_error("res code error, ret=%d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res_code->to_integer()) != ERROR_SUCCESS) {
|
if ((res_code->to_integer()) != ERROR_SUCCESS) {
|
||||||
ret = ERROR_RESPONSE_CODE;
|
ret = ERROR_RESPONSE_CODE;
|
||||||
srs_error("res code error, ret=%d, code=%d", ret, code);
|
srs_error("res code error, ret=%d, code=%d", ret, code);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ using namespace std;
|
||||||
#include <srs_app_pithy_print.hpp>
|
#include <srs_app_pithy_print.hpp>
|
||||||
#include <srs_app_source.hpp>
|
#include <srs_app_source.hpp>
|
||||||
#include <srs_app_server.hpp>
|
#include <srs_app_server.hpp>
|
||||||
|
#include <srs_app_statistic.hpp>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -494,6 +495,13 @@ int SrsLiveStream::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
||||||
SrsAutoFree(SrsPithyPrint, pprint);
|
SrsAutoFree(SrsPithyPrint, pprint);
|
||||||
|
|
||||||
SrsMessageArray msgs(SRS_PERF_MW_MSGS);
|
SrsMessageArray msgs(SRS_PERF_MW_MSGS);
|
||||||
|
|
||||||
|
// update the statistic when source disconveried.
|
||||||
|
SrsStatistic* stat = SrsStatistic::instance();
|
||||||
|
if ((ret = stat->on_client(_srs_context->get_id(), req, NULL, SrsRtmpConnPlay)) != ERROR_SUCCESS) {
|
||||||
|
srs_error("stat client failed. ret=%d", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// the memory writer.
|
// the memory writer.
|
||||||
SrsStreamWriter writer(w);
|
SrsStreamWriter writer(w);
|
||||||
|
@ -1132,7 +1140,7 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph)
|
||||||
if (ext.empty()) {
|
if (ext.empty()) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the actually request vhost.
|
// find the actually request vhost.
|
||||||
SrsConfDirective* vhost = _srs_config->get_vhost(request->host());
|
SrsConfDirective* vhost = _srs_config->get_vhost(request->host());
|
||||||
if (!vhost || !_srs_config->get_vhost_enabled(vhost)) {
|
if (!vhost || !_srs_config->get_vhost_enabled(vhost)) {
|
||||||
|
@ -1179,7 +1187,7 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert to concreate class.
|
// convert to concreate class.
|
||||||
SrsHttpMessage* hreq = dynamic_cast<SrsHttpMessage*>(request);
|
SrsHttpMessage* hreq = dynamic_cast<SrsHttpMessage*>(request);
|
||||||
srs_assert(hreq);
|
srs_assert(hreq);
|
||||||
|
|
24
trunk/src/app/srs_app_rtmp_conn.cpp
Executable file → Normal file
24
trunk/src/app/srs_app_rtmp_conn.cpp
Executable file → Normal file
|
@ -53,6 +53,8 @@ using namespace std;
|
||||||
#include <srs_kernel_utility.hpp>
|
#include <srs_kernel_utility.hpp>
|
||||||
#include <srs_app_security.hpp>
|
#include <srs_app_security.hpp>
|
||||||
#include <srs_app_statistic.hpp>
|
#include <srs_app_statistic.hpp>
|
||||||
|
#include <srs_rtmp_utility.hpp>
|
||||||
|
#include <srs_protocol_json.hpp>
|
||||||
|
|
||||||
// when stream is busy, for example, streaming is already
|
// when stream is busy, for example, streaming is already
|
||||||
// publishing, when a new client to request to publish,
|
// publishing, when a new client to request to publish,
|
||||||
|
@ -89,13 +91,13 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* svr, st_netfd_t c)
|
||||||
kbps = new SrsKbps();
|
kbps = new SrsKbps();
|
||||||
kbps->set_io(skt, skt);
|
kbps->set_io(skt, skt);
|
||||||
wakable = NULL;
|
wakable = NULL;
|
||||||
|
|
||||||
mw_sleep = SRS_PERF_MW_SLEEP;
|
mw_sleep = SRS_PERF_MW_SLEEP;
|
||||||
mw_enabled = false;
|
mw_enabled = false;
|
||||||
realtime = SRS_PERF_MIN_LATENCY_ENABLED;
|
realtime = SRS_PERF_MIN_LATENCY_ENABLED;
|
||||||
send_min_interval = 0;
|
send_min_interval = 0;
|
||||||
tcp_nodelay = false;
|
tcp_nodelay = false;
|
||||||
|
|
||||||
_srs_config->subscribe(this);
|
_srs_config->subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,8 +210,11 @@ int SrsRtmpConn::do_cycle()
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = service_cycle();
|
ret = service_cycle();
|
||||||
|
|
||||||
http_hooks_on_close();
|
int disc_ret = ERROR_SUCCESS;
|
||||||
|
if ((disc_ret = on_disconnect()) != ERROR_SUCCESS) {
|
||||||
|
srs_warn("connection on disconnect peer failed, but ignore this error. disc_ret=%d, ret=%d", disc_ret, ret);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1308,6 +1313,17 @@ int SrsRtmpConn::do_token_traverse_auth(SrsRtmpClient* client)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SrsRtmpConn::on_disconnect()
|
||||||
|
{
|
||||||
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
http_hooks_on_close();
|
||||||
|
|
||||||
|
// TODO: implements it.
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int SrsRtmpConn::http_hooks_on_connect()
|
int SrsRtmpConn::http_hooks_on_connect()
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
5
trunk/src/app/srs_app_rtmp_conn.hpp
Executable file → Normal file
5
trunk/src/app/srs_app_rtmp_conn.hpp
Executable file → Normal file
|
@ -134,6 +134,11 @@ private:
|
||||||
virtual int check_edge_token_traverse_auth();
|
virtual int check_edge_token_traverse_auth();
|
||||||
virtual int connect_server(int origin_index, st_netfd_t* pstsock);
|
virtual int connect_server(int origin_index, st_netfd_t* pstsock);
|
||||||
virtual int do_token_traverse_auth(SrsRtmpClient* client);
|
virtual int do_token_traverse_auth(SrsRtmpClient* client);
|
||||||
|
/**
|
||||||
|
* when the connection disconnect, call this method.
|
||||||
|
* e.g. log msg of connection and report to other system.
|
||||||
|
*/
|
||||||
|
virtual int on_disconnect();
|
||||||
private:
|
private:
|
||||||
virtual int http_hooks_on_connect();
|
virtual int http_hooks_on_connect();
|
||||||
virtual void http_hooks_on_close();
|
virtual void http_hooks_on_close();
|
||||||
|
|
5
trunk/src/app/srs_app_source.cpp
Executable file → Normal file
5
trunk/src/app/srs_app_source.cpp
Executable file → Normal file
|
@ -2292,3 +2292,8 @@ void SrsSource::destroy_forwarders()
|
||||||
forwarders.clear();
|
forwarders.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string SrsSource::get_curr_origin()
|
||||||
|
{
|
||||||
|
return play_edge->get_curr_origin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
2
trunk/src/app/srs_app_source.hpp
Executable file → Normal file
2
trunk/src/app/srs_app_source.hpp
Executable file → Normal file
|
@ -592,6 +592,8 @@ public:
|
||||||
private:
|
private:
|
||||||
virtual int create_forwarders();
|
virtual int create_forwarders();
|
||||||
virtual void destroy_forwarders();
|
virtual void destroy_forwarders();
|
||||||
|
public:
|
||||||
|
virtual std::string get_curr_origin();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <srs_kernel_codec.hpp>
|
#include <srs_kernel_codec.hpp>
|
||||||
#include <srs_rtmp_stack.hpp>
|
#include <srs_rtmp_stack.hpp>
|
||||||
|
|
|
@ -435,6 +435,11 @@ void SrsReusableThread::stop()
|
||||||
pthread->stop();
|
pthread->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SrsReusableThread::can_loop()
|
||||||
|
{
|
||||||
|
return pthread->can_loop();
|
||||||
|
}
|
||||||
|
|
||||||
int SrsReusableThread::cid()
|
int SrsReusableThread::cid()
|
||||||
{
|
{
|
||||||
return pthread->cid();
|
return pthread->cid();
|
||||||
|
|
|
@ -340,6 +340,12 @@ public:
|
||||||
* @remark user can stop multiple times, ignore if already stopped.
|
* @remark user can stop multiple times, ignore if already stopped.
|
||||||
*/
|
*/
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
|
/**
|
||||||
|
* whether the thread should loop,
|
||||||
|
* used for handler->cycle() which has a loop method,
|
||||||
|
* to check this method, break if false.
|
||||||
|
*/
|
||||||
|
virtual bool can_loop();
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* get the context id. @see: ISrsThreadContext.get_id().
|
* get the context id. @see: ISrsThreadContext.get_id().
|
||||||
|
|
|
@ -1483,3 +1483,17 @@ void srs_api_dump_summaries(SrsAmf0Object* obj)
|
||||||
sys->set("conn_srs", SrsAmf0Any::number(nrs->nb_conn_srs));
|
sys->set("conn_srs", SrsAmf0Any::number(nrs->nb_conn_srs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string srs_join_vector_string(vector<string>& vs, string separator)
|
||||||
|
{
|
||||||
|
string str = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < (int)vs.size(); i++) {
|
||||||
|
str += vs.at(i);
|
||||||
|
if (i != (int)vs.size() - 1) {
|
||||||
|
str += separator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -684,5 +684,8 @@ extern bool srs_is_boolean(const std::string& str);
|
||||||
// dump summaries for /api/v1/summaries.
|
// dump summaries for /api/v1/summaries.
|
||||||
extern void srs_api_dump_summaries(SrsAmf0Object* obj);
|
extern void srs_api_dump_summaries(SrsAmf0Object* obj);
|
||||||
|
|
||||||
|
// join string in vector with indicated separator
|
||||||
|
extern std::string srs_join_vector_string(std::vector<std::string>& vs, std::string separator);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// default vhost of rtmp
|
// default vhost of rtmp
|
||||||
#define SRS_CONSTS_RTMP_DEFAULT_VHOST "__defaultVhost__"
|
#define SRS_CONSTS_RTMP_DEFAULT_VHOST "__defaultVhost__"
|
||||||
|
#define SRS_CONSTS_RTMP_DEFAULT_APP "__defaultApp__"
|
||||||
// default port of rtmp
|
// default port of rtmp
|
||||||
#define SRS_CONSTS_RTMP_DEFAULT_PORT "1935"
|
#define SRS_CONSTS_RTMP_DEFAULT_PORT "1935"
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,7 @@ ISrsTsHandler::~ISrsTsHandler()
|
||||||
SrsTsContext::SrsTsContext()
|
SrsTsContext::SrsTsContext()
|
||||||
{
|
{
|
||||||
pure_audio = false;
|
pure_audio = false;
|
||||||
|
sync_byte = 0x47; // ts default sync byte.
|
||||||
vcodec = SrsCodecVideoReserved;
|
vcodec = SrsCodecVideoReserved;
|
||||||
acodec = SrsCodecAudioReserved1;
|
acodec = SrsCodecAudioReserved1;
|
||||||
}
|
}
|
||||||
|
@ -368,6 +369,11 @@ int SrsTsContext::encode(SrsFileWriter* writer, SrsTsMessage* msg, SrsCodecVideo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SrsTsContext::set_sync_byte(int8_t sb)
|
||||||
|
{
|
||||||
|
sync_byte = sb;
|
||||||
|
}
|
||||||
|
|
||||||
int SrsTsContext::encode_pat_pmt(SrsFileWriter* writer, int16_t vpid, SrsTsStream vs, int16_t apid, SrsTsStream as)
|
int SrsTsContext::encode_pat_pmt(SrsFileWriter* writer, int16_t vpid, SrsTsStream vs, int16_t apid, SrsTsStream as)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
@ -384,6 +390,8 @@ int SrsTsContext::encode_pat_pmt(SrsFileWriter* writer, int16_t vpid, SrsTsStrea
|
||||||
SrsTsPacket* pkt = SrsTsPacket::create_pat(this, pmt_number, pmt_pid);
|
SrsTsPacket* pkt = SrsTsPacket::create_pat(this, pmt_number, pmt_pid);
|
||||||
SrsAutoFree(SrsTsPacket, pkt);
|
SrsAutoFree(SrsTsPacket, pkt);
|
||||||
|
|
||||||
|
pkt->sync_byte = sync_byte;
|
||||||
|
|
||||||
char* buf = new char[SRS_TS_PACKET_SIZE];
|
char* buf = new char[SRS_TS_PACKET_SIZE];
|
||||||
SrsAutoFree(char, buf);
|
SrsAutoFree(char, buf);
|
||||||
|
|
||||||
|
@ -409,6 +417,8 @@ int SrsTsContext::encode_pat_pmt(SrsFileWriter* writer, int16_t vpid, SrsTsStrea
|
||||||
SrsTsPacket* pkt = SrsTsPacket::create_pmt(this, pmt_number, pmt_pid, vpid, vs, apid, as);
|
SrsTsPacket* pkt = SrsTsPacket::create_pmt(this, pmt_number, pmt_pid, vpid, vs, apid, as);
|
||||||
SrsAutoFree(SrsTsPacket, pkt);
|
SrsAutoFree(SrsTsPacket, pkt);
|
||||||
|
|
||||||
|
pkt->sync_byte = sync_byte;
|
||||||
|
|
||||||
char* buf = new char[SRS_TS_PACKET_SIZE];
|
char* buf = new char[SRS_TS_PACKET_SIZE];
|
||||||
SrsAutoFree(char, buf);
|
SrsAutoFree(char, buf);
|
||||||
|
|
||||||
|
@ -479,6 +489,8 @@ int SrsTsContext::encode_pes(SrsFileWriter* writer, SrsTsMessage* msg, int16_t p
|
||||||
}
|
}
|
||||||
SrsAutoFree(SrsTsPacket, pkt);
|
SrsAutoFree(SrsTsPacket, pkt);
|
||||||
|
|
||||||
|
pkt->sync_byte = sync_byte;
|
||||||
|
|
||||||
char* buf = new char[SRS_TS_PACKET_SIZE];
|
char* buf = new char[SRS_TS_PACKET_SIZE];
|
||||||
SrsAutoFree(char, buf);
|
SrsAutoFree(char, buf);
|
||||||
|
|
||||||
|
@ -2704,7 +2716,7 @@ int SrsTSMuxer::open(string p)
|
||||||
path = p;
|
path = p;
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
||||||
// reset the context for a new ts start.
|
// reset the context for a new ts start.
|
||||||
context->reset();
|
context->reset();
|
||||||
|
|
||||||
|
|
|
@ -345,6 +345,7 @@ class SrsTsContext
|
||||||
private:
|
private:
|
||||||
std::map<int, SrsTsChannel*> pids;
|
std::map<int, SrsTsChannel*> pids;
|
||||||
bool pure_audio;
|
bool pure_audio;
|
||||||
|
int8_t sync_byte;
|
||||||
// encoder
|
// encoder
|
||||||
private:
|
private:
|
||||||
// when any codec changed, write the PAT/PMT.
|
// when any codec changed, write the PAT/PMT.
|
||||||
|
@ -394,6 +395,13 @@ public:
|
||||||
* @param ac the audio codec, write the PAT/PMT table when changed.
|
* @param ac the audio codec, write the PAT/PMT table when changed.
|
||||||
*/
|
*/
|
||||||
virtual int encode(SrsFileWriter* writer, SrsTsMessage* msg, SrsCodecVideo vc, SrsCodecAudio ac);
|
virtual int encode(SrsFileWriter* writer, SrsTsMessage* msg, SrsCodecVideo vc, SrsCodecAudio ac);
|
||||||
|
// drm methods
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* set sync byte of ts segment.
|
||||||
|
* replace the standard ts sync byte to bravo sync byte.
|
||||||
|
*/
|
||||||
|
virtual void set_sync_byte(int8_t sb);
|
||||||
private:
|
private:
|
||||||
virtual int encode_pat_pmt(SrsFileWriter* writer, int16_t vpid, SrsTsStream vs, int16_t apid, SrsTsStream as);
|
virtual int encode_pat_pmt(SrsFileWriter* writer, int16_t vpid, SrsTsStream vs, int16_t apid, SrsTsStream as);
|
||||||
virtual int encode_pes(SrsFileWriter* writer, SrsTsMessage* msg, int16_t pid, SrsTsStream sid, bool pure_audio);
|
virtual int encode_pes(SrsFileWriter* writer, SrsTsMessage* msg, int16_t pid, SrsTsStream sid, bool pure_audio);
|
||||||
|
|
|
@ -258,7 +258,7 @@ int main(int argc, char** argv)
|
||||||
#ifdef SRS_AUTO_GPERF_MP
|
#ifdef SRS_AUTO_GPERF_MP
|
||||||
#warning "gmp is not used for memory leak, please use gmc instead."
|
#warning "gmp is not used for memory leak, please use gmc instead."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// never use srs log(srs_trace, srs_error, etc) before config parse the option,
|
// never use srs log(srs_trace, srs_error, etc) before config parse the option,
|
||||||
// which will load the log config and apply it.
|
// which will load the log config and apply it.
|
||||||
if ((ret = _srs_config->parse_options(argc, argv)) != ERROR_SUCCESS) {
|
if ((ret = _srs_config->parse_options(argc, argv)) != ERROR_SUCCESS) {
|
||||||
|
@ -274,7 +274,7 @@ int main(int argc, char** argv)
|
||||||
if ((ret = _srs_config->check_config()) != ERROR_SUCCESS) {
|
if ((ret = _srs_config->check_config()) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION);
|
srs_trace("srs(simple-rtmp-server) "RTMP_SIG_SRS_VERSION);
|
||||||
srs_trace("license: "RTMP_SIG_SRS_LICENSE", "RTMP_SIG_SRS_COPYRIGHT);
|
srs_trace("license: "RTMP_SIG_SRS_LICENSE", "RTMP_SIG_SRS_COPYRIGHT);
|
||||||
srs_trace("primary/master: "RTMP_SIG_SRS_PRIMARY);
|
srs_trace("primary/master: "RTMP_SIG_SRS_PRIMARY);
|
||||||
|
@ -288,11 +288,11 @@ int main(int argc, char** argv)
|
||||||
srs_trace("arm tool chain: "SRS_AUTO_EMBEDED_TOOL_CHAIN);
|
srs_trace("arm tool chain: "SRS_AUTO_EMBEDED_TOOL_CHAIN);
|
||||||
#endif
|
#endif
|
||||||
srs_trace("conf: %s, limit: %d", _srs_config->config().c_str(), _srs_config->get_max_connections());
|
srs_trace("conf: %s, limit: %d", _srs_config->config().c_str(), _srs_config->get_max_connections());
|
||||||
|
|
||||||
// features
|
// features
|
||||||
check_macro_features();
|
check_macro_features();
|
||||||
show_macro_features();
|
show_macro_features();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* we do nothing in the constructor of server,
|
* we do nothing in the constructor of server,
|
||||||
* and use initialize to create members, set hooks for instance the reload handler,
|
* and use initialize to create members, set hooks for instance the reload handler,
|
||||||
|
@ -357,7 +357,7 @@ int run_master()
|
||||||
if ((ret = _srs_server->initialize_st()) != ERROR_SUCCESS) {
|
if ((ret = _srs_server->initialize_st()) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = _srs_server->initialize_signal()) != ERROR_SUCCESS) {
|
if ((ret = _srs_server->initialize_signal()) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,6 +487,36 @@ SrsJsonAny* SrsJsonObject::ensure_property_boolean(string name)
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SrsJsonAny* SrsJsonObject::ensure_property_object(string name)
|
||||||
|
{
|
||||||
|
SrsJsonAny* prop = get_property(name);
|
||||||
|
|
||||||
|
if (!prop) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prop->is_object()) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
SrsJsonAny* SrsJsonObject::ensure_property_array(string name)
|
||||||
|
{
|
||||||
|
SrsJsonAny* prop = get_property(name);
|
||||||
|
|
||||||
|
if (!prop) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prop->is_array()) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
SrsJsonArray::SrsJsonArray()
|
SrsJsonArray::SrsJsonArray()
|
||||||
{
|
{
|
||||||
marker = SRS_JSON_Array;
|
marker = SRS_JSON_Array;
|
||||||
|
|
|
@ -151,6 +151,8 @@ public:
|
||||||
virtual SrsJsonAny* ensure_property_string(std::string name);
|
virtual SrsJsonAny* ensure_property_string(std::string name);
|
||||||
virtual SrsJsonAny* ensure_property_integer(std::string name);
|
virtual SrsJsonAny* ensure_property_integer(std::string name);
|
||||||
virtual SrsJsonAny* ensure_property_boolean(std::string name);
|
virtual SrsJsonAny* ensure_property_boolean(std::string name);
|
||||||
|
virtual SrsJsonAny* ensure_property_object(std::string name);
|
||||||
|
virtual SrsJsonAny* ensure_property_array(std::string name);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SrsJsonArray : public SrsJsonAny
|
class SrsJsonArray : public SrsJsonAny
|
||||||
|
|
|
@ -67,8 +67,13 @@ void srs_discovery_tc_url(
|
||||||
host = host.substr(0, pos);
|
host = host.substr(0, pos);
|
||||||
srs_info("discovery host=%s, port=%s", host.c_str(), port.c_str());
|
srs_info("discovery host=%s, port=%s", host.c_str(), port.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
app = url;
|
if (url.empty()) {
|
||||||
|
app = SRS_CONSTS_RTMP_DEFAULT_APP;
|
||||||
|
} else {
|
||||||
|
app = url;
|
||||||
|
}
|
||||||
|
|
||||||
vhost = host;
|
vhost = host;
|
||||||
srs_vhost_resolve(vhost, app, param);
|
srs_vhost_resolve(vhost, app, param);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +235,7 @@ std::string srs_generate_stream_url(std::string vhost, std::string app, std::str
|
||||||
std::string url = "";
|
std::string url = "";
|
||||||
|
|
||||||
if (SRS_CONSTS_RTMP_DEFAULT_VHOST != vhost){
|
if (SRS_CONSTS_RTMP_DEFAULT_VHOST != vhost){
|
||||||
url += vhost;
|
url += vhost;
|
||||||
}
|
}
|
||||||
url += "/";
|
url += "/";
|
||||||
url += app;
|
url += app;
|
||||||
|
|
|
@ -292,7 +292,7 @@ MockSrsReloadConfig::~MockSrsReloadConfig()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int MockSrsReloadConfig::reload(string buf)
|
int MockSrsReloadConfig::do_reload(string buf)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ int MockSrsReloadConfig::reload(string buf)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return reload_conf(&conf);
|
return MockSrsConfig::reload_conf(&conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_UTEST_RELOAD
|
#ifdef ENABLE_UTEST_RELOAD
|
||||||
|
@ -313,7 +313,7 @@ VOID TEST(ConfigReloadTest, ReloadEmpty)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_FALSE(ERROR_SUCCESS == conf.parse(""));
|
EXPECT_FALSE(ERROR_SUCCESS == conf.parse(""));
|
||||||
EXPECT_FALSE(ERROR_SUCCESS == conf.reload(""));
|
EXPECT_FALSE(ERROR_SUCCESS == conf.do_reload(""));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,35 +324,35 @@ VOID TEST(ConfigReloadTest, ReloadListen)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse("listen 1935;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse("listen 1935;"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload("listen 1935;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload("listen 1935;"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload("listen 1936;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload("listen 1936;"));
|
||||||
EXPECT_TRUE(handler.listen_reloaded);
|
EXPECT_TRUE(handler.listen_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload("listen 1936;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload("listen 1936;"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload("listen 1936 1935;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload("listen 1936 1935;"));
|
||||||
EXPECT_TRUE(handler.listen_reloaded);
|
EXPECT_TRUE(handler.listen_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload("listen 1935;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload("listen 1935;"));
|
||||||
EXPECT_TRUE(handler.listen_reloaded);
|
EXPECT_TRUE(handler.listen_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload("listen 1935 1935;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload("listen 1935 1935;"));
|
||||||
EXPECT_TRUE(handler.listen_reloaded);
|
EXPECT_TRUE(handler.listen_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload("listen 1935;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload("listen 1935;"));
|
||||||
EXPECT_TRUE(handler.listen_reloaded);
|
EXPECT_TRUE(handler.listen_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
@ -365,16 +365,16 @@ VOID TEST(ConfigReloadTest, ReloadPid)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"pid srs.pid;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"pid srs.pid;"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"pid srs.pid;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"pid srs.pid;"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"pid srs1.pid;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"pid srs1.pid;"));
|
||||||
EXPECT_TRUE(handler.pid_reloaded);
|
EXPECT_TRUE(handler.pid_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"pid srs.pid;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"pid srs.pid;"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -386,16 +386,16 @@ VOID TEST(ConfigReloadTest, ReloadLogTank)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"srs_log_tank console;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"srs_log_tank console;"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"srs_log_tank console;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"srs_log_tank console;"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"srs_log_tank file;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"srs_log_tank file;"));
|
||||||
EXPECT_TRUE(handler.log_tank_reloaded);
|
EXPECT_TRUE(handler.log_tank_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"srs_log_tank console;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"srs_log_tank console;"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -407,16 +407,16 @@ VOID TEST(ConfigReloadTest, ReloadLogLevel)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"srs_log_level trace;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"srs_log_level trace;"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"srs_log_level trace;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"srs_log_level trace;"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"srs_log_level warn;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"srs_log_level warn;"));
|
||||||
EXPECT_TRUE(handler.log_level_reloaded);
|
EXPECT_TRUE(handler.log_level_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"srs_log_level trace;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"srs_log_level trace;"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -428,16 +428,16 @@ VOID TEST(ConfigReloadTest, ReloadLogFile)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"srs_log_file srs.log;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"srs_log_file srs.log;"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"srs_log_file srs.log;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"srs_log_file srs.log;"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"srs_log_file srs1.log;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"srs_log_file srs1.log;"));
|
||||||
EXPECT_TRUE(handler.log_file_reloaded);
|
EXPECT_TRUE(handler.log_file_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"srs_log_file srs.log;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"srs_log_file srs.log;"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -449,16 +449,16 @@ VOID TEST(ConfigReloadTest, ReloadPithyPrint)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"pithy_print_ms 1000;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"pithy_print_ms 1000;"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"pithy_print_ms 1000;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"pithy_print_ms 1000;"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"pithy_print_ms 2000;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"pithy_print_ms 2000;"));
|
||||||
EXPECT_TRUE(handler.pithy_print_reloaded);
|
EXPECT_TRUE(handler.pithy_print_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"pithy_print_ms 1000;"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"pithy_print_ms 1000;"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -470,16 +470,16 @@ VOID TEST(ConfigReloadTest, ReloadHttpApiEnabled)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"http_api {enabled off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"http_api {enabled off;}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_api {enabled off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_api {enabled off;}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_api {enabled on;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_api {enabled on;}"));
|
||||||
EXPECT_TRUE(handler.http_api_enabled_reloaded);
|
EXPECT_TRUE(handler.http_api_enabled_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_api {enabled off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_api {enabled off;}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -491,16 +491,16 @@ VOID TEST(ConfigReloadTest, ReloadHttpApiDisabled)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"http_api {enabled on;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"http_api {enabled on;}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_api {enabled on;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_api {enabled on;}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_api {enabled off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_api {enabled off;}"));
|
||||||
EXPECT_TRUE(handler.http_api_disabled_reloaded);
|
EXPECT_TRUE(handler.http_api_disabled_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_api {enabled on;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_api {enabled on;}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -512,16 +512,16 @@ VOID TEST(ConfigReloadTest, ReloadHttpStreamEnabled)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"http_stream {enabled off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"http_stream {enabled off;}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_stream {enabled off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_stream {enabled off;}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_stream {enabled on;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_stream {enabled on;}"));
|
||||||
EXPECT_TRUE(handler.http_stream_enabled_reloaded);
|
EXPECT_TRUE(handler.http_stream_enabled_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_stream {enabled off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_stream {enabled off;}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -533,16 +533,16 @@ VOID TEST(ConfigReloadTest, ReloadHttpStreamDisabled)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"http_stream {enabled on;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"http_stream {enabled on;}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_stream {enabled on;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_stream {enabled on;}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_stream {enabled off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_stream {enabled off;}"));
|
||||||
EXPECT_TRUE(handler.http_stream_disabled_reloaded);
|
EXPECT_TRUE(handler.http_stream_disabled_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_stream {enabled on;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_stream {enabled on;}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -554,16 +554,16 @@ VOID TEST(ConfigReloadTest, ReloadHttpStreamUpdated)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"http_stream {enabled on; listen 8080;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"http_stream {enabled on; listen 8080;}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_stream {enabled on; listen 8080;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_stream {enabled on; listen 8080;}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_stream {enabled on; listen 8000;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_stream {enabled on; listen 8000;}"));
|
||||||
EXPECT_TRUE(handler.http_stream_updated_reloaded);
|
EXPECT_TRUE(handler.http_stream_updated_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"http_stream {enabled on; listen 8080;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"http_stream {enabled on; listen 8080;}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -575,16 +575,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostHttpUpdated)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost http.srs.com {http {enabled on;mount /hls;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost http.srs.com {http {enabled on;mount /hls;}}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost http.srs.com {http {enabled on;mount /hls;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost http.srs.com {http {enabled on;mount /hls;}}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost http.srs.com {http {enabled on;mount /hls1;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost http.srs.com {http {enabled on;mount /hls1;}}"));
|
||||||
EXPECT_TRUE(handler.vhost_http_updated_reloaded);
|
EXPECT_TRUE(handler.vhost_http_updated_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost http.srs.com {http {enabled on;mount /hls;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost http.srs.com {http {enabled on;mount /hls;}}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -596,16 +596,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostAdded)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{} vhost b{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{} vhost b{}"));
|
||||||
EXPECT_TRUE(handler.vhost_added_reloaded);
|
EXPECT_TRUE(handler.vhost_added_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -617,16 +617,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostRemoved)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{enabled off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{enabled off;}"));
|
||||||
EXPECT_TRUE(handler.vhost_removed_reloaded);
|
EXPECT_TRUE(handler.vhost_removed_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -638,16 +638,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostRemoved2)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{} vhost b{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{} vhost b{}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{} vhost b{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{} vhost b{}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_TRUE(handler.vhost_removed_reloaded);
|
EXPECT_TRUE(handler.vhost_removed_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{} vhost b{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{} vhost b{}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -659,16 +659,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostAtc)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{atc off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{atc off;}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{atc off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{atc off;}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{atc on;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{atc on;}"));
|
||||||
EXPECT_TRUE(handler.vhost_atc_reloaded);
|
EXPECT_TRUE(handler.vhost_atc_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{atc off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{atc off;}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -680,16 +680,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostGopCache)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{gop_cache off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{gop_cache off;}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{gop_cache off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{gop_cache off;}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{gop_cache on;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{gop_cache on;}"));
|
||||||
EXPECT_TRUE(handler.vhost_gop_cache_reloaded);
|
EXPECT_TRUE(handler.vhost_gop_cache_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{gop_cache off;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{gop_cache off;}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -701,16 +701,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostQueueLength)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{queue_length 10;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{queue_length 10;}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{queue_length 10;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{queue_length 10;}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{queue_length 20;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{queue_length 20;}"));
|
||||||
EXPECT_TRUE(handler.vhost_queue_length_reloaded);
|
EXPECT_TRUE(handler.vhost_queue_length_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{queue_length 10;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{queue_length 10;}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -722,16 +722,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostTimeJitter)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{time_jitter full;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{time_jitter full;}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{time_jitter full;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{time_jitter full;}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{time_jitter zero;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{time_jitter zero;}"));
|
||||||
EXPECT_TRUE(handler.vhost_time_jitter_reloaded);
|
EXPECT_TRUE(handler.vhost_time_jitter_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{time_jitter full;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{time_jitter full;}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -743,16 +743,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostForward)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{forward 127.0.0.1:1936;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{forward 127.0.0.1:1936;}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{forward 127.0.0.1:1936;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{forward 127.0.0.1:1936;}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{forward 127.0.0.1:1937;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{forward 127.0.0.1:1937;}"));
|
||||||
EXPECT_TRUE(handler.vhost_forward_reloaded);
|
EXPECT_TRUE(handler.vhost_forward_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{forward 127.0.0.1:1936;}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{forward 127.0.0.1:1936;}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -764,16 +764,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostHls)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{hls {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{hls {enabled on;}}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{hls {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{hls {enabled on;}}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{hls {enabled off;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{hls {enabled off;}}"));
|
||||||
EXPECT_TRUE(handler.vhost_hls_reloaded);
|
EXPECT_TRUE(handler.vhost_hls_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{hls {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{hls {enabled on;}}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -785,16 +785,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostDvr)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{dvr {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{dvr {enabled on;}}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{dvr {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{dvr {enabled on;}}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{dvr {enabled off;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{dvr {enabled off;}}"));
|
||||||
EXPECT_TRUE(handler.vhost_dvr_reloaded);
|
EXPECT_TRUE(handler.vhost_dvr_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{dvr {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{dvr {enabled on;}}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -806,16 +806,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostTranscode)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{transcode {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{transcode {enabled on;}}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{transcode {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{transcode {enabled on;}}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{transcode {enabled off;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{transcode {enabled off;}}"));
|
||||||
EXPECT_TRUE(handler.vhost_transcode_reloaded);
|
EXPECT_TRUE(handler.vhost_transcode_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{transcode {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{transcode {enabled on;}}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -827,16 +827,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostIngestAdded)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
||||||
EXPECT_TRUE(handler.ingest_added_reloaded);
|
EXPECT_TRUE(handler.ingest_added_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -848,16 +848,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostIngestAdded2)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{ingest a {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{ingest a {enabled on;}}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest a {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest a {enabled on;}}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest a {enabled on;} ingest b {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest a {enabled on;} ingest b {enabled on;}}"));
|
||||||
EXPECT_TRUE(handler.ingest_added_reloaded);
|
EXPECT_TRUE(handler.ingest_added_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest a {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest a {enabled on;}}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -869,16 +869,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostIngestRemoved)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{}"));
|
||||||
EXPECT_TRUE(handler.ingest_removed_reloaded);
|
EXPECT_TRUE(handler.ingest_removed_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -890,16 +890,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostIngestRemoved2)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest {enabled off;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest {enabled off;}}"));
|
||||||
EXPECT_TRUE(handler.ingest_removed_reloaded);
|
EXPECT_TRUE(handler.ingest_removed_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest {enabled on;}}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
@ -911,16 +911,16 @@ VOID TEST(ConfigReloadTest, ReloadVhostIngestUpdated)
|
||||||
|
|
||||||
conf.subscribe(&handler);
|
conf.subscribe(&handler);
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{ingest {enabled on;ffmpeg ffmpeg;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost a{ingest {enabled on;ffmpeg ffmpeg;}}"));
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest {enabled on;ffmpeg ffmpeg;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest {enabled on;ffmpeg ffmpeg;}}"));
|
||||||
EXPECT_TRUE(handler.all_false());
|
EXPECT_TRUE(handler.all_false());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest {enabled on;ffmpeg ffmpeg1;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest {enabled on;ffmpeg ffmpeg1;}}"));
|
||||||
EXPECT_TRUE(handler.ingest_updated_reloaded);
|
EXPECT_TRUE(handler.ingest_updated_reloaded);
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
|
|
||||||
EXPECT_TRUE(ERROR_SUCCESS == conf.reload(_MIN_OK_CONF"vhost a{ingest {enabled on;ffmpeg ffmpeg;}}"));
|
EXPECT_TRUE(ERROR_SUCCESS == conf.do_reload(_MIN_OK_CONF"vhost a{ingest {enabled on;ffmpeg ffmpeg;}}"));
|
||||||
EXPECT_EQ(1, handler.count_true());
|
EXPECT_EQ(1, handler.count_true());
|
||||||
handler.reset();
|
handler.reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ public:
|
||||||
MockSrsReloadConfig();
|
MockSrsReloadConfig();
|
||||||
virtual ~MockSrsReloadConfig();
|
virtual ~MockSrsReloadConfig();
|
||||||
public:
|
public:
|
||||||
virtual int reload(std::string buf);
|
virtual int do_reload(std::string buf);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue