mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
auto-merge
This commit is contained in:
commit
976759d3bf
3 changed files with 48 additions and 9 deletions
|
@ -59,6 +59,9 @@ Vio* vio_new_win32shared_memory(HANDLE handle_file_map,
|
||||||
#define HANDLE void *
|
#define HANDLE void *
|
||||||
#endif /* __WIN__ */
|
#endif /* __WIN__ */
|
||||||
|
|
||||||
|
/* backport from 5.6 where it is part of PSI, not vio_*() */
|
||||||
|
int mysql_socket_shutdown(my_socket mysql_socket, int how);
|
||||||
|
|
||||||
void vio_delete(Vio* vio);
|
void vio_delete(Vio* vio);
|
||||||
int vio_close(Vio* vio);
|
int vio_close(Vio* vio);
|
||||||
void vio_reset(Vio* vio, enum enum_vio_type type,
|
void vio_reset(Vio* vio, enum enum_vio_type type,
|
||||||
|
|
|
@ -1045,7 +1045,7 @@ static void close_connections(void)
|
||||||
{
|
{
|
||||||
if (ip_sock != INVALID_SOCKET)
|
if (ip_sock != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
(void) shutdown(ip_sock, SHUT_RDWR);
|
(void) mysql_socket_shutdown(ip_sock, SHUT_RDWR);
|
||||||
(void) closesocket(ip_sock);
|
(void) closesocket(ip_sock);
|
||||||
ip_sock= INVALID_SOCKET;
|
ip_sock= INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1077,7 @@ static void close_connections(void)
|
||||||
#ifdef HAVE_SYS_UN_H
|
#ifdef HAVE_SYS_UN_H
|
||||||
if (unix_sock != INVALID_SOCKET)
|
if (unix_sock != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
(void) shutdown(unix_sock, SHUT_RDWR);
|
(void) mysql_socket_shutdown(unix_sock, SHUT_RDWR);
|
||||||
(void) closesocket(unix_sock);
|
(void) closesocket(unix_sock);
|
||||||
(void) unlink(mysqld_unix_port);
|
(void) unlink(mysqld_unix_port);
|
||||||
unix_sock= INVALID_SOCKET;
|
unix_sock= INVALID_SOCKET;
|
||||||
|
@ -1184,14 +1184,14 @@ static void close_server_sock()
|
||||||
{
|
{
|
||||||
ip_sock=INVALID_SOCKET;
|
ip_sock=INVALID_SOCKET;
|
||||||
DBUG_PRINT("info",("calling shutdown on TCP/IP socket"));
|
DBUG_PRINT("info",("calling shutdown on TCP/IP socket"));
|
||||||
(void) shutdown(tmp_sock, SHUT_RDWR);
|
(void) mysql_socket_shutdown(tmp_sock, SHUT_RDWR);
|
||||||
}
|
}
|
||||||
tmp_sock=unix_sock;
|
tmp_sock=unix_sock;
|
||||||
if (tmp_sock != INVALID_SOCKET)
|
if (tmp_sock != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
unix_sock=INVALID_SOCKET;
|
unix_sock=INVALID_SOCKET;
|
||||||
DBUG_PRINT("info",("calling shutdown on unix socket"));
|
DBUG_PRINT("info",("calling shutdown on unix socket"));
|
||||||
(void) shutdown(tmp_sock, SHUT_RDWR);
|
(void) mysql_socket_shutdown(tmp_sock, SHUT_RDWR);
|
||||||
(void) unlink(mysqld_unix_port);
|
(void) unlink(mysqld_unix_port);
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
@ -5191,7 +5191,7 @@ void handle_connections_sockets()
|
||||||
if (req.sink)
|
if (req.sink)
|
||||||
((void (*)(int))req.sink)(req.fd);
|
((void (*)(int))req.sink)(req.fd);
|
||||||
|
|
||||||
(void) shutdown(new_sock, SHUT_RDWR);
|
(void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
|
||||||
(void) closesocket(new_sock);
|
(void) closesocket(new_sock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -5207,7 +5207,7 @@ void handle_connections_sockets()
|
||||||
(SOCKET_SIZE_TYPE *)&dummyLen) < 0 )
|
(SOCKET_SIZE_TYPE *)&dummyLen) < 0 )
|
||||||
{
|
{
|
||||||
sql_perror("Error on new connection socket");
|
sql_perror("Error on new connection socket");
|
||||||
(void) shutdown(new_sock, SHUT_RDWR);
|
(void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
|
||||||
(void) closesocket(new_sock);
|
(void) closesocket(new_sock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -5219,7 +5219,7 @@ void handle_connections_sockets()
|
||||||
|
|
||||||
if (!(thd= new THD))
|
if (!(thd= new THD))
|
||||||
{
|
{
|
||||||
(void) shutdown(new_sock, SHUT_RDWR);
|
(void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
|
||||||
(void) closesocket(new_sock);
|
(void) closesocket(new_sock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -5238,7 +5238,7 @@ void handle_connections_sockets()
|
||||||
vio_delete(vio_tmp);
|
vio_delete(vio_tmp);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(void) shutdown(new_sock, SHUT_RDWR);
|
(void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
|
||||||
(void) closesocket(new_sock);
|
(void) closesocket(new_sock);
|
||||||
}
|
}
|
||||||
delete thd;
|
delete thd;
|
||||||
|
|
|
@ -23,6 +23,11 @@
|
||||||
the file descriptior.
|
the file descriptior.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __WIN__
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <MSWSock.h>
|
||||||
|
#pragma comment(lib, "ws2_32.lib")
|
||||||
|
#endif
|
||||||
#include "vio_priv.h"
|
#include "vio_priv.h"
|
||||||
|
|
||||||
#ifdef FIONREAD_IN_SYS_FILIO
|
#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 vio_close(Vio * vio)
|
||||||
{
|
{
|
||||||
int r=0;
|
int r=0;
|
||||||
|
@ -289,7 +325,7 @@ int vio_close(Vio * vio)
|
||||||
vio->type == VIO_TYPE_SSL);
|
vio->type == VIO_TYPE_SSL);
|
||||||
|
|
||||||
DBUG_ASSERT(vio->sd >= 0);
|
DBUG_ASSERT(vio->sd >= 0);
|
||||||
if (shutdown(vio->sd, SHUT_RDWR))
|
if (mysql_socket_shutdown(vio->sd, SHUT_RDWR))
|
||||||
r= -1;
|
r= -1;
|
||||||
if (closesocket(vio->sd))
|
if (closesocket(vio->sd))
|
||||||
r= -1;
|
r= -1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue