Skip to content
Open
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mooncake-transfer-engine/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <sys/mman.h>
#include <sys/time.h>
#include <unistd.h>
#include <arpa/inet.h>

#include <atomic>
#include <cstdint>
Expand Down Expand Up @@ -117,6 +118,12 @@ uint16_t getDefaultHandshakePort();
static inline std::pair<std::string, uint16_t> parseHostNameWithPort(
const std::string &server_name) {
uint16_t port = getDefaultHandshakePort();

// IPv6 check
in6_addr addr;
if (inet_pton(AF_INET6, server_name.c_str(), &addr) == 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it do not support ipv6 + port, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We add code to support ipv6 + port

return {server_name, port};

auto pos = server_name.find(':');
if (pos == server_name.npos) return std::make_pair(server_name, port);
auto trimmed_server_name = server_name.substr(0, pos);
Expand Down
Loading