| 237 | } |
| 238 | |
| 239 | bool bindSocket(SRTSOCKET bindsock, std::string ip, int port, bool expect_success) |
| 240 | { |
| 241 | sockaddr_any sa = srt::CreateAddr(ip, port, AF_INET); |
| 242 | |
| 243 | std::string fam = (sa.family() == AF_INET) ? "IPv4" : "IPv6"; |
| 244 | |
| 245 | std::cout << "[T/S] Bind @" << bindsock << " to: " << sa.str() << " (" << fam << ")" << std::endl; |
| 246 | |
| 247 | int bind_res = srt_bind(bindsock, sa.get(), sa.size()); |
| 248 | |
| 249 | std::cout << "[T/S] ... result " << bind_res << " (expected to " |
| 250 | << (expect_success ? "succeed" : "fail") << ")\n"; |
| 251 | |
| 252 | if (!expect_success) |
| 253 | { |
| 254 | std::cout << "[T/S] Binding should fail: " << srt_getlasterror_str() << std::endl; |
| 255 | EXPECT_EQ(bind_res, SRT_ERROR); |
| 256 | return false; |
| 257 | } |
| 258 | |
| 259 | EXPECT_NE(bind_res, SRT_ERROR); |
| 260 | return true; |
| 261 | } |
| 262 | |
| 263 | bool bindListener(SRTSOCKET bindsock, std::string ip, int port, bool expect_success) |
| 264 | { |
nothing calls this directly
no test coverage detected