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

Function GetPortRanges

library/cpp/testing/common/network.cpp:84–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82 }
83
84 TVector<std::pair<ui16, ui16>> GetPortRanges() {
85 TString givenRange = GetEnv("VALID_PORT_RANGE");
86 TVector<std::pair<ui16, ui16>> ranges;
87 if (givenRange.Contains(':')) {
88 auto res = StringSplitter(givenRange).Split(':').Limit(2).ToList<TString>();
89 ranges.emplace_back(FromString<ui16>(res.front()), FromString<ui16>(res.back()));
90 } else {
91 const ui16 firstValid = 1025;
92 const ui16 lastValid = Max<ui16>();
93
94 auto [firstEphemeral, lastEphemeral] = GetEphemeralRange();
95 const ui16 firstInvalid = Max(firstEphemeral, firstValid);
96 const ui16 lastInvalid = Min(lastEphemeral, lastValid);
97
98 if (firstInvalid > firstValid)
99 ranges.emplace_back(firstValid, firstInvalid - 1);
100 if (lastInvalid < lastValid)
101 ranges.emplace_back(lastInvalid + 1, lastValid);
102 }
103 return ranges;
104 }
105
106 class TPortManager {
107 static constexpr size_t Retries = 20;

Callers 1

InitFromEnvMethod · 0.85

Calls 11

StringSplitterFunction · 0.85
GetEphemeralRangeFunction · 0.85
GetEnvFunction · 0.50
MaxFunction · 0.50
MinFunction · 0.50
ContainsMethod · 0.45
LimitMethod · 0.45
SplitMethod · 0.45
emplace_backMethod · 0.45
frontMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected