MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / resolveAddress

Method resolveAddress

src/OpenLoco/src/Network/Socket.cpp:322–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320
321 public:
322 static void resolveAddress(
323 Protocol protocol, const std::string& address, uint16_t port, sockaddr_storage* ss, socklen_t* ss_len)
324 {
325 std::string error;
326 if (protocol == Protocol::any)
327 {
328 // Prioritise resolving IPv4 addresses
329 if (tryResolveAddress(Protocol::ipv4, address, port, ss, ss_len, error))
330 {
331 return;
332 }
333 if (tryResolveAddress(Protocol::ipv6, address, port, ss, ss_len, error))
334 {
335 return;
336 }
337 }
338 else
339 {
340 if (tryResolveAddress(protocol, address, port, ss, ss_len, error))
341 {
342 return;
343 }
344 }
345 throw SocketException(error);
346 }
347
348 private:
349 static bool tryResolveAddress(Protocol protocol, const std::string& address, uint16_t port, sockaddr_storage* ss, socklen_t* ss_len, std::string& outError)

Callers

nothing calls this directly

Calls 1

SocketExceptionClass · 0.85

Tested by

no test coverage detected