MySQL  8.0.22
Source Code Documentation
task_net.cc File Reference
#include "xcom/xcom_profile.h"
#include <netdb.h>
#include <sys/socket.h>
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "xcom/simset.h"
#include "xcom/task.h"
#include "xcom/task_debug.h"
#include "xcom/task_os.h"
#include "xcom/x_platform.h"
#include "xdr_gen/xcom_vp.h"

Classes

struct  infonode
 

Macros

#define STRING_PORT_SIZE   6
 
#define NR_GETADDRINFO_ATTEMPTS   10
 

Typedefs

typedef struct infonode infonode
 

Functions

result xcom_checked_socket (int domain, int type, int protocol)
 Wrapper function which retries and checks errors from socket. More...
 
int checked_getaddrinfo (const char *nodename, const char *servname, const struct addrinfo *hints, struct addrinfo **res)
 Wrapper function which retries and checks errors from getaddrinfo. More...
 
int checked_getaddrinfo_port (const char *nodename, xcom_port port, const struct addrinfo *hints, struct addrinfo **res)
 Wrapper function to checked_getaddrinfo that accepts a numeric port. More...
 
static infonodeinsert_server (infonode **top, char const *server, struct addrinfo *addr)
 
static infonodelookup_server (infonode *top, char const *server)
 
struct addrinfo * xcom_caching_getaddrinfo (char const *server)
 
void free_getaddrinfo_cache (infonode *top)
 
void deinit_network_cache ()
 
int init_net ()
 
int deinit_net ()
 

Variables

static infonodeaddrinfomap
 

Macro Definition Documentation

◆ NR_GETADDRINFO_ATTEMPTS

#define NR_GETADDRINFO_ATTEMPTS   10

◆ STRING_PORT_SIZE

#define STRING_PORT_SIZE   6

Typedef Documentation

◆ infonode

typedef struct infonode infonode

Function Documentation

◆ checked_getaddrinfo()

int checked_getaddrinfo ( const char *  nodename,
const char *  servname,
const struct addrinfo *  hints,
struct addrinfo **  res 
)

Wrapper function which retries and checks errors from getaddrinfo.

We have observed that getaddrinfo returns EAI_AGAIN when called with an unresolvable hostname on systems using systemd-resolved for DNS resolution. Therefore, we only attempt to resolve nodename up to NR_GETADDRINFO_ATTEMPTS times, to avoid getting stuck in an infinite loop.

◆ checked_getaddrinfo_port()

int checked_getaddrinfo_port ( const char *  nodename,
xcom_port  port,
const struct addrinfo *  hints,
struct addrinfo **  res 
)

Wrapper function to checked_getaddrinfo that accepts a numeric port.

◆ deinit_net()

int deinit_net ( )

◆ deinit_network_cache()

void deinit_network_cache ( )

◆ free_getaddrinfo_cache()

void free_getaddrinfo_cache ( infonode top)

◆ init_net()

int init_net ( )

◆ insert_server()

static infonode* insert_server ( infonode **  top,
char const *  server,
struct addrinfo *  addr 
)
static

◆ lookup_server()

static infonode* lookup_server ( infonode top,
char const *  server 
)
static

◆ xcom_caching_getaddrinfo()

struct addrinfo* xcom_caching_getaddrinfo ( char const *  server)

◆ xcom_checked_socket()

result xcom_checked_socket ( int  domain,
int  type,
int  protocol 
)

Wrapper function which retries and checks errors from socket.

Variable Documentation

◆ addrinfomap

infonode* addrinfomap
static