diff options
author | Joerg Bruehe <joerg.bruehe@oracle.com> | 2012-05-07 22:20:42 +0200 |
---|---|---|
committer | Joerg Bruehe <joerg.bruehe@oracle.com> | 2012-05-07 22:20:42 +0200 |
commit | ad1e123f478e170cdbed5fd0e6a58277e61326ad (patch) | |
tree | fd4bc4e87a0385cd676cd34fe9ba93dd57358f2e /vio | |
parent | 066dc9a281ee8932827f7e6180dd0fa1bfe5d922 (diff) | |
parent | 582b7283472a43af5d7fb51386df055ea9d44a96 (diff) | |
download | mariadb-git-ad1e123f478e170cdbed5fd0e6a58277e61326ad.tar.gz |
Merge 5.5.24 back into main 5.5.
This is a weave merge, but without any conflicts.
In 14 source files, the copyright year needed to be updated to 2012.
Diffstat (limited to 'vio')
-rw-r--r-- | vio/viosocket.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/vio/viosocket.c b/vio/viosocket.c index 6031cf6a795..56aa84df5fc 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -23,6 +23,11 @@ the file descriptior. */ +#ifdef __WIN__ + #include <winsock2.h> + #include <MSWSock.h> + #pragma comment(lib, "ws2_32.lib") +#endif #include "vio_priv.h" #ifdef FIONREAD_IN_SYS_FILIO @@ -277,6 +282,37 @@ vio_was_interrupted(Vio *vio __attribute__((unused))) } +int +mysql_socket_shutdown(my_socket mysql_socket, int how) +{ + int result; + +#ifdef __WIN__ + static LPFN_DISCONNECTEX DisconnectEx = NULL; + if (DisconnectEx == NULL) + { + DWORD dwBytesReturned; + GUID guidDisconnectEx = WSAID_DISCONNECTEX; + WSAIoctl(mysql_socket, SIO_GET_EXTENSION_FUNCTION_POINTER, + &guidDisconnectEx, sizeof(GUID), + &DisconnectEx, sizeof(DisconnectEx), + &dwBytesReturned, NULL, NULL); + } +#endif + + /* Non instrumented code */ +#ifdef __WIN__ + if (DisconnectEx) + result= (DisconnectEx(mysql_socket, (LPOVERLAPPED) NULL, + (DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1; + else +#endif + result= shutdown(mysql_socket, how); + + return result; +} + + int vio_close(Vio * vio) { int r=0; @@ -289,7 +325,7 @@ int vio_close(Vio * vio) vio->type == VIO_TYPE_SSL); DBUG_ASSERT(vio->sd >= 0); - if (shutdown(vio->sd, SHUT_RDWR)) + if (mysql_socket_shutdown(vio->sd, SHUT_RDWR)) r= -1; if (closesocket(vio->sd)) r= -1; |