Fix #1629, fix kickoff FLV client bug. 3.0.137

pull/1672/head
winlin 5 years ago
parent 850a4bbf20
commit 0dd6c31487

@ -146,6 +146,7 @@ For previous versions, please read:
## V3 changes
* v3.0, 2020-03-21, For [#1629][bug #1629], fix kickoff FLV client bug. 3.0.137
* v3.0, 2020-03-21, For [#1619][bug #1619], configure without utest by default. 3.0.136
* v3.0, 2020-03-21, For [#1651][bug #1651], fix return pnwrite of srs_write_large_iovs. 3.0.135
* <strong>v3.0, 2020-03-18, [3.0 beta3(3.0.134)][r3.0b3] released. 122509 lines.</strong>
@ -1680,6 +1681,7 @@ Winlin
[bug #1635]: https://github.com/ossrs/srs/issues/1635
[bug #1651]: https://github.com/ossrs/srs/issues/1651
[bug #1619]: https://github.com/ossrs/srs/issues/1619
[bug #1629]: https://github.com/ossrs/srs/issues/1629
[bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy
[exo #828]: https://github.com/google/ExoPlayer/pull/828

@ -203,13 +203,26 @@ srs_error_t SrsResponseOnlyHttpConn::pop_message(ISrsHttpMessage** preq)
return srs_error_wrap(err, "init socket");
}
if ((err = parser->parse_message(&skt, preq)) != srs_success) {
return srs_error_wrap(err, "parse message");
}
// Check user interrupt by interval.
skt.set_recv_timeout(3 * SRS_UTIME_SECONDS);
// drop all request body.
char body[4096];
while (true) {
if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "timeout");
}
if ((err = skt.read(body, 4096, NULL)) != srs_success) {
// Because we use timeout to check trd state, so we should ignore any timeout.
if (srs_error_code(err) == ERROR_SOCKET_TIMEOUT) {
srs_freep(err);
continue;
}
// Attach owner connection to message.
SrsHttpMessage* hreq = (SrsHttpMessage*)(*preq);
hreq->set_connection(this);
return srs_error_wrap(err, "read response");
}
}
return err;
}
@ -236,6 +249,11 @@ srs_error_t SrsResponseOnlyHttpConn::on_got_http_message(ISrsHttpMessage* msg)
return err;
}
void SrsResponseOnlyHttpConn::expire()
{
SrsHttpConn::expire();
}
SrsHttpServer::SrsHttpServer(SrsServer* svr)
{
server = svr;

@ -101,6 +101,9 @@ public:
virtual srs_error_t pop_message(ISrsHttpMessage** preq);
public:
virtual srs_error_t on_got_http_message(ISrsHttpMessage* msg);
public:
// Set connection to expired.
virtual void expire();
};
// The http server, use http stream or static server to serve requests.

@ -593,9 +593,14 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
SrsMessageArray msgs(SRS_PERF_MW_MSGS);
// Use receive thread to accept the close event to avoid FD leak.
// @see https://github.com/ossrs/srs/issues/636#issuecomment-298208427
SrsHttpMessage* hr = dynamic_cast<SrsHttpMessage*>(r);
SrsResponseOnlyHttpConn* hc = dynamic_cast<SrsResponseOnlyHttpConn*>(hr->connection());
// update the statistic when source disconveried.
SrsStatistic* stat = SrsStatistic::instance();
if ((err = stat->on_client(_srs_context->get_id(), req, NULL, SrsRtmpConnPlay)) != srs_success) {
if ((err = stat->on_client(_srs_context->get_id(), req, hc, SrsRtmpConnPlay)) != srs_success) {
return srs_error_wrap(err, "stat on client");
}
@ -614,11 +619,6 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
SrsFlvStreamEncoder* ffe = dynamic_cast<SrsFlvStreamEncoder*>(enc);
// Use receive thread to accept the close event to avoid FD leak.
// @see https://github.com/ossrs/srs/issues/636#issuecomment-298208427
SrsHttpMessage* hr = dynamic_cast<SrsHttpMessage*>(r);
SrsResponseOnlyHttpConn* hc = dynamic_cast<SrsResponseOnlyHttpConn*>(hr->connection());
// Set the socket options for transport.
bool tcp_nodelay = _srs_config->get_tcp_nodelay(req->vhost);
if (tcp_nodelay) {

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION3_HPP
#define SRS_CORE_VERSION3_HPP
#define SRS_VERSION3_REVISION 136
#define SRS_VERSION3_REVISION 137
#endif

Loading…
Cancel
Save