MCPcopy Create free account
hub / github.com/catboost/catboost / IsFreePort

Function IsFreePort

library/cpp/testing/unittest/fat/test_port_manager.cpp:4–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <library/cpp/testing/unittest/tests_data.h>
3
4bool IsFreePort(ui16 port) {
5 TInet6StreamSocket sock;
6 TSockAddrInet6 addr("::", port);
7 Y_ENSURE(SetSockOpt(sock, SOL_SOCKET, SO_REUSEADDR, 1) == 0);
8 SetReuseAddressAndPort(sock);
9 if (sock.Bind(&addr) == 0) {
10 return true;
11 }
12 return false;
13}
14
15void get_port_ranges() {
16 for (int i = 1; i < 10; ++i) {

Callers 1

get_port_rangesFunction · 0.85

Calls 3

SetSockOptFunction · 0.85
SetReuseAddressAndPortFunction · 0.85
BindMethod · 0.45

Tested by

no test coverage detected