Added server references to services instead of using a raw pointers to server instances.
Changed all references to service->database to service->dbref.
This commit is contained in:
Markus Makela
2015-01-02 20:28:26 +02:00
parent ef19b9e729
commit 95cd0b93cb
8 changed files with 68 additions and 48 deletions

View File

@ -201,7 +201,7 @@ int i;
* which of these servers is currently the master and replicate from
* that server.
*/
if (service->databases == NULL || service->databases->nextdb != NULL)
if (service->dbref == NULL || service->dbref->next != NULL)
{
LOGIF(LE, (skygw_log_write(
LOGFILE_ERROR,
@ -543,7 +543,7 @@ ROUTER_SLAVE *slave = (ROUTER_SLAVE *)router_session;
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Binlog router close session with master server %s",
router->service->databases->unique_name)));
router->service->dbref->server->unique_name)));
blr_master_reconnect(router);
return;
}

View File

@ -121,7 +121,7 @@ GWBUF *buf;
return;
}
client->session = router->session;
if ((router->master = dcb_connect(router->service->databases, router->session, BLR_PROTOCOL)) == NULL)
if ((router->master = dcb_connect(router->service->dbref->server, router->session, BLR_PROTOCOL)) == NULL)
{
char *name;
if ((name = malloc(strlen(router->service->name)
@ -135,10 +135,10 @@ GWBUF *buf;
router->retry_backoff = BLR_MAX_BACKOFF;
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
"Binlog router: failed to connect to master server '%s'",
router->service->databases->unique_name)));
router->service->dbref->server->unique_name)));
return;
}
router->master->remote = strdup(router->service->databases->name);
router->master->remote = strdup(router->service->dbref->server->name);
LOGIF(LM,(skygw_log_write(
LOGFILE_MESSAGE,
"%s: atempting to connect to master server %s.",