MySQL  8.0.17
Source Code Documentation
Mysqld_socket_listener Class Reference

This class represents the Mysqld_socket_listener which prepare the listener sockets to recieve connection events from the client. More...

#include <socket_connection.h>

Classes

struct  select_info_t
 

Public Member Functions

 Mysqld_socket_listener (const std::list< Bind_address_info > &bind_addresses, uint tcp_port, const Bind_address_info &admin_bind_addr, uint admin_tcp_port, bool use_separate_thread_for_admin, uint backlog, uint port_timeout, std::string unix_sockname)
 Constructor to setup a listener for listen to connect events from clients. More...
 
bool setup_listener ()
 Set up a listener - set of sockets to listen for connection events from clients. More...
 
Channel_infolisten_for_connection_event ()
 The body of the event loop that listen for connection events from clients. More...
 
void close_listener ()
 Close the listener. More...
 
 ~Mysqld_socket_listener ()
 

Private Member Functions

void add_socket_to_listener (MYSQL_SOCKET listen_socket)
 Add a socket to a set of sockets being waiting for a new connection request. More...
 
MYSQL_SOCKET get_ready_socket (bool *is_unix_socket, bool *is_admin_socket) const
 Get a socket ready to accept incoming connection. More...
 
void setup_connection_events (const socket_map_t &socket_map)
 Set up connection events for poll or select. More...
 

Private Attributes

std::list< Bind_address_infom_bind_addresses
 
Bind_address_info m_admin_bind_address
 
uint m_tcp_port
 
uint m_admin_tcp_port
 
bool m_use_separate_thread_for_admin
 
uint m_backlog
 
uint m_port_timeout
 
std::string m_unix_sockname
 
bool m_unlink_sockname
 
socket_map_t m_socket_map
 
MYSQL_SOCKET m_admin_interface_listen_socket
 
select_info_t m_select_info
 

Detailed Description

This class represents the Mysqld_socket_listener which prepare the listener sockets to recieve connection events from the client.

The Mysqld_socket_listener may be composed of either or both a tcp socket which listen on a default mysqld tcp port or a user specified port via mysqld command-line and a unix socket which is bind to a mysqld defaul pathname.

Constructor & Destructor Documentation

◆ Mysqld_socket_listener()

Mysqld_socket_listener::Mysqld_socket_listener ( const std::list< Bind_address_info > &  bind_addresses,
uint  tcp_port,
const Bind_address_info admin_bind_addr,
uint  admin_tcp_port,
bool  use_separate_thread_for_admin,
uint  backlog,
uint  port_timeout,
std::string  unix_sockname 
)

Constructor to setup a listener for listen to connect events from clients.

Parameters
bind_addresseslist of addresses to listen to
tcp_portTCP port to bind to
admin_bind_addraddress to listen admin connection
admin_tcp_portTCP port for admin connection to bind
use_separate_thread_for_adminListen to connection requests on admin interface in a separate thread
backlogbacklog specifying length of pending connection queue used in listen.
port_timeoutportname.
unix_socknamepathname for unix socket to bind to

◆ ~Mysqld_socket_listener()

Mysqld_socket_listener::~Mysqld_socket_listener ( )
inline

Member Function Documentation

◆ add_socket_to_listener()

void Mysqld_socket_listener::add_socket_to_listener ( MYSQL_SOCKET  listen_socket)
private

Add a socket to a set of sockets being waiting for a new connection request.

Parameters
listen_socketSocket to listen for.

◆ close_listener()

void Mysqld_socket_listener::close_listener ( )

Close the listener.

In case a server is started with the option use_separate_thread_for_admin=true this method also shutdowns a thread for handling of incoming connection requests on admin interface and joins it.

◆ get_ready_socket()

MYSQL_SOCKET Mysqld_socket_listener::get_ready_socket ( bool is_unix_socket,
bool is_admin_socket 
) const
private

Get a socket ready to accept incoming connection.

Parameters
[out]is_unix_sockethas the value true in case a new incoming connection ready for acceptance pertains to unix socket domain.
[out]is_admin_sockethas the value true in case a new incoming connection is waiting for acceptance on admin interface.
Returns
A socket ready to accept a new incoming connection.

◆ listen_for_connection_event()

Channel_info * Mysqld_socket_listener::listen_for_connection_event ( )

The body of the event loop that listen for connection events from clients.

Return values
Channel_infoChannel_info object abstracting the connected client details for processing this connection.

◆ setup_connection_events()

void Mysqld_socket_listener::setup_connection_events ( const socket_map_t socket_map)
private

Set up connection events for poll or select.

Parameters
socket_mapsockets to listen for connection requests.

◆ setup_listener()

bool Mysqld_socket_listener::setup_listener ( )

Set up a listener - set of sockets to listen for connection events from clients.

In case a server is started with the option use_separate_thread_for_admin=true invocation of this method also spawns a thread to handle incoming connection requests on admin interface.

Return values
falselistener sockets setup to be used to listen for connect events true failure in setting up the listener.

Member Data Documentation

◆ m_admin_bind_address

Bind_address_info Mysqld_socket_listener::m_admin_bind_address
private

◆ m_admin_interface_listen_socket

MYSQL_SOCKET Mysqld_socket_listener::m_admin_interface_listen_socket
private

◆ m_admin_tcp_port

uint Mysqld_socket_listener::m_admin_tcp_port
private

◆ m_backlog

uint Mysqld_socket_listener::m_backlog
private

◆ m_bind_addresses

std::list<Bind_address_info> Mysqld_socket_listener::m_bind_addresses
private

◆ m_port_timeout

uint Mysqld_socket_listener::m_port_timeout
private

◆ m_select_info

select_info_t Mysqld_socket_listener::m_select_info
private

◆ m_socket_map

socket_map_t Mysqld_socket_listener::m_socket_map
private

◆ m_tcp_port

uint Mysqld_socket_listener::m_tcp_port
private

◆ m_unix_sockname

std::string Mysqld_socket_listener::m_unix_sockname
private

◆ m_unlink_sockname

bool Mysqld_socket_listener::m_unlink_sockname
private

◆ m_use_separate_thread_for_admin

bool Mysqld_socket_listener::m_use_separate_thread_for_admin
private

The documentation for this class was generated from the following files: