Commit 2e1abe73 authored by Greg Williams's avatar Greg Williams
Browse files

Disabled ENOTSOCK setting on BSD-like systems, since socket it hanging up...

Disabled ENOTSOCK setting on BSD-like systems, since socket it hanging up after writes to test server
parent df9aba29
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
@@ -236,22 +236,24 @@ int KineticSocket_Connect(const char* host, int port, bool blocking)
            continue;
        }

        // On BSD-like systems we can set SO_NOSIGPIPE on the socket to prevent it from sending a
        // PIPE signal and bringing down the whole application if the server closes the socket
        // forcibly
#if defined(SO_NOSIGPIPE) && !defined(__APPLE__)
        {
            int set = 1;
            int setsockopt_result = setsockopt(socket_fd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set));
            // Allow ENOTSOCK because it allows tests to use pipes instead of real sockets
            if (setsockopt_result != 0 && setsockopt_result != ENOTSOCK)
            {
                LOG("Failed to set SO_NOSIGPIPE on socket");
                close(socket_fd);
                continue;
            }
        }
#endif
// DISABLED FOR NOW, SINCE CLIENT CONNECTIONS ARE HANGING
//
//         // On BSD-like systems we can set SO_NOSIGPIPE on the socket to prevent it from sending a
//         // PIPE signal and bringing down the whole application if the server closes the socket
//         // forcibly
// #if defined(SO_NOSIGPIPE) && !defined(__APPLE__)
//         {
//             int set = 1;
//             int setsockopt_result = setsockopt(socket_fd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set));
//             // Allow ENOTSOCK because it allows tests to use pipes instead of real sockets
//             if (setsockopt_result != 0 && setsockopt_result != ENOTSOCK)
//             {
//                 LOG("Failed to set SO_NOSIGPIPE on socket");
//                 close(socket_fd);
//                 continue;
//             }
//         }
// #endif

        if (connect(socket_fd, ai->ai_addr, ai->ai_addrlen) == -1)
        {