if (server->tcp_socket != ARES_SOCKET_BAD)
{
SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0);
- closesocket(server->tcp_socket);
+ sclose(server->tcp_socket);
server->tcp_socket = ARES_SOCKET_BAD;
server->tcp_connection_generation = ++channel->tcp_connection_generation;
}
if (server->udp_socket != ARES_SOCKET_BAD)
{
SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0);
- closesocket(server->udp_socket);
+ sclose(server->udp_socket);
server->udp_socket = ARES_SOCKET_BAD;
}
}
/* $Id$ */
/* Copyright 1998 by the Massachusetts Institute of Technology.
- * Copyright (C) 2004-2008 by Daniel Stenberg
+ * Copyright (C) 2004-2009 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
#if !defined(WIN32) || defined(WATT32)
#include <netinet/in.h>
-/* We define closesocket() here so that we can use this function all over
- the source code for closing sockets. */
-#define closesocket(x) close(x)
#endif
#ifdef WATT32
#include <tcp.h>
#include <sys/ioctl.h>
-#undef closesocket
-#define closesocket(s) close_s(s)
#define writev(s,v,c) writev_s(s,v,c)
#define HAVE_WRITEV 1
#endif
/* Configure it. */
if (configure_socket(s, channel) < 0)
{
- closesocket(s);
+ sclose(s);
return -1;
}
if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
(void *)&opt, sizeof(opt)) == -1)
{
- closesocket(s);
+ sclose(s);
return -1;
}
#endif
if (err != EINPROGRESS && err != EWOULDBLOCK)
{
- closesocket(s);
+ sclose(s);
return -1;
}
}
channel->sock_create_cb_data);
if (err < 0)
{
- closesocket(s);
+ sclose(s);
return err;
}
}
/* Set the socket non-blocking. */
if (configure_socket(s, channel) < 0)
{
- closesocket(s);
+ sclose(s);
return -1;
}
if (err != EINPROGRESS && err != EWOULDBLOCK)
{
- closesocket(s);
+ sclose(s);
return -1;
}
}
channel->sock_create_cb_data);
if (err < 0)
{
- closesocket(s);
+ sclose(s);
return err;
}
}
#define HAVE_AF_INET6 1
#define HAVE_ARPA_INET_H 1
#define HAVE_ARPA_NAMESER_H 1
+ #define HAVE_CLOSESOCKET_CAMEL 1
#define HAVE_GETHOSTNAME 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_SYS_UIO_H 1
#define NS_INADDRSZ 4
#define HAVE_STRUCT_SOCKADDR_IN6 1
+ #define CloseSocket(s) close_s((s))
#endif
#undef word
#endif /* if 0 */
+/*
+ * Function-like macro definition used to close a socket.
+ */
+
+#if defined(HAVE_CLOSESOCKET)
+# define sclose(x) closesocket((x))
+#elif defined(HAVE_CLOSESOCKET_CAMEL)
+# define sclose(x) CloseSocket((x))
+#else
+# define sclose(x) close((x))
+#endif
+
+
/*
* Uppercase macro versions of ANSI/ISO is*() functions/macros which
* avoid negative number inputs with argument byte codes > 127.
#ifdef __AMIGA__ /* Any AmigaOS flavour */
#define HAVE_ARPA_INET_H 1
+#define HAVE_CLOSESOCKET_CAMEL 1
#define HAVE_GETHOSTBYADDR 1
#define HAVE_INET_ADDR 1
#define HAVE_INTTYPES_H 1
#define HAVE_SYS_TIME_H 1
#endif
+#ifdef MSDOS /* Watt-32 */
+ #define HAVE_CLOSESOCKET_CAMEL 1
+ #define CloseSocket(s) close_s((s))
+#endif
+
#undef word
#undef byte
/* sclose is probably already defined, redefine it! */
#undef sclose
#define sclose(sockfd) curl_sclose(sockfd,__LINE__,__FILE__)
-/* ares-adjusted define: */
-#undef closesocket
-#define closesocket(sockfd) curl_sclose(sockfd,__LINE__,__FILE__)
#undef fopen
#define fopen(file,mode) curl_fopen(file,mode,__LINE__,__FILE__)
#endif
/* Below we define some functions. They should
- 1. close a socket
4. set the SIGALRM signal timeout
5. set dir/file naming defines
#ifdef WIN32
-# if !defined(__CYGWIN__)
-# define sclose(x) closesocket(x)
-# else
-# define sclose(x) close(x)
-# endif
-
# define DIR_CHAR "\\"
# define DOT_CHAR "_"
# ifdef MSDOS /* Watt-32 */
# include <sys/ioctl.h>
-# define sclose(x) close_s(x)
# define select(n,r,w,x,t) select_s(n,r,w,x,t)
# define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
# include <tcp.h>
# undef byte
# endif
-# else /* MSDOS */
-
-# ifdef __BEOS__
-# define sclose(x) closesocket(x)
-# else /* __BEOS__ */
-# define sclose(x) close(x)
-# endif /* __BEOS__ */
-
# endif /* MSDOS */
-# ifdef _AMIGASF
-# undef sclose
-# define sclose(x) CloseSocket(x)
-# endif
-
# ifdef __minix
/* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
extern char * strtok_r(char *s, const char *delim, char **last);
#endif /* if 0 */
+/*
+ * Function-like macro definition used to close a socket.
+ */
+
+#if defined(HAVE_CLOSESOCKET)
+# define sclose(x) closesocket((x))
+#elif defined(HAVE_CLOSESOCKET_CAMEL)
+# define sclose(x) CloseSocket((x))
+#else
+# define sclose(x) close((x))
+#endif
+
+
/*
* Uppercase macro versions of ANSI/ISO is*() functions/macros which
* avoid negative number inputs with argument byte codes > 127.
#define OS "AmigaOS"
+#define HAVE_CLOSESOCKET_CAMEL 1
#define HAVE_UNISTD_H 1
#define HAVE_STRDUP 1
#define HAVE_UTIME 1