mirror of
https://github.com/ossrs/srs.git
synced 2025-02-12 11:21:52 +00:00
For #1651, fix return pnwrite of srs_write_large_iovs. 3.0.135
This commit is contained in:
parent
355f351435
commit
f89b4b3b26
4 changed files with 66 additions and 4 deletions
|
@ -146,6 +146,7 @@ For previous versions, please read:
|
|||
|
||||
## V3 changes
|
||||
|
||||
* 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>
|
||||
* 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
|
||||
|
@ -1676,6 +1677,7 @@ Winlin
|
|||
[bug #1594]: https://github.com/ossrs/srs/issues/1594
|
||||
[bug #1630]: https://github.com/ossrs/srs/issues/1630
|
||||
[bug #1635]: https://github.com/ossrs/srs/issues/1635
|
||||
[bug #1651]: https://github.com/ossrs/srs/issues/1651
|
||||
[bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy
|
||||
|
||||
[exo #828]: https://github.com/google/ExoPlayer/pull/828
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
#ifndef SRS_CORE_VERSION3_HPP
|
||||
#define SRS_CORE_VERSION3_HPP
|
||||
|
||||
#define SRS_VERSION3_REVISION 134
|
||||
#define SRS_VERSION3_REVISION 135
|
||||
|
||||
#endif
|
||||
|
|
|
@ -336,7 +336,7 @@ srs_error_t srs_write_large_iovs(ISrsProtocolReadWriter* skt, iovec* iovs, int s
|
|||
#endif
|
||||
|
||||
// send in a time.
|
||||
if (size < limits) {
|
||||
if (size <= limits) {
|
||||
if ((err = skt->writev(iovs, size, pnwrite)) != srs_success) {
|
||||
return srs_error_wrap(err, "writev");
|
||||
}
|
||||
|
|
|
@ -230,8 +230,6 @@ srs_error_t MockBufferIO::writev(const iovec *iov, int iov_size, ssize_t* nwrite
|
|||
total += writen;
|
||||
}
|
||||
|
||||
sbytes += total;
|
||||
|
||||
if (nwrite) {
|
||||
*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…
Reference in a new issue