mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 11:51:57 +00:00
SRT: refine int to srs_utime_t in srt timeout config
This commit is contained in:
parent
26498a00fe
commit
dd8ccfe5d8
3 changed files with 10 additions and 10 deletions
|
@ -6880,8 +6880,8 @@ bool SrsConfig::get_srto_tlpktdrop() {
|
||||||
return SRS_CONF_PERFER_TRUE(conf->arg0());
|
return SRS_CONF_PERFER_TRUE(conf->arg0());
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsConfig::get_srto_conntimeout() {
|
srs_utime_t SrsConfig::get_srto_conntimeout() {
|
||||||
static int DEFAULT = 3000;
|
static srs_utime_t DEFAULT = 3 * SRS_UTIME_SECONDS;
|
||||||
SrsConfDirective* conf = root->get("srt_server");
|
SrsConfDirective* conf = root->get("srt_server");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
|
@ -6891,11 +6891,11 @@ int SrsConfig::get_srto_conntimeout() {
|
||||||
if (!conf || conf->arg0().empty()) {
|
if (!conf || conf->arg0().empty()) {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
}
|
}
|
||||||
return atoi(conf->arg0().c_str());
|
return (srs_utime_t)(::atoi(conf->arg0().c_str()) * SRS_UTIME_MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsConfig::get_srto_peeridletimeout() {
|
srs_utime_t SrsConfig::get_srto_peeridletimeout() {
|
||||||
static int DEFAULT = 10000;
|
static srs_utime_t DEFAULT = 10 * SRS_UTIME_SECONDS;
|
||||||
SrsConfDirective* conf = root->get("srt_server");
|
SrsConfDirective* conf = root->get("srt_server");
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
|
@ -6905,7 +6905,7 @@ int SrsConfig::get_srto_peeridletimeout() {
|
||||||
if (!conf || conf->arg0().empty()) {
|
if (!conf || conf->arg0().empty()) {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
}
|
}
|
||||||
return atoi(conf->arg0().c_str());
|
return (srs_utime_t)(::atoi(conf->arg0().c_str()) * SRS_UTIME_MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsConfig::get_srto_sendbuf() {
|
int SrsConfig::get_srto_sendbuf() {
|
||||||
|
|
|
@ -649,9 +649,9 @@ public:
|
||||||
// Get the srt SRTO_TLPKTDROP, Too-late Packet Drop, default is true.
|
// Get the srt SRTO_TLPKTDROP, Too-late Packet Drop, default is true.
|
||||||
virtual bool get_srto_tlpktdrop();
|
virtual bool get_srto_tlpktdrop();
|
||||||
// Get the srt SRTO_CONNTIMEO, connection timeout, default is 3000ms.
|
// Get the srt SRTO_CONNTIMEO, connection timeout, default is 3000ms.
|
||||||
virtual int get_srto_conntimeout();
|
virtual srs_utime_t get_srto_conntimeout();
|
||||||
// Get the srt SRTO_PEERIDLETIMEO, peer idle timeout, default is 10000ms.
|
// Get the srt SRTO_PEERIDLETIMEO, peer idle timeout, default is 10000ms.
|
||||||
virtual int get_srto_peeridletimeout();
|
virtual srs_utime_t get_srto_peeridletimeout();
|
||||||
// Get the srt SRTO_SNDBUF, send buffer, default is 8192 × (1500-28).
|
// Get the srt SRTO_SNDBUF, send buffer, default is 8192 × (1500-28).
|
||||||
virtual int get_srto_sendbuf();
|
virtual int get_srto_sendbuf();
|
||||||
// Get the srt SRTO_RCVBUF, recv buffer, default is 8192 × (1500-28).
|
// Get the srt SRTO_RCVBUF, recv buffer, default is 8192 × (1500-28).
|
||||||
|
|
|
@ -118,11 +118,11 @@ srs_error_t SrsSrtMessageAcceptor::set_srt_opt()
|
||||||
return srs_error_wrap(err, "set opt");
|
return srs_error_wrap(err, "set opt");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = srs_srt_set_connect_timeout(listener_->fd(), _srs_config->get_srto_conntimeout())) != srs_success) {
|
if ((err = srs_srt_set_connect_timeout(listener_->fd(), srsu2msi(_srs_config->get_srto_conntimeout()))) != srs_success) {
|
||||||
return srs_error_wrap(err, "set opt");
|
return srs_error_wrap(err, "set opt");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = srs_srt_set_peer_idle_timeout(listener_->fd(), _srs_config->get_srto_peeridletimeout())) != srs_success) {
|
if ((err = srs_srt_set_peer_idle_timeout(listener_->fd(), srsu2msi(_srs_config->get_srto_peeridletimeout()))) != srs_success) {
|
||||||
return srs_error_wrap(err, "set opt");
|
return srs_error_wrap(err, "set opt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue