summaryrefslogtreecommitdiff
path: root/sql/handle_connections_win.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-03-19 18:10:23 +0200
committerMonty <monty@mariadb.org>2021-03-20 21:17:32 +0200
commitd7d102321745788afb014ef97ea218d773f43145 (patch)
tree3b51e448d03df0cc6991f6504d6e40cb5b3488b8 /sql/handle_connections_win.cc
parentcccc96d66c2aacb9939c8c1389b38317ad601956 (diff)
downloadmariadb-git-d7d102321745788afb014ef97ea218d773f43145.tar.gz
Changed std::vector<MYSQL_SOCKET> listen_sockets to Dynamic_array
Main reason for this was there was a crash in shutdown of the server in binlog_encryption.encryption_combo-mix and some other tests because something in listen_sockets where not initialized. Changing to Dynamic_array caused things to work. Other reason for removing std::vector was that it is harder to debug, and not integrated with DBUG, safemalloc, valgrind or memory calculation and cause code explosions (extra code generated for each std::vector type used).
Diffstat (limited to 'sql/handle_connections_win.cc')
-rw-r--r--sql/handle_connections_win.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/sql/handle_connections_win.cc b/sql/handle_connections_win.cc
index 8cfcd9d6e54..ec6bb9cb6d0 100644
--- a/sql/handle_connections_win.cc
+++ b/sql/handle_connections_win.cc
@@ -23,12 +23,11 @@
#include <mysql/psi/mysql_socket.h>
#include <sddl.h>
#include <vector>
-
#include <handle_connections_win.h>
/* From mysqld.cc */
extern HANDLE hEventShutdown;
-extern std::vector<MYSQL_SOCKET> listen_sockets;
+extern Dynamic_array<MYSQL_SOCKET> listen_sockets;
#ifdef HAVE_POOL_OF_THREADS
extern PTP_CALLBACK_ENVIRON get_threadpool_win_callback_environ();
extern void tp_win_callback_prolog();
@@ -292,7 +291,7 @@ retry :
return;
}
- SOCKET s= mysql_socket_getfd(listen_sockets[0]);
+ SOCKET s= mysql_socket_getfd(listen_sockets.at(0));
GUID guid_AcceptEx= WSAID_ACCEPTEX;
GUID guid_GetAcceptExSockaddrs= WSAID_GETACCEPTEXSOCKADDRS;
@@ -557,11 +556,11 @@ void network_init_win()
Socket_Listener::init_winsock_extensions();
/* Listen for TCP connections on "extra-port" (no threadpool).*/
- for (std::vector<MYSQL_SOCKET>::iterator it= listen_sockets.begin();
- it != listen_sockets.end(); ++it)
+ for (uint i= 0 ; i < listen_sockets.elements() ; i++)
{
- if (it->is_extra_port)
- all_listeners.push_back(new Socket_Listener(*it, 0));
+ MYSQL_SOCKET *sock= listen_sockets.get_pos(i);
+ if (sock->is_extra_port)
+ all_listeners.push_back(new Socket_Listener(*sock, 0));
}
/* Listen for named pipe connections */
@@ -574,16 +573,16 @@ void network_init_win()
all_listeners.push_back(new Pipe_Listener());
}
- for (std::vector<MYSQL_SOCKET>::iterator it= listen_sockets.begin();
- it != listen_sockets.end(); ++it)
+ for (uint i= 0 ; i < listen_sockets.elements() ; i++)
{
- if (it->is_extra_port)
+ MYSQL_SOCKET *sock= listen_sockets.get_pos(i);
+ if (sock->is_extra_port)
continue;
/* Wait for TCP connections.*/
- SetFileCompletionNotificationModes((HANDLE)it->fd,
+ SetFileCompletionNotificationModes((HANDLE) sock->fd,
FILE_SKIP_SET_EVENT_ON_HANDLE);
all_listeners.push_back(
- new Socket_Listener(*it, get_threadpool_win_callback_environ()));
+ new Socket_Listener(*sock, get_threadpool_win_callback_environ()));
}
if (all_listeners.size() == 0 && !opt_bootstrap)