--------------------- PatchSet 5892 Date: 2007/10/07 09:54:49 Author: serassio Branch: squid3-ipv6 Tag: (none) Log: More conversion/fixes of windows IPC to protocol-neutral code. Members: src/ipc_win32.cc:1.3.6.7->1.3.6.8 Index: squid3/src/ipc_win32.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipc_win32.cc,v retrieving revision 1.3.6.7 retrieving revision 1.3.6.8 diff -u -r1.3.6.7 -r1.3.6.8 --- squid3/src/ipc_win32.cc 7 Oct 2007 01:42:57 -0000 1.3.6.7 +++ squid3/src/ipc_win32.cc 7 Oct 2007 09:54:49 -0000 1.3.6.8 @@ -1,5 +1,5 @@ /* - * $Id: ipc_win32.cc,v 1.3.6.7 2007/10/07 01:42:57 amosjeffries Exp $ + * $Id: ipc_win32.cc,v 1.3.6.8 2007/10/07 09:54:49 serassio Exp $ * * DEBUG: section 54 Windows Interprocess Communication * AUTHOR: Andrey Shorin @@ -48,8 +48,8 @@ int type; int crfd; int cwfd; - - struct sockaddr_in PS; + IPAddress local_addr; + struct addrinfo PS; const char *prog; char **args; }; @@ -148,27 +148,23 @@ crfd = cwfd = comm_open(SOCK_STREAM, IPPROTO_TCP, local_addr, - 0, COMM_NOCLOEXEC, name); prfd = pwfd = comm_open(SOCK_STREAM, IPPROTO_TCP, /* protocol */ local_addr, - 0, /* port */ 0, /* blocking */ name); } else if (type == IPC_UDP_SOCKET) { crfd = cwfd = comm_open(SOCK_DGRAM, IPPROTO_UDP, local_addr, - 0, COMM_NOCLOEXEC, name); prfd = pwfd = comm_open(SOCK_DGRAM, IPPROTO_UDP, local_addr, 0, - 0, name); } else if (type == IPC_FIFO) { debugs(54, 0, "ipcCreate: " << prog << ": use IPC_TCP_SOCKET instead of IP_FIFO on Windows"); @@ -243,6 +239,8 @@ params.cwfd = cwfd; params.PS = *aiPS; + + params.local_addr = local_addr; params.prog = prog; @@ -255,7 +253,7 @@ return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); } - if (comm_connect_addr(pwfd, &CS) == COMM_ERROR) { + if (comm_connect_addr(pwfd, aiCS.ai_addr) == COMM_ERROR) { CloseHandle((HANDLE) thread); return ipcCloseAllFD(prfd, pwfd, -1, -1); } @@ -373,7 +371,7 @@ struct thread_params thread_params; ssize_t x; - int tmp_s, fd = -1; + int fd = -1; char *str; STARTUPINFO si; PROCESS_INFORMATION pi; @@ -393,7 +391,8 @@ char **args = params->args; IPAddress PS = params->PS; - + IPAddress local_addr = params->local_addr; + buf1 = (char *)xcalloc(1, 8192); strcpy(buf1, params->prog); prog = strtok(buf1, w_space); @@ -463,7 +462,7 @@ if (type == IPC_UDP_SOCKET) { snprintf(buf1, 8192, "%s(%ld) <-> ipc CHILD socket", prog, -1L); - crfd_ipc = cwfd_ipc = comm_open(SOCK_DGRAM, IPPROTO_UDP, local_addr, 0, 0, buf1); + crfd_ipc = cwfd_ipc = comm_open(SOCK_DGRAM, IPPROTO_UDP, local_addr, 0, buf1); if (crfd_ipc < 0) { debugs(54, 0, "ipcCreate: CHILD: Failed to create child FD for " << prog << "."); @@ -472,7 +471,7 @@ } snprintf(buf1, 8192, "%s(%ld) <-> ipc PARENT socket", prog, -1L); - prfd_ipc = pwfd_ipc = comm_open(SOCK_DGRAM, IPPROTO_UDP, local_addr, 0, 0, buf1); + prfd_ipc = pwfd_ipc = comm_open(SOCK_DGRAM, IPPROTO_UDP, local_addr, 0, buf1); if (pwfd_ipc < 0) { debugs(54, 0, "ipcCreate: CHILD: Failed to create server FD for " << prog << ".");