MCPcopy Create free account
hub / github.com/apache/impala / ParseString

Method ParseString

be/src/kudu/util/net/net_util.cc:175–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175Status HostPort::ParseString(const string& str, uint16_t default_port) {
176 std::pair<string, string> p = strings::Split(str, strings::delimiter::Limit(":", 1));
177
178 // Strip any whitespace from the host.
179 StripWhiteSpace(&p.first);
180
181 // Parse the port.
182 uint32_t port;
183 if (p.second.empty() && strcount(str, ':') == 0) {
184 // No port specified.
185 port = default_port;
186 } else if (!SimpleAtoi(p.second, &port) ||
187 port > 65535) {
188 return Status::InvalidArgument("invalid port", str);
189 }
190
191 host_.swap(p.first);
192 port_ = port;
193 return Status::OK();
194}
195
196Status HostPort::ParseStringWithScheme(const string& str, uint16_t default_port) {
197 string str_copy(str);

Callers 13

StartMethod · 0.45
TEST_FFunction · 0.45
GetPeerAddressMethod · 0.45
StartMethod · 0.45
TESTFunction · 0.45
BindAndListenMethod · 0.45
ResolveAddressesMethod · 0.45
ParseAddressesMethod · 0.45
ParseCIDRStringMethod · 0.45
GetRandomPortFunction · 0.45
TESTFunction · 0.45
TEST_FFunction · 0.45

Calls 8

SplitFunction · 0.85
LimitFunction · 0.85
strcountFunction · 0.85
InvalidArgumentFunction · 0.85
OKFunction · 0.85
StripWhiteSpaceFunction · 0.50
emptyMethod · 0.45
swapMethod · 0.45

Tested by 7

StartMethod · 0.36
TEST_FFunction · 0.36
GetPeerAddressMethod · 0.36
TESTFunction · 0.36
BindAndListenMethod · 0.36
TESTFunction · 0.36
TEST_FFunction · 0.36