Compile dcb.c as C++

This commit is contained in:
Johan Wikman
2017-03-23 16:03:21 +02:00
parent 71ae3cf524
commit db18e19d3c
6 changed files with 17 additions and 17 deletions

View File

@ -218,7 +218,7 @@ typedef struct dcb
void *authenticator_data; /**< The authenticator data for this DCB */ void *authenticator_data; /**< The authenticator data for this DCB */
DCBMM memdata; /**< The data related to DCB memory management */ DCBMM memdata; /**< The data related to DCB memory management */
DCB_CALLBACK *callbacks; /**< The list of callbacks for the DCB */ DCB_CALLBACK *callbacks; /**< The list of callbacks for the DCB */
long last_read; /*< Last time the DCB received data */ int64_t last_read; /*< Last time the DCB received data */
struct server *server; /**< The associated backend server */ struct server *server; /**< The associated backend server */
SSL* ssl; /*< SSL struct for connection */ SSL* ssl; /*< SSL struct for connection */
bool ssl_read_want_read; /*< Flag */ bool ssl_read_want_read; /*< Flag */
@ -235,13 +235,6 @@ typedef struct dcb
skygw_chk_t dcb_chk_tail; skygw_chk_t dcb_chk_tail;
} DCB; } DCB;
#define DCB_INIT {.dcb_chk_top = CHK_NUM_DCB, \
.evq = DCBEVENTQ_INIT, .ip = {0}, .func = {0}, .authfunc = {0}, \
.stats = {0}, .memdata = DCBMM_INIT, \
.fd = DCBFD_CLOSED, .stats = DCBSTATS_INIT, .ssl_state = SSL_HANDSHAKE_UNKNOWN, \
.state = DCB_STATE_ALLOC, .dcb_chk_tail = CHK_NUM_DCB, \
.authenticator_data = NULL, .thread = {0}}
/** /**
* The DCB usage filer used for returning DCB's in use for a certain reason * The DCB usage filer used for returning DCB's in use for a certain reason
*/ */

View File

@ -21,6 +21,6 @@ MXS_BEGIN_DECLS
* every 100 milliseconds and may be used for crude timing etc. * every 100 milliseconds and may be used for crude timing etc.
*/ */
extern long hkheartbeat; extern int64_t hkheartbeat;
MXS_END_DECLS MXS_END_DECLS

View File

@ -145,7 +145,7 @@ typedef struct service
SERVICE_REFRESH_RATE rate_limit; /**< The refresh rate limit for users table */ SERVICE_REFRESH_RATE rate_limit; /**< The refresh rate limit for users table */
MXS_FILTER_DEF **filters; /**< Ordered list of filters */ MXS_FILTER_DEF **filters; /**< Ordered list of filters */
int n_filters; /**< Number of filters */ int n_filters; /**< Number of filters */
uint64_t conn_idle_timeout; /**< Session timeout in seconds */ int64_t conn_idle_timeout; /**< Session timeout in seconds */
char *weightby; /**< Service weighting parameter name */ char *weightby; /**< Service weighting parameter name */
struct service *next; /**< The next service in the linked list */ struct service *next; /**< The next service in the linked list */
bool retry_start; /**< If starting of the service should be retried later */ bool retry_start; /**< If starting of the service should be retried later */

View File

@ -6,7 +6,8 @@ add_library(maxscale-common SHARED
buffer.cc buffer.cc
config.cc config.cc
config_runtime.cc config_runtime.cc
dcb.c filter.c filter.cc externcmd.c paths.c hashtable.c hint.c housekeeper.c load_utils.c log_manager.cc maxscale_pcre2.c misc.c mlist.c modutil.c monitor.c queuemanager.c query_classifier.cc poll.c random_jkiss.c resultset.c router.cc secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c skygw_utils.cc statistics.c listener.c ssl.c mysql_utils.c mysql_binlog.c modulecmd.c) dcb.cc
filter.c filter.cc externcmd.c paths.c hashtable.c hint.c housekeeper.c load_utils.c log_manager.cc maxscale_pcre2.c misc.c mlist.c modutil.c monitor.c queuemanager.c query_classifier.cc poll.c random_jkiss.c resultset.c router.cc secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c skygw_utils.cc statistics.c listener.c ssl.c mysql_utils.c mysql_binlog.c modulecmd.c)
if(WITH_JEMALLOC) if(WITH_JEMALLOC)
target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES}) target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES})

View File

@ -99,7 +99,7 @@
#include "maxscale/queuemanager.h" #include "maxscale/queuemanager.h"
/* A DCB with null values, used for initialization */ /* A DCB with null values, used for initialization */
static DCB dcb_initialized = DCB_INIT; static DCB dcb_initialized;
static DCB **all_dcbs; static DCB **all_dcbs;
static SPINLOCK *all_dcbs_lock; static SPINLOCK *all_dcbs_lock;
@ -114,12 +114,18 @@ thread_local long next_timeout_check = 0;
void dcb_global_init() void dcb_global_init()
{ {
dcb_initialized.dcb_chk_top = CHK_NUM_DCB;
dcb_initialized.fd = DCBFD_CLOSED;
dcb_initialized.state = DCB_STATE_ALLOC;
dcb_initialized.ssl_state = SSL_HANDSHAKE_UNKNOWN;
dcb_initialized.dcb_chk_tail = CHK_NUM_DCB;
int nthreads = config_threadcount(); int nthreads = config_threadcount();
if ((zombies = MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL || if ((zombies = (DCB**)MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL ||
(all_dcbs = MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL || (all_dcbs = (DCB**)MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL ||
(all_dcbs_lock = MXS_CALLOC(nthreads, sizeof(SPINLOCK))) == NULL || (all_dcbs_lock = (SPINLOCK*)MXS_CALLOC(nthreads, sizeof(SPINLOCK))) == NULL ||
(nzombies = MXS_CALLOC(nthreads, sizeof(int))) == NULL) (nzombies = (int*)MXS_CALLOC(nthreads, sizeof(int))) == NULL)
{ {
MXS_OOM(); MXS_OOM();
raise(SIGABRT); raise(SIGABRT);

View File

@ -52,7 +52,7 @@ static SPINLOCK tasklock = SPINLOCK_INIT;
static bool do_shutdown = 0; static bool do_shutdown = 0;
long hkheartbeat = 0; /*< One heartbeat is 100 milliseconds */ int64_t hkheartbeat = 0; /*< One heartbeat is 100 milliseconds */
static THREAD hk_thr_handle; static THREAD hk_thr_handle;
static void hkthread(void *); static void hkthread(void *);