winlin

refine the http request parse. edge retry timeout.

... ... @@ -144,6 +144,11 @@ void SrsEdgeRtmpUpstream::close()
sdk->close();
}
void SrsEdgeRtmpUpstream::set_recv_timeout(int64_t timeout)
{
sdk->set_recv_timeout(timeout);
}
void SrsEdgeRtmpUpstream::kbps_sample(const char* label, int64_t age)
{
sdk->kbps_sample(label, age);
... ... @@ -238,6 +243,9 @@ int SrsEdgeIngester::ingest()
SrsPithyPrint* pprint = SrsPithyPrint::create_edge();
SrsAutoFree(SrsPithyPrint, pprint);
// set to larger timeout to read av data from origin.
upstream->set_recv_timeout(SRS_EDGE_INGESTER_TIMEOUT_US);
while (!pthread->interrupted()) {
pprint->elapse();
... ... @@ -409,6 +417,7 @@ void SrsEdgeForwarder::stop()
}
#define SYS_MAX_EDGE_SEND_MSGS 128
int SrsEdgeForwarder::cycle()
{
int ret = ERROR_SUCCESS;
... ...
... ... @@ -89,6 +89,8 @@ public:
virtual int recv_message(SrsCommonMessage** pmsg) = 0;
virtual int decode_message(SrsCommonMessage* msg, SrsPacket** ppacket) = 0;
virtual void close() = 0;
public:
virtual void set_recv_timeout(int64_t timeout) = 0;
virtual void kbps_sample(const char* label, int64_t age) = 0;
};
... ... @@ -104,6 +106,8 @@ public:
virtual int recv_message(SrsCommonMessage** pmsg);
virtual int decode_message(SrsCommonMessage* msg, SrsPacket** ppacket);
virtual void close();
public:
virtual void set_recv_timeout(int64_t timeout);
virtual void kbps_sample(const char* label, int64_t age);
};
... ...
... ... @@ -830,6 +830,11 @@ SrsRequest* SrsHttpMessage::to_request(string vhost)
srs_discovery_tc_url(req->tcUrl, req->schema, req->host, req->vhost, req->app, req->port, req->param);
req->strip();
// reset the host to http request host.
if (req->host == SRS_CONSTS_RTMP_DEFAULT_VHOST) {
req->host = _uri->get_host();
}
return req;
}
... ...