diff --git a/include/maxscale/dcb.h b/include/maxscale/dcb.h index b7c80e487..535a55422 100644 --- a/include/maxscale/dcb.h +++ b/include/maxscale/dcb.h @@ -218,7 +218,7 @@ typedef struct dcb void *authenticator_data; /**< The authenticator data for this DCB */ DCBMM memdata; /**< The data related to DCB memory management */ 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 */ SSL* ssl; /*< SSL struct for connection */ bool ssl_read_want_read; /*< Flag */ @@ -235,13 +235,6 @@ typedef struct dcb skygw_chk_t dcb_chk_tail; } 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 */ diff --git a/include/maxscale/hk_heartbeat.h b/include/maxscale/hk_heartbeat.h index 4810f006b..da7176e83 100644 --- a/include/maxscale/hk_heartbeat.h +++ b/include/maxscale/hk_heartbeat.h @@ -21,6 +21,6 @@ MXS_BEGIN_DECLS * every 100 milliseconds and may be used for crude timing etc. */ -extern long hkheartbeat; +extern int64_t hkheartbeat; MXS_END_DECLS diff --git a/include/maxscale/service.h b/include/maxscale/service.h index 7bc75ce04..ee3f3590f 100644 --- a/include/maxscale/service.h +++ b/include/maxscale/service.h @@ -145,7 +145,7 @@ typedef struct service SERVICE_REFRESH_RATE rate_limit; /**< The refresh rate limit for users table */ MXS_FILTER_DEF **filters; /**< Ordered list 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 */ struct service *next; /**< The next service in the linked list */ bool retry_start; /**< If starting of the service should be retried later */ diff --git a/server/core/CMakeLists.txt b/server/core/CMakeLists.txt index f0149d0c8..c8e0f256d 100644 --- a/server/core/CMakeLists.txt +++ b/server/core/CMakeLists.txt @@ -6,7 +6,8 @@ add_library(maxscale-common SHARED buffer.cc config.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) target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES}) diff --git a/server/core/dcb.c b/server/core/dcb.cc similarity index 99% rename from server/core/dcb.c rename to server/core/dcb.cc index 366230a28..3928c6060 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.cc @@ -99,7 +99,7 @@ #include "maxscale/queuemanager.h" /* A DCB with null values, used for initialization */ -static DCB dcb_initialized = DCB_INIT; +static DCB dcb_initialized; static DCB **all_dcbs; static SPINLOCK *all_dcbs_lock; @@ -114,12 +114,18 @@ thread_local long next_timeout_check = 0; 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(); - if ((zombies = MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL || - (all_dcbs = MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL || - (all_dcbs_lock = MXS_CALLOC(nthreads, sizeof(SPINLOCK))) == NULL || - (nzombies = MXS_CALLOC(nthreads, sizeof(int))) == NULL) + if ((zombies = (DCB**)MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL || + (all_dcbs = (DCB**)MXS_CALLOC(nthreads, sizeof(DCB*))) == NULL || + (all_dcbs_lock = (SPINLOCK*)MXS_CALLOC(nthreads, sizeof(SPINLOCK))) == NULL || + (nzombies = (int*)MXS_CALLOC(nthreads, sizeof(int))) == NULL) { MXS_OOM(); raise(SIGABRT); diff --git a/server/core/housekeeper.c b/server/core/housekeeper.c index d7406d72f..cd65c0afd 100644 --- a/server/core/housekeeper.c +++ b/server/core/housekeeper.c @@ -52,7 +52,7 @@ static SPINLOCK tasklock = SPINLOCK_INIT; 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 void hkthread(void *);