]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc_win32.cc
Renamed squid.h to squid-old.h and config.h to squid.h
[thirdparty/squid.git] / src / ipc_win32.cc
index bec30bf8c77bbf636cea8f701e5b9dec6167ac18..5b808d430a3459c9c38a41db63f246bf802e4c0c 100644 (file)
  *
  */
 
-#include "squid.h"
+#include "squid-old.h"
 #include "comm.h"
 #include "fde.h"
+#include "ip/Address.h"
+#include "rfc1738.h"
 #include "SquidTime.h"
 
 #ifndef _MSWSOCK_
@@ -47,7 +49,7 @@ struct ipc_params {
     int type;
     int crfd;
     int cwfd;
-    IpAddress local_addr;
+    Ip::Address local_addr;
     struct addrinfo PS;
     const char *prog;
     char **args;
@@ -98,14 +100,14 @@ PutEnvironment()
 #if HAVE_PUTENV
     char *env_str;
     int tmp_s;
-    env_str = (char *)xcalloc((tmp_s = strlen(Config.debugOptions) + 32), 1);
-    snprintf(env_str, tmp_s, "SQUID_DEBUG=%s", Config.debugOptions);
+    env_str = (char *)xcalloc((tmp_s = strlen(Debug::debugOptions) + 32), 1);
+    snprintf(env_str, tmp_s, "SQUID_DEBUG=%s", Debug::debugOptions);
     putenv(env_str);
 #endif
 }
 
 pid_t
-ipcCreate(int type, const char *prog, const char *const args[], const char *name, IpAddress &local_addr, int *rfd, int *wfd, void **hIpc)
+ipcCreate(int type, const char *prog, const char *const args[], const char *name, Ip::Address &local_addr, int *rfd, int *wfd, void **hIpc)
 {
     unsigned long thread;
 
@@ -115,7 +117,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
     DWORD ecode = 0;
     pid_t pid;
 
-    IpAddress tmp_addr;
+    Ip::Address tmp_addr;
     struct addrinfo *aiCS = NULL;
     struct addrinfo *aiPS = NULL;
 
@@ -252,7 +254,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
         return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
     }
 
-    /* NP: tmp_addr was left with eiether empty or aiCS in IpAddress format */
+    /* NP: tmp_addr was left with eiether empty or aiCS in Ip::Address format */
     if (comm_connect_addr(pwfd, tmp_addr) == COMM_ERROR) {
         CloseHandle((HANDLE) thread);
         return ipcCloseAllFD(prfd, pwfd, -1, -1);
@@ -301,7 +303,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
 
     hello_buf[x] = '\0';
     pid = atol(hello_buf);
-    commSetTimeout(prfd, -1, NULL, NULL);
+    commUnsetFdTimeout(prfd);
     commSetNonBlocking(prfd);
     commSetNonBlocking(pwfd);
     commSetCloseOnExec(prfd);
@@ -377,8 +379,8 @@ ipc_thread_1(void *in_params)
     int prfd_ipc = -1, pwfd_ipc = -1, crfd_ipc = -1, cwfd_ipc = -1;
     char *prog = NULL, *buf1 = NULL;
 
-    IpAddress PS_ipc;
-    IpAddress CS_ipc;
+    Ip::Address PS_ipc;
+    Ip::Address CS_ipc;
     struct addrinfo *aiPS_ipc = NULL;
     struct addrinfo *aiCS_ipc = NULL;
 
@@ -388,8 +390,8 @@ ipc_thread_1(void *in_params)
     int cwfd = params->cwfd;
     char **args = params->args;
 
-    IpAddress PS = params->PS;
-    IpAddress local_addr = params->local_addr;
+    Ip::Address PS = params->PS;
+    Ip::Address local_addr = params->local_addr;
 
     buf1 = (char *)xcalloc(1, 8192);
     strcpy(buf1, params->prog);
@@ -574,8 +576,7 @@ ipc_thread_1(void *in_params)
         hProcess = pi.hProcess;
     } else {
         pid = -1;
-        WIN32_maperror(GetLastError());
-        x = errno;
+        x = GetLastError();
     }
 
     dup2(t1, 0);
@@ -690,8 +691,7 @@ ipc_thread_1(void *in_params)
     else
         thread_params.rfd = prfd_ipc;
 
-    thread =
-        (HANDLE) _beginthreadex(NULL, 0, ipc_thread_2, &thread_params, 0, NULL);
+    thread = (HANDLE)_beginthreadex(NULL, 0, ipc_thread_2, &thread_params, 0, NULL);
 
     if (!thread) {
         debugs(54, 0, "ipcCreate: CHILD: _beginthreadex: " << xstrerror());