mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
集群模式,溯源重试改成最大3次: #1663
This commit is contained in:
parent
0c5b3f87e5
commit
a11289e5f0
@ -171,6 +171,8 @@ origin_url=
|
|||||||
#溯源总超时时长,单位秒,float型;假如源站有3个,那么单次溯源超时时间为timeout_sec除以3
|
#溯源总超时时长,单位秒,float型;假如源站有3个,那么单次溯源超时时间为timeout_sec除以3
|
||||||
#单次溯源超时时间不要超过general.maxStreamWaitMS配置
|
#单次溯源超时时间不要超过general.maxStreamWaitMS配置
|
||||||
timeout_sec=15
|
timeout_sec=15
|
||||||
|
#溯源失败尝试次数,-1时永久尝试
|
||||||
|
retry_count=3
|
||||||
|
|
||||||
[http]
|
[http]
|
||||||
#http服务器字符编码,windows上默认gb2312
|
#http服务器字符编码,windows上默认gb2312
|
||||||
|
@ -75,10 +75,12 @@ namespace Cluster {
|
|||||||
#define CLUSTER_FIELD "cluster."
|
#define CLUSTER_FIELD "cluster."
|
||||||
const string kOriginUrl = CLUSTER_FIELD "origin_url";
|
const string kOriginUrl = CLUSTER_FIELD "origin_url";
|
||||||
const string kTimeoutSec = CLUSTER_FIELD "timeout_sec";
|
const string kTimeoutSec = CLUSTER_FIELD "timeout_sec";
|
||||||
|
const string kRetryCount = CLUSTER_FIELD "retry_count";
|
||||||
|
|
||||||
static onceToken token([]() {
|
static onceToken token([]() {
|
||||||
mINI::Instance()[kOriginUrl] = "";
|
mINI::Instance()[kOriginUrl] = "";
|
||||||
mINI::Instance()[kTimeoutSec] = 15;
|
mINI::Instance()[kTimeoutSec] = 15;
|
||||||
|
mINI::Instance()[kTimeoutSec] = 3;
|
||||||
});
|
});
|
||||||
|
|
||||||
}//namespace Cluster
|
}//namespace Cluster
|
||||||
@ -240,6 +242,8 @@ static void pullStreamFromOrigin(const vector<string>& urls, size_t index, size_
|
|||||||
const function<void()> &closePlayer) {
|
const function<void()> &closePlayer) {
|
||||||
|
|
||||||
GET_CONFIG(float, cluster_timeout_sec, Cluster::kTimeoutSec);
|
GET_CONFIG(float, cluster_timeout_sec, Cluster::kTimeoutSec);
|
||||||
|
GET_CONFIG(int, retry_count, Cluster::kRetryCount);
|
||||||
|
|
||||||
auto url = getPullUrl(urls[index % urls.size()], args);
|
auto url = getPullUrl(urls[index % urls.size()], args);
|
||||||
auto timeout_sec = cluster_timeout_sec / urls.size();
|
auto timeout_sec = cluster_timeout_sec / urls.size();
|
||||||
InfoL << "pull stream from origin, failed_cnt: " << failed_cnt << ", timeout_sec: " << timeout_sec << ", url: " << url;
|
InfoL << "pull stream from origin, failed_cnt: " << failed_cnt << ", timeout_sec: " << timeout_sec << ", url: " << url;
|
||||||
@ -248,7 +252,7 @@ static void pullStreamFromOrigin(const vector<string>& urls, size_t index, size_
|
|||||||
option.enable_hls = option.enable_hls || (args._schema == HLS_SCHEMA);
|
option.enable_hls = option.enable_hls || (args._schema == HLS_SCHEMA);
|
||||||
option.enable_mp4 = false;
|
option.enable_mp4 = false;
|
||||||
|
|
||||||
addStreamProxy(args._vhost, args._app, args._streamid, url, -1, option, Rtsp::RTP_TCP, timeout_sec,
|
addStreamProxy(args._vhost, args._app, args._streamid, url, retry_count, option, Rtsp::RTP_TCP, timeout_sec,
|
||||||
[=](const SockException &ex, const string &key) mutable {
|
[=](const SockException &ex, const string &key) mutable {
|
||||||
if (!ex) {
|
if (!ex) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user