1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Release v3.0-a2, 3.0.67

This commit is contained in:
winlin 2019-12-01 19:24:17 +08:00
parent 75fd041279
commit 5a3fd1e68a
8 changed files with 43 additions and 10 deletions

View file

@ -100,10 +100,13 @@ srs_error_t SrsEdgeRtmpUpstream::connect(SrsRequest* r, SrsLbRoundRobin* lb)
string _schema, _vhost, _app, _stream, _param, _host;
srs_discovery_tc_url(redirect, _schema, _host, _vhost, _app, _stream, _port, _param);
srs_warn("RTMP redirect %s:%d to %s:%d stream=%s", server.c_str(), port, _host.c_str(), _port, _stream.c_str());
server = _host;
port = _port;
}
// Remember the current selected server.
selected_ip = server;
selected_port = port;
// support vhost tranform for edge,
// @see https://github.com/ossrs/srs/issues/372
@ -144,6 +147,12 @@ void SrsEdgeRtmpUpstream::close()
srs_freep(sdk);
}
void SrsEdgeRtmpUpstream::selected(string& server, int& port)
{
server = selected_ip;
port = selected_port;
}
void SrsEdgeRtmpUpstream::set_recv_timeout(srs_utime_t tm)
{
sdk->set_recv_timeout(tm);
@ -272,6 +281,13 @@ srs_error_t SrsEdgeIngester::do_cycle()
// retry for rtmp 302 immediately.
if (srs_error_code(err) == ERROR_CONTROL_REDIRECT) {
int port;
string server;
upstream->selected(server, port);
string url = req->get_stream_url();
srs_warn("RTMP redirect %s from %s:%d to %s", url.c_str(), server.c_str(), port, redirect.c_str());
srs_error_reset(err);
continue;
}