summaryrefslogtreecommitdiff
path: root/sql/handle_connections_win.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-08-12 14:39:53 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-08-12 14:39:53 +0300
commit0e34bb3e97f6707b6b66ff366184f0921b4049d5 (patch)
tree67cfea578ad61baa789c37aa68b3a935ab75a8b3 /sql/handle_connections_win.cc
parent1ddff751ebe45d6d6732e1e2ee7014268bfb18c1 (diff)
parent602d3dafa9496cd6996a787a4f16c4ab140f2ac2 (diff)
downloadmariadb-git-0e34bb3e97f6707b6b66ff366184f0921b4049d5.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'sql/handle_connections_win.cc')
-rw-r--r--sql/handle_connections_win.cc31
1 files changed, 18 insertions, 13 deletions
diff --git a/sql/handle_connections_win.cc b/sql/handle_connections_win.cc
index 49b24d96210..80c62c69b46 100644
--- a/sql/handle_connections_win.cc
+++ b/sql/handle_connections_win.cc
@@ -318,7 +318,7 @@ struct Pipe_Listener : public Listener
{
PTP_CALLBACK_ENVIRON m_tp_env;
Pipe_Listener():
- Listener(INVALID_HANDLE_VALUE, CreateEvent(0, FALSE, FALSE, 0)),
+ Listener(create_named_pipe(), CreateEvent(0, FALSE, FALSE, 0)),
m_tp_env(get_threadpool_win_callback_environ())
{
}
@@ -387,7 +387,6 @@ struct Pipe_Listener : public Listener
void begin_accept()
{
- m_handle= create_named_pipe();
BOOL connected= ConnectNamedPipe(m_handle, &m_overlapped);
if (connected)
{
@@ -432,11 +431,12 @@ struct Pipe_Listener : public Listener
sql_print_warning("ConnectNamedPipe completed with %u", GetLastError());
#endif
CloseHandle(m_handle);
- m_handle= INVALID_HANDLE_VALUE;
+ m_handle= create_named_pipe();
begin_accept();
return;
}
HANDLE pipe= m_handle;
+ m_handle= create_named_pipe();
begin_accept();
// If threadpool is on, create connection in threadpool thread
if (!m_tp_env || !TrySubmitThreadpoolCallback(tp_create_pipe_connection, pipe, m_tp_env))
@@ -493,13 +493,12 @@ static void create_shutdown_event()
#define SHUTDOWN_IDX 0
#define LISTENER_START_IDX 1
-void handle_connections_win()
-{
- Listener* all_listeners[MAX_WAIT_HANDLES]= {};
- HANDLE wait_events[MAX_WAIT_HANDLES]= {};
- int n_listeners= 0;
- int n_waits= 0;
+static Listener *all_listeners[MAX_WAIT_HANDLES];
+static HANDLE wait_events[MAX_WAIT_HANDLES];
+static int n_listeners;
+void network_init_win()
+{
Socket_Listener::init_winsock_extensions();
/* Listen for TCP connections on "extra-port" (no threadpool).*/
@@ -528,18 +527,24 @@ void handle_connections_win()
sql_print_error("Either TCP connections or named pipe connections must be enabled.");
unireg_abort(1);
}
+}
+
+void handle_connections_win()
+{
+ DBUG_ASSERT(hEventShutdown);
+ int n_waits;
create_shutdown_event();
wait_events[SHUTDOWN_IDX]= hEventShutdown;
- n_waits = 1;
+ n_waits= 1;
- for (int i= 0; i < n_listeners; i++)
+ for (int i= 0; i < n_listeners; i++)
{
HANDLE wait_handle= all_listeners[i]->wait_handle();
- if(wait_handle)
+ if (wait_handle)
{
- DBUG_ASSERT((i == 0) || (all_listeners[i-1]->wait_handle() != 0));
+ DBUG_ASSERT((i == 0) || (all_listeners[i - 1]->wait_handle() != 0));
wait_events[n_waits++]= wait_handle;
}
all_listeners[i]->begin_accept();