]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Windows: drop unused WIN32_pipe() implementation
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 8 Oct 2012 08:11:02 +0000 (02:11 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 8 Oct 2012 08:11:02 +0000 (02:11 -0600)
The WIN32_pipe() wrapper function is not necessary on MinGW where _pipe()
is available, and is unused on other Windows builds where helper IPC
layer has been written to use STREAM sockets instead of pipe()

compat/os/mswin.h
src/win32.cc
src/win32.h

index c23c4d9e3d5f67819fd0df6beea85bb58c4478eb..4cc1b0d0aa15a6643305c41cb5a8b938bedbcfa6 100644 (file)
@@ -107,7 +107,6 @@ SQUIDCEXTERN int WIN32_truncate(const char *pathname, off_t length);
 #define mkdir(p,F) mkdir((p))
 #endif
 #define pclose _pclose
-#define pipe WIN32_pipe
 #define popen _popen
 #define putenv _putenv
 #define setmode _setmode
@@ -652,6 +651,13 @@ int socket(int f, int t, int p)
 }
 #define socket(f,t,p) Squid::socket(f,t,p)
 
+inline int
+pipe(int pipefd[2])
+{
+    return _pipe(pipefd,4096,_O_BINARY);
+}
+using Squid::pipe;
+
 inline
 int WSAAsyncSelect(int s, HWND h, unsigned int w, long e)
 {
index 4ee568e76b59aabf4132df6733190c27d1c25a3f..1fe62cf779082387e9e9554a476a18df600518c8 100644 (file)
@@ -48,68 +48,6 @@ SQUIDCEXTERN LPCRITICAL_SECTION dbg_mutex;
 void WIN32_ExceptionHandlerCleanup(void);
 static LPTOP_LEVEL_EXCEPTION_FILTER Win32_Old_ExceptionHandler = NULL;
 
-int WIN32_pipe(int handles[2])
-{
-    int new_socket;
-    fde *F = NULL;
-
-    Ip::Address localhost;
-    Ip::Address handle0;
-    Ip::Address handle1;
-    struct addrinfo *AI = NULL;
-
-    localhost.SetLocalhost();
-
-    /* INET6: back-compatible: localhost pipes default to IPv4 unless set otherwise.
-     *        it is blocked by untested helpers on many admins configs
-     *        if this proves to be wrong it can die easily.
-     */
-    localhost.SetIPv4();
-
-    handles[0] = handles[1] = -1;
-
-    ++statCounter.syscalls.sock.sockets;
-
-    handle0 = localhost;
-    handle0.SetPort(0);
-    handle0.GetAddrInfo(AI);
-
-    if ((new_socket = socket(AI->ai_family, AI->ai_socktype, AI->ai_protocol)) < 0)
-        return -1;
-
-    if (bind(new_socket, AI->ai_addr, AI->ai_addrlen) < 0 ||
-            listen(new_socket, 1) < 0 || getsockname(new_socket, AI->ai_addr, &(AI->ai_addrlen) ) < 0 ||
-            (handles[1] = socket(AI->ai_family, AI->ai_socktype, 0)) < 0) {
-        closesocket(new_socket);
-        return -1;
-    }
-
-    handle0 = *AI; // retrieve the new details returned by connect()
-
-    handle1.SetPort(handle1.GetPort());
-    handle1.GetAddrInfo(AI);
-
-    if (connect(handles[1], AI->ai_addr, AI->ai_addrlen) < 0 ||
-            (handles[0] = accept(new_socket, AI->ai_addr, &(AI->ai_addrlen)) ) < 0) {
-        closesocket(handles[1]);
-        handles[1] = -1;
-        closesocket(new_socket);
-        return -1;
-    }
-
-    closesocket(new_socket);
-
-    F = &fd_table[handles[0]];
-    F->local_addr = handle0;
-
-    F = &fd_table[handles[1]];
-    F->local_addr = localhost;
-    handle1.NtoA(F->ipaddr, MAX_IPSTRLEN);
-    F->remote_port = handle1.GetPort();
-
-    return 0;
-}
-
 int
 Win32__WSAFDIsSet(int fd, fd_set FAR * set)
 {
@@ -162,4 +100,4 @@ void WIN32_ExceptionHandlerCleanup()
         SetUnhandledExceptionFilter(Win32_Old_ExceptionHandler);
 }
 
-#endif /* SQUID_MSWIN_ */
+#endif /* SQUID_WINDOWS_ */
index 292fb891e067fba8fba84d6ed12a531995286b9b..d222c21882460f7e98f91be8444e92582e22fe44 100644 (file)
@@ -48,8 +48,6 @@
 #include <sys/types.h>
 #endif
 
-int WIN32_pipe(int[2]);
-
 void WIN32_ExceptionHandlerInit(void);
 
 int Win32__WSAFDIsSet(int fd, fd_set* set);