Small improvements

Small improvements
This commit is contained in:
MassimilianoPinto
2015-08-04 16:39:03 +02:00
parent 1fc335e5f7
commit 619261cd21
2 changed files with 22 additions and 17 deletions

View File

@ -595,8 +595,8 @@ int rc = 0;
{
sprintf(name, "%s stats", service->name);
hktask_add(name, stats_func, inst, BLR_STATS_FREQ);
free(name);
}
free(name);
/*
* Now start the replication from the master to MaxScale
@ -1649,7 +1649,12 @@ char *service_passwd = NULL;
return 0;
}
/* -1 is failure, >0 is success */
/**
* Load mysql dbusers into (service->users)
*
* @param router The router instance
* @return -1 on failure, 0 for no users found, > 0 for found users
*/
int
blr_load_dbusers(ROUTER_INSTANCE *router)
{
@ -1717,7 +1722,12 @@ SERVICE *service;
return loaded;
}
/* -1 is error, >= 0 is ok */
/**
* Save dbusers to cache file
*
* @param router The router instance
* @return -1 on failure, >= 0 on success
*/
int
blr_save_dbusers(ROUTER_INSTANCE *router)
{

View File

@ -101,7 +101,6 @@ blr_start_master(void* data)
{
ROUTER_INSTANCE *router = (ROUTER_INSTANCE*)data;
DCB *client;
GWBUF *buf;
router->stats.n_binlogs_ses = 0;
spinlock_acquire(&router->lock);
@ -122,10 +121,9 @@ GWBUF *buf;
router->master_state = BLRM_CONNECTING;
/* Discard the queued residual data */
buf = router->residual;
while (buf)
while (router->residual)
{
buf = gwbuf_consume(buf, GWBUF_LENGTH(buf));
router->residual = gwbuf_consume(router->residual, GWBUF_LENGTH(router->residual));
}
router->residual = NULL;
@ -173,12 +171,11 @@ GWBUF *buf;
router->connect_time = time(0);
if (setsockopt(router->master->fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive , sizeof(keepalive )))
perror("setsockopt");
if (setsockopt(router->master->fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive , sizeof(keepalive )))
perror("setsockopt");
router->master_state = BLRM_AUTHENTICATED;
buf = blr_make_query("SELECT UNIX_TIMESTAMP()");
router->master->func.write(router->master, buf);
router->master->func.write(router->master, blr_make_query("SELECT UNIX_TIMESTAMP()"));
router->master_state = BLRM_TIMESTAMP;
router->stats.n_masterstarts++;
@ -195,15 +192,12 @@ perror("setsockopt");
static void
blr_restart_master(ROUTER_INSTANCE *router)
{
GWBUF *ptr;
dcb_close(router->client);
/* Discard the queued residual data */
ptr = router->residual;
while (ptr)
while (router->residual)
{
ptr = gwbuf_consume(ptr, GWBUF_LENGTH(ptr));
router->residual = gwbuf_consume(router->residual, GWBUF_LENGTH(router->residual));
}
router->residual = NULL;
@ -1497,7 +1491,8 @@ int action;
static void
blr_log_packet(logfile_id_t file, char *msg, uint8_t *ptr, int len)
{
char buf[400], *bufp;
char buf[400] = "";
char *bufp;
int i;
bufp = buf;