Fix in poll.c to prevent further processing when an error makes a DCBV into a zombie

Fix in laod_config for issues when not being able to load router modules
This commit is contained in:
Mark Riddoch 2013-07-03 18:15:02 +02:00
parent ad87126c16
commit b4f5889a3a
3 changed files with 12 additions and 4 deletions

View File

@ -176,7 +176,7 @@ CONFIG_CONTEXT *obj;
{
char *servers = config_get_value(obj->parameters, "servers");
char *roptions = config_get_value(obj->parameters, "router_options");
if (servers)
if (servers && obj->element)
{
char *s = strtok(servers, ",");
while (s)
@ -191,7 +191,7 @@ CONFIG_CONTEXT *obj;
s = strtok(NULL, ",");
}
}
if (roptions)
if (roptions && obj->element)
{
char *s = strtok(roptions, ",");
while (s)

View File

@ -258,7 +258,8 @@ GWPROTOCOL *funcs;
}
if ((funcs = (GWPROTOCOL *)load_module(protocol, MODULE_PROTOCOL)) == NULL)
{
dcb_free(dcb);
dcb_final_free(dcb);
fprintf(stderr, "Failed to load protocol module for %s, feee dcb %p\n", protocol, dcb);
return NULL;
}
memcpy(&(dcb->func), funcs, sizeof(GWPROTOCOL));
@ -266,7 +267,8 @@ GWPROTOCOL *funcs;
if ((dcb->fd = dcb->func.connect(dcb, server, session)) == -1)
{
dcb_free(dcb);
dcb_final_free(dcb);
fprintf(stderr, "Failed to connect to server, feee dcb %p\n", dcb);
return NULL;
}
atomic_add(&server->stats.n_connections, 1);

View File

@ -141,6 +141,7 @@ struct epoll_event events[MAX_EVENTS];
int i, nfds;
int thread_id = (int)arg;
/* Add this thread to the bitmask of running polling threads */
bitmask_set(&poll_mask, thread_id);
while (1)
{
@ -174,11 +175,15 @@ int thread_id = (int)arg;
{
atomic_add(&pollStats.n_error, 1);
dcb->func.error(dcb);
if (DCB_ISZOMBIE(dcb))
continue;
}
if (ev & EPOLLHUP)
{
atomic_add(&pollStats.n_hup, 1);
dcb->func.hangup(dcb);
if (DCB_ISZOMBIE(dcb))
continue;
}
if (ev & EPOLLOUT)
{
@ -203,6 +208,7 @@ int thread_id = (int)arg;
dcb_process_zombies(thread_id);
if (shutdown)
{
/* Remove this thread from the bitmask of running polling threads */
bitmask_clear(&poll_mask, thread_id);
return;
}