mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge branch '3.0release' into 4.0release
This commit is contained in:
commit
be746da21c
9 changed files with 118 additions and 27 deletions
|
@ -5,13 +5,13 @@ jobs:
|
||||||
- image: ossrs/srs:dev
|
- image: ossrs/srs:dev
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: cd trunk && ./configure && make
|
- run: cd trunk && ./configure --with-utest && make
|
||||||
test:
|
test:
|
||||||
docker:
|
docker:
|
||||||
- image: ossrs/srs:dev
|
- image: ossrs/srs:dev
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: cd trunk && ./configure --gcov && make && ./objs/srs_utest && bash auto/coverage.sh
|
- run: cd trunk && ./configure --with-utest --gcov && make && ./objs/srs_utest && bash auto/coverage.sh
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_and_test:
|
build_and_test:
|
||||||
|
|
|
@ -169,6 +169,9 @@ For previous versions, please read:
|
||||||
|
|
||||||
## V3 changes
|
## 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>
|
* <strong>v3.0, 2020-03-18, [3.0 beta3(3.0.134)][r3.0b3] released. 122509 lines.</strong>
|
||||||
* v3.0, 2020-03-12, For [#1635][bug #1635], inotify watch ConfigMap for reload. 3.0.134
|
* v3.0, 2020-03-12, For [#1635][bug #1635], inotify watch ConfigMap for reload. 3.0.134
|
||||||
* v3.0, 2020-03-12, For [#1635][bug #1635], support auto reaload config by inotify. 3.0.129
|
* v3.0, 2020-03-12, For [#1635][bug #1635], support auto reaload config by inotify. 3.0.129
|
||||||
|
@ -1710,6 +1713,9 @@ Winlin
|
||||||
[bug #1594]: https://github.com/ossrs/srs/issues/1594
|
[bug #1594]: https://github.com/ossrs/srs/issues/1594
|
||||||
[bug #1630]: https://github.com/ossrs/srs/issues/1630
|
[bug #1630]: https://github.com/ossrs/srs/issues/1630
|
||||||
[bug #1635]: https://github.com/ossrs/srs/issues/1635
|
[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
|
[bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy
|
||||||
|
|
||||||
[bug #1631]: https://github.com/ossrs/srs/issues/1631
|
[bug #1631]: https://github.com/ossrs/srs/issues/1631
|
||||||
|
|
|
@ -21,7 +21,7 @@ SRS_NGINX=NO
|
||||||
SRS_FFMPEG_TOOL=NO
|
SRS_FFMPEG_TOOL=NO
|
||||||
SRS_LIBRTMP=NO
|
SRS_LIBRTMP=NO
|
||||||
SRS_RESEARCH=NO
|
SRS_RESEARCH=NO
|
||||||
SRS_UTEST=YES
|
SRS_UTEST=NO
|
||||||
SRS_GPERF=NO # Performance test: tcmalloc
|
SRS_GPERF=NO # Performance test: tcmalloc
|
||||||
SRS_GPERF_MC=NO # Performance test: gperf memory check
|
SRS_GPERF_MC=NO # Performance test: gperf memory check
|
||||||
SRS_GPERF_MD=NO # Performance test: gperf memory defence
|
SRS_GPERF_MD=NO # Performance test: gperf memory defence
|
||||||
|
@ -397,7 +397,7 @@ function apply_user_presets() {
|
||||||
SRS_HDS=YES
|
SRS_HDS=YES
|
||||||
SRS_LIBRTMP=YES
|
SRS_LIBRTMP=YES
|
||||||
SRS_RESEARCH=NO
|
SRS_RESEARCH=NO
|
||||||
SRS_UTEST=YES
|
SRS_UTEST=NO
|
||||||
SRS_STATIC=NO
|
SRS_STATIC=NO
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ function apply_user_presets() {
|
||||||
SRS_HDS=YES
|
SRS_HDS=YES
|
||||||
SRS_LIBRTMP=YES
|
SRS_LIBRTMP=YES
|
||||||
SRS_RESEARCH=NO
|
SRS_RESEARCH=NO
|
||||||
SRS_UTEST=YES
|
SRS_UTEST=NO
|
||||||
SRS_STATIC=NO
|
SRS_STATIC=NO
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -198,19 +198,32 @@ srs_error_t SrsResponseOnlyHttpConn::pop_message(ISrsHttpMessage** preq)
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
SrsStSocket skt;
|
SrsStSocket skt;
|
||||||
|
|
||||||
if ((err = skt.initialize(stfd)) != srs_success) {
|
if ((err = skt.initialize(stfd)) != srs_success) {
|
||||||
return srs_error_wrap(err, "init socket");
|
return srs_error_wrap(err, "init socket");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = parser->parse_message(&skt, preq)) != srs_success) {
|
// Check user interrupt by interval.
|
||||||
return srs_error_wrap(err, "parse message");
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return srs_error_wrap(err, "read response");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach owner connection to message.
|
|
||||||
SrsHttpMessage* hreq = (SrsHttpMessage*)(*preq);
|
|
||||||
hreq->set_connection(this);
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,12 +232,12 @@ srs_error_t SrsResponseOnlyHttpConn::on_got_http_message(ISrsHttpMessage* msg)
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
ISrsHttpResponseReader* br = msg->body_reader();
|
ISrsHttpResponseReader* br = msg->body_reader();
|
||||||
|
|
||||||
// when not specified the content length, ignore.
|
// when not specified the content length, ignore.
|
||||||
if (msg->content_length() == -1) {
|
if (msg->content_length() == -1) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop all request body.
|
// drop all request body.
|
||||||
char body[4096];
|
char body[4096];
|
||||||
while (!br->eof()) {
|
while (!br->eof()) {
|
||||||
|
@ -236,6 +249,11 @@ srs_error_t SrsResponseOnlyHttpConn::on_got_http_message(ISrsHttpMessage* msg)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SrsResponseOnlyHttpConn::expire()
|
||||||
|
{
|
||||||
|
SrsHttpConn::expire();
|
||||||
|
}
|
||||||
|
|
||||||
SrsHttpServer::SrsHttpServer(SrsServer* svr)
|
SrsHttpServer::SrsHttpServer(SrsServer* svr)
|
||||||
{
|
{
|
||||||
server = svr;
|
server = svr;
|
||||||
|
|
|
@ -101,6 +101,9 @@ public:
|
||||||
virtual srs_error_t pop_message(ISrsHttpMessage** preq);
|
virtual srs_error_t pop_message(ISrsHttpMessage** preq);
|
||||||
public:
|
public:
|
||||||
virtual srs_error_t on_got_http_message(ISrsHttpMessage* msg);
|
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.
|
// The http server, use http stream or static server to serve requests.
|
||||||
|
|
|
@ -592,10 +592,15 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
|
||||||
SrsAutoFree(SrsPithyPrint, pprint);
|
SrsAutoFree(SrsPithyPrint, pprint);
|
||||||
|
|
||||||
SrsMessageArray msgs(SRS_PERF_MW_MSGS);
|
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.
|
// update the statistic when source disconveried.
|
||||||
SrsStatistic* stat = SrsStatistic::instance();
|
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");
|
return srs_error_wrap(err, "stat on client");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,11 +618,6 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsFlvStreamEncoder* ffe = dynamic_cast<SrsFlvStreamEncoder*>(enc);
|
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.
|
// Set the socket options for transport.
|
||||||
bool tcp_nodelay = _srs_config->get_tcp_nodelay(req->vhost);
|
bool tcp_nodelay = _srs_config->get_tcp_nodelay(req->vhost);
|
||||||
|
|
|
@ -24,6 +24,6 @@
|
||||||
#ifndef SRS_CORE_VERSION3_HPP
|
#ifndef SRS_CORE_VERSION3_HPP
|
||||||
#define SRS_CORE_VERSION3_HPP
|
#define SRS_CORE_VERSION3_HPP
|
||||||
|
|
||||||
#define SRS_VERSION3_REVISION 134
|
#define SRS_VERSION3_REVISION 137
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -336,21 +336,25 @@ srs_error_t srs_write_large_iovs(ISrsProtocolReadWriter* skt, iovec* iovs, int s
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// send in a time.
|
// send in a time.
|
||||||
if (size < limits) {
|
if (size <= limits) {
|
||||||
if ((err = skt->writev(iovs, size, pnwrite)) != srs_success) {
|
if ((err = skt->writev(iovs, size, pnwrite)) != srs_success) {
|
||||||
return srs_error_wrap(err, "writev");
|
return srs_error_wrap(err, "writev");
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// send in multiple times.
|
// send in multiple times.
|
||||||
int cur_iov = 0;
|
int cur_iov = 0;
|
||||||
|
ssize_t nwrite = 0;
|
||||||
while (cur_iov < size) {
|
while (cur_iov < size) {
|
||||||
int cur_count = srs_min(limits, size - cur_iov);
|
int cur_count = srs_min(limits, size - cur_iov);
|
||||||
if ((err = skt->writev(iovs + cur_iov, cur_count, pnwrite)) != srs_success) {
|
if ((err = skt->writev(iovs + cur_iov, cur_count, &nwrite)) != srs_success) {
|
||||||
return srs_error_wrap(err, "writev");
|
return srs_error_wrap(err, "writev");
|
||||||
}
|
}
|
||||||
cur_iov += cur_count;
|
cur_iov += cur_count;
|
||||||
|
if (pnwrite) {
|
||||||
|
*pnwrite += nwrite;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -230,8 +230,6 @@ srs_error_t MockBufferIO::writev(const iovec *iov, int iov_size, ssize_t* nwrite
|
||||||
total += writen;
|
total += writen;
|
||||||
}
|
}
|
||||||
|
|
||||||
sbytes += total;
|
|
||||||
|
|
||||||
if (nwrite) {
|
if (nwrite) {
|
||||||
*nwrite = total;
|
*nwrite = total;
|
||||||
}
|
}
|
||||||
|
@ -6412,3 +6410,65 @@ VOID TEST(ProtocolKbpsTest, RAWStatistic)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID TEST(ProtocolKbpsTest, WriteLargeIOVs)
|
||||||
|
{
|
||||||
|
srs_error_t err;
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
iovec iovs[1];
|
||||||
|
iovs[0].iov_base = (char*)"Hello";
|
||||||
|
iovs[0].iov_len = 5;
|
||||||
|
|
||||||
|
MockBufferIO io;
|
||||||
|
ssize_t nn = 0;
|
||||||
|
HELPER_EXPECT_SUCCESS(srs_write_large_iovs(&io, iovs, 1, &nn));
|
||||||
|
EXPECT_EQ(5, nn);
|
||||||
|
EXPECT_EQ(5, io.sbytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
iovec iovs[1024];
|
||||||
|
int nn_iovs = (int)(sizeof(iovs)/sizeof(iovec));
|
||||||
|
for (int i = 0; i < nn_iovs; i++) {
|
||||||
|
iovs[i].iov_base = (char*)"Hello";
|
||||||
|
iovs[i].iov_len = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
MockBufferIO io;
|
||||||
|
ssize_t nn = 0;
|
||||||
|
HELPER_EXPECT_SUCCESS(srs_write_large_iovs(&io, iovs, nn_iovs, &nn));
|
||||||
|
EXPECT_EQ(5 * nn_iovs, nn);
|
||||||
|
EXPECT_EQ(5 * nn_iovs, io.sbytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
iovec iovs[1025];
|
||||||
|
int nn_iovs = (int)(sizeof(iovs)/sizeof(iovec));
|
||||||
|
for (int i = 0; i < nn_iovs; i++) {
|
||||||
|
iovs[i].iov_base = (char*)"Hello";
|
||||||
|
iovs[i].iov_len = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
MockBufferIO io;
|
||||||
|
ssize_t nn = 0;
|
||||||
|
HELPER_EXPECT_SUCCESS(srs_write_large_iovs(&io, iovs, nn_iovs, &nn));
|
||||||
|
EXPECT_EQ(5 * nn_iovs, nn);
|
||||||
|
EXPECT_EQ(5 * nn_iovs, io.sbytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
iovec iovs[4096];
|
||||||
|
int nn_iovs = (int)(sizeof(iovs)/sizeof(iovec));
|
||||||
|
for (int i = 0; i < nn_iovs; i++) {
|
||||||
|
iovs[i].iov_base = (char*)"Hello";
|
||||||
|
iovs[i].iov_len = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
MockBufferIO io;
|
||||||
|
ssize_t nn = 0;
|
||||||
|
HELPER_EXPECT_SUCCESS(srs_write_large_iovs(&io, iovs, nn_iovs, &nn));
|
||||||
|
EXPECT_EQ(5 * nn_iovs, nn);
|
||||||
|
EXPECT_EQ(5 * nn_iovs, io.sbytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue