From cvs-return-2502-apmail-apr-cvs-archive=apr.apache.org@apr.apache.org Fri Dec 07 23:33:38 2001 Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 36378 invoked by uid 500); 7 Dec 2001 23:33:38 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 36367 invoked from network); 7 Dec 2001 23:33:37 -0000 Date: 7 Dec 2001 23:14:19 -0000 Message-ID: <20011207231419.72013.qmail@icarus.apache.org> From: wrowe@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/network_io/win32 sockets.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N wrowe 01/12/07 15:14:19 Modified: network_io/win32 sockets.c Log: APR DOES NOT simply support TCP STREAM sockets. We need to look at if IPPROTO_TCP is absolutely required, and if the correct proto will be inferred for things such as SOCK_DGRAM for udp. In any case, the existing code was certainly very ugly and not nice. Revision Changes Path 1.67 +5 -4 apr/network_io/win32/sockets.c Index: sockets.c =================================================================== RCS file: /home/cvs/apr/network_io/win32/sockets.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- sockets.c 2001/11/26 15:53:37 1.66 +++ sockets.c 2001/12/07 23:14:18 1.67 @@ -121,6 +121,7 @@ int type, apr_pool_t *cont) { int family = ofamily; + int downgrade = (family == AF_UNSPEC); if (family == AF_UNSPEC) { #if APR_HAVE_IPV6 @@ -145,19 +146,19 @@ /* For right now, we are not using socket groups. We may later. * No flags to use when creating a socket, so use 0 for that parameter as well. */ - (*new)->sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + (*new)->sock = socket(family, type, /* IPPROTO_TCP */ 0); #endif #if APR_HAVE_IPV6 - if ((*new)->sock == INVALID_SOCKET && ofamily == AF_UNSPEC) { + if ((*new)->sock == INVALID_SOCKET && downgrade) { family = AF_INET; - (*new)->sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + (*new)->sock = socket(family, type, /* IPPROTO_TCP */ 0); } #endif if ((*new)->sock == INVALID_SOCKET) { return apr_get_netos_error(); } - set_socket_vars(*new, AF_INET, type); + set_socket_vars(*new, family, type); (*new)->timeout = -1; (*new)->disconnected = 0;