szaszm commented on a change in pull request #713: MINIFICPP-1119 unify
win/posix sockets + clean up issues
URL: https://github.com/apache/nifi-minifi-cpp/pull/713#discussion_r376017118
##########
File path: libminifi/src/io/ClientSocket.cpp
##########
@@ -118,29 +127,26 @@ void Socket::setNonBlocking() {
nonBlocking_ = true;
}
}
-#ifdef WIN32
-int8_t Socket::createConnection(const addrinfo *p, struct in_addr &addr) {
-#else
-int8_t Socket::createConnection(const addrinfo *p, in_addr_t &addr) {
-#endif
+
+int8_t Socket::createConnection(const addrinfo *p, ip4addr &addr) {
if ((socket_file_descriptor_ = socket(p->ai_family, p->ai_socktype,
p->ai_protocol)) == INVALID_SOCKET) {
Review comment:
reference on the correctness of checking for `INVALID_SOCKET`/`-1`:
windows:
https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket#return-value
posix:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html#tag_16_562_04
We define `INVALID_SOCKET` to `-1` on posix near the top of `ClientSocket.h`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services