You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/05/11 08:29:14 UTC
[GitHub] [incubator-kvrocks] git-hulk commented on a diff in pull request #554: Support to listen on ipv6 address
git-hulk commented on code in PR #554:
URL: https://github.com/apache/incubator-kvrocks/pull/554#discussion_r870018593
##########
src/worker.cc:
##########
@@ -153,27 +158,42 @@ void Worker::newUnixSocketConnection(evconnlistener *listener, evutil_socket_t f
}
}
-Status Worker::listenTCP(const std::string &host, int port, int backlog) {
- sockaddr_in sin{};
- sin.sin_family = AF_INET;
- evutil_inet_pton(AF_INET, host.data(), &(sin.sin_addr));
- sin.sin_port = htons(port);
- int fd = socket(AF_INET, SOCK_STREAM, 0);
- int sock_opt = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &sock_opt, sizeof(sock_opt)) < 0) {
- return Status(Status::NotOK, evutil_socket_error_to_string(EVUTIL_SOCKET_ERROR()));
- }
- // to support multi-thread binding on macOS
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &sock_opt, sizeof(sock_opt)) < 0) {
- return Status(Status::NotOK, evutil_socket_error_to_string(EVUTIL_SOCKET_ERROR()));
+Status Worker::listenTCP(const std::string &host, int port, int af, int backlog) {
Review Comment:
you mean move the host check inside listenTCP? If yes, I'm ok to do that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@kvrocks.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org