Changeset: 5e0449357195 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5e0449357195
Modified Files:
        buildtools/conf/MonetDB.m4
Branch: default
Log Message:

Merge with Jun2010 branch.


diffs (154 lines):

diff -r 6c53ea638a80 -r 5e0449357195 buildtools/conf/MonetDB.m4
--- a/buildtools/conf/MonetDB.m4        Thu Jul 22 14:04:34 2010 +0200
+++ b/buildtools/conf/MonetDB.m4        Thu Jul 22 15:42:33 2010 +0200
@@ -1240,7 +1240,7 @@
 AC_C_CHAR_UNSIGNED
 
 # Checks for library functions.
-AC_CHECK_FUNCS([ftruncate gettimeofday opendir sysconf times])
+AC_CHECK_FUNCS([ftruncate getaddrinfo gettimeofday opendir sysconf times])
 AC_CHECK_FUNCS([madvise posix_fadvise posix_madvise]) dnl gdk_posix.mx
 AC_FUNC_FSEEKO()
 
diff -r 6c53ea638a80 -r 5e0449357195 buildtools/conf/winconfig.h
--- a/buildtools/conf/winconfig.h       Thu Jul 22 14:04:34 2010 +0200
+++ b/buildtools/conf/winconfig.h       Thu Jul 22 15:42:33 2010 +0200
@@ -54,6 +54,7 @@
 #include <process.h>
 #include <windows.h>
 #include <stddef.h>
+#include <ws2tcpip.h>
 
 /* Release name or "unreleased" */
 #define MONETDB_RELEASE "unreleased"
@@ -163,6 +164,9 @@
 /* Does your compiler support function attributes (__attribute__)? */
 /* #undef HAVE_FUNCTION_ATTRIBUTES */
 
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define HAVE_GETADDRINFO 1
+
 /* Define to 1 if you have the `getlogin' function. */
 /* #undef HAVE_GETLOGIN */
 
diff -r 6c53ea638a80 -r 5e0449357195 buildtools/conf/winrules.msc
--- a/buildtools/conf/winrules.msc      Thu Jul 22 14:04:34 2010 +0200
+++ b/buildtools/conf/winrules.msc      Thu Jul 22 15:42:33 2010 +0200
@@ -222,7 +222,7 @@
 
 LIBC_INCS = $(PTHREAD_INCS)
 MATH_LIBS =
-SOCKET_LIBS = wsock32.lib
+SOCKET_LIBS = wsock32.lib Ws2_32.lib
 
 MEL=mel.exe
 MX=Mx.exe
diff -r 6c53ea638a80 -r 5e0449357195 clients/src/mapilib/Mapi.mx
--- a/clients/src/mapilib/Mapi.mx       Thu Jul 22 14:04:34 2010 +0200
+++ b/clients/src/mapilib/Mapi.mx       Thu Jul 22 15:42:33 2010 +0200
@@ -2329,13 +2329,6 @@
 static MapiMsg
 connect_to_server(Mapi mid)
 {
-       struct sockaddr_in server;
-
-#ifdef HAVE_SYS_UN_H
-       struct sockaddr_un userver;
-#endif
-       struct sockaddr *serv;
-       socklen_t servsize;
        SOCKET s;
 
        char errbuf[8096];
@@ -2355,6 +2348,8 @@
                struct msghdr msg;
                struct iovec vec;
                char buf[1];
+               struct sockaddr_un userver;
+               struct sockaddr *serv = (struct sockaddr *) &userver;
 
                if (strlen(mid->hostname) >= sizeof(userver.sun_path)) {
                        return mapi_setError(mid, "path name too long", 
"mapi_reconnect", MERROR);
@@ -2368,11 +2363,9 @@
                memset(&userver, 0, sizeof(struct sockaddr_un));
                userver.sun_family = AF_UNIX;
                strncpy(userver.sun_path, mid->hostname, 
sizeof(userver.sun_path));
-               serv = (struct sockaddr *) &userver;
-               servsize = sizeof(struct sockaddr_un);
                s = socket(PF_UNIX, SOCK_STREAM, 0);
 
-               if (connect(s, serv, servsize) < 0) {
+               if (connect(s, serv, sizeof(struct sockaddr_un)) < 0) {
                        snprintf(errbuf, sizeof(errbuf),
                                 "initiating connection on socket failed: %s",
                                 strerror(errno));
@@ -2399,7 +2392,39 @@
        } else
 #endif
        {
+#ifdef HAVE_GETADDRINFO
+               struct addrinfo hints, *res, *rp;
+               char port[32];
+               int ret;
+
+               if (mid->hostname == NULL)
+                       mid->hostname = strdup("localhost");
+               snprintf(port, sizeof(port), "%d", mid->port & 0xFFFF);
+
+               memset(&hints, 0, sizeof(hints));
+               hints.ai_family = AF_UNSPEC;
+               hints.ai_socktype = SOCK_STREAM;
+               hints.ai_protocol = IPPROTO_TCP;
+               ret = getaddrinfo(mid->hostname, port, &hints, &res);
+               if (ret) {
+                       snprintf(errbuf, sizeof(errbuf), "getaddrinfo failed: 
%s", gai_strerror(ret));
+                       return mapi_setError(mid, errbuf, "mapi_reconnect", 
MERROR);
+               }
+               for (rp = res; rp; rp = rp->ai_next) {
+                       s = socket(rp->ai_family, rp->ai_socktype, 
rp->ai_protocol);
+                       if (s == INVALID_SOCKET)
+                               continue;
+                       if (connect(s, rp->ai_addr, rp->ai_addrlen) != -1)
+                               break;  /* success */
+                       close(s);
+               }
+               freeaddrinfo(res);
+               if (rp == NULL)
+                       return mapi_setError(mid, "could not connect", 
"mapi_reconnect", MERROR);
+#else
+               struct sockaddr_in server;
                struct hostent *hp;
+               struct sockaddr *serv = (struct sockaddr *) &server;
 
                if (mid->hostname == NULL)
                        mid->hostname = strdup("localhost");
@@ -2412,8 +2437,6 @@
                memcpy(&server.sin_addr, hp->h_addr_list[0], hp->h_length);
                server.sin_family = hp->h_addrtype;
                server.sin_port = htons((unsigned short) (mid->port & 0xFFFF));
-               serv = (struct sockaddr *) &server;
-               servsize = sizeof(server);
                s = socket(server.sin_family, SOCK_STREAM, IPPROTO_TCP);
 
                if (s == INVALID_SOCKET) {
@@ -2421,12 +2444,13 @@
                        return mapi_setError(mid, errbuf, "mapi_reconnect", 
MERROR);
                }
 
-               if (connect(s, serv, servsize) < 0) {
+               if (connect(s, serv, sizeof(server)) < 0) {
                        snprintf(errbuf, sizeof(errbuf),
                                 "initiating connection on socket failed: %s",
                                 strerror(errno));
                        return mapi_setError(mid, errbuf, "mapi_reconnect", 
MERROR);
                }
+#endif
        }
 
        mid->to = socket_wastream(s, "Mapi client write");
diff -r 6c53ea638a80 -r 5e0449357195 testing/src/Mtest.py.bat
--- a/testing/src/Mtest.py.bat  Thu Jul 22 14:04:34 2010 +0200
+++ b/testing/src/Mtest.py.bat  Thu Jul 22 15:42:33 2010 +0200
@@ -1,1 +1,1 @@
-...@python %~dpn0 %*
+...@python "%~dpn0" %*
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to