Skip to content

Commit

Permalink
[tests] Minor fix for Bonding.CloseGroupAndSocket (#2406).
Browse files Browse the repository at this point in the history
Do not process write[] and read[] on epoll error.
  • Loading branch information
maxsharabayko authored Jul 13, 2022
1 parent ced76c7 commit 0153f69
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions test/test_bonding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TEST(Bonding, SRTConnectGroup)
}, ss);

std::cout << "srt_connect_group calling " << std::endl;
const int st = srt_connect_group(ss, targets.data(), targets.size());
const int st = srt_connect_group(ss, targets.data(), (int) targets.size());
std::cout << "srt_connect_group returned " << st << std::endl;

closing_promise.wait();
Expand Down Expand Up @@ -264,22 +264,25 @@ TEST(Bonding, CloseGroupAndSocket)
}
std::cout << "Returned from connecting two sockets " << std::endl;

const int default_len = 3;
int rlen = default_len;
SRTSOCKET read[default_len];

int wlen = default_len;
SRTSOCKET write[default_len];

for (int j = 0; j < 2; ++j)
{
const int default_len = 3;
int rlen = default_len;
SRTSOCKET read[default_len];

int wlen = default_len;
SRTSOCKET write[default_len];

const int epoll_res = srt_epoll_wait(poll_id, read, &rlen,
write, &wlen,
5000, /* timeout */
0, 0, 0, 0);

std::cout << "Epoll result: " << epoll_res << '\n';
std::cout << "Epoll rlen: " << rlen << ", wlen: " << wlen << '\n';
if (epoll_res < 0)
continue;

for (int i = 0; i < rlen; ++i)
{
std::cout << "Epoll read[" << i << "]: " << read[i] << '\n';
Expand Down

0 comments on commit 0153f69

Please sign in to comment.