- Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathsocket_acceptors_task.h
87 lines (73 loc) · 3.15 KB
/
socket_acceptors_task.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* Copyright (c) 2016, 2025, Oracle and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
* as published by the Free Software Foundation.
*
* This program is designed to work with certain software (including
* but not limited to OpenSSL) that is licensed under separate terms,
* as designated in a particular file or component or in included license
* documentation. The authors of MySQL hereby grant you an additional
* permission to link the program and your derivative works with the
* separately licensed software that they have either included with
* the program or referenced in the documentation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License, version 2.0, for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef PLUGIN_X_SRC_NGS_SOCKET_ACCEPTORS_TASK_H_
#definePLUGIN_X_SRC_NGS_SOCKET_ACCEPTORS_TASK_H_
#include<cstdint>
#include<memory>
#include<string>
#include<vector>
#include"plugin/x/src/interface/listener.h"
#include"plugin/x/src/interface/listener_factory.h"
#include"plugin/x/src/interface/server_task.h"
#include"plugin/x/src/interface/socket_events.h"
#include"plugin/x/src/server/server_properties.h"
namespacengs {
classSocket_acceptors_task : publicxpl::iface::Server_task {
public:
using On_connection = xpl::iface::Listener::On_connection;
public:
Socket_acceptors_task(
const xpl::iface::Listener_factory &listener_factory,
const std::string &multi_bind_address, constuint16_t tcp_port,
constuint32_t tcp_port_open_timeout, const std::string &unix_socket_file,
constuint32_t backlog,
const std::shared_ptr<xpl::iface::Socket_events> &event);
boolprepare(Task_context *context) override;
voidstop(const Stop_cause cause = Stop_cause::k_normal_shutdown) override;
public:
voidpre_loop() override;
voidpost_loop() override;
voidloop() override;
private:
using Listener_interfaces = std::vector<xpl::iface::Listener *>;
classServer_task_time_and_event;
boolprepare_impl(Task_context *context);
voidprepare_listeners();
Listener_interfaces get_array_of_listeners();
voidshow_startup_log(const Server_properties &properties) const;
const xpl::iface::Listener_factory &m_listener_factory;
std::shared_ptr<xpl::iface::Socket_events> m_event;
std::string m_multi_bind_address;
constuint16_t m_tcp_port;
constuint32_t m_tcp_port_open_timeout;
std::string m_unix_socket_file;
std::vector<std::unique_ptr<xpl::iface::Listener>> m_tcp_socket;
std::unique_ptr<xpl::iface::Listener> m_unix_socket;
constuint32_t m_backlog;
Server_properties m_properties;
xpl::iface::Listener::Sync_variable_state m_time_and_event_state;
};
} // namespace ngs
#endif// PLUGIN_X_SRC_NGS_SOCKET_ACCEPTORS_TASK_H_