Fixed config failure when listener only has a socket and no port.
This commit is contained in:
@ -943,59 +943,66 @@ process_config_context(CONFIG_CONTEXT *context)
|
|||||||
gateway.id = (unsigned long) (serv_addr.sin_addr.s_addr + (port != NULL ? atoi(port) : 0 + getpid()));
|
gateway.id = (unsigned long) (serv_addr.sin_addr.s_addr + (port != NULL ? atoi(port) : 0 + getpid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service && socket && protocol) {
|
if(service && protocol && (socket || port))
|
||||||
|
{
|
||||||
|
if (socket)
|
||||||
|
{
|
||||||
CONFIG_CONTEXT *ptr = context;
|
CONFIG_CONTEXT *ptr = context;
|
||||||
while (ptr && strcmp(ptr->object, service) != 0)
|
while (ptr && strcmp(ptr->object, service) != 0)
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
if (ptr && ptr->element)
|
if (ptr && ptr->element)
|
||||||
{
|
{
|
||||||
serviceAddProtocol(ptr->element,
|
serviceAddProtocol(ptr->element,
|
||||||
protocol,
|
protocol,
|
||||||
socket,
|
socket,
|
||||||
0);
|
0);
|
||||||
} else {
|
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
|
||||||
LOGFILE_ERROR,
|
|
||||||
"Error : Listener '%s', "
|
|
||||||
"service '%s' not found. "
|
|
||||||
"Listener will not execute for socket %s.",
|
|
||||||
obj->object, service, socket)));
|
|
||||||
error_count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (service && port && protocol) {
|
|
||||||
CONFIG_CONTEXT *ptr = context;
|
|
||||||
while (ptr && strcmp(ptr->object, service) != 0)
|
|
||||||
ptr = ptr->next;
|
|
||||||
if (ptr && ptr->element)
|
|
||||||
{
|
|
||||||
serviceAddProtocol(ptr->element,
|
|
||||||
protocol,
|
|
||||||
address,
|
|
||||||
atoi(port));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : Listener '%s', "
|
"Error : Listener '%s', "
|
||||||
"service '%s' not found. "
|
"service '%s' not found. "
|
||||||
"Listener will not execute.",
|
"Listener will not execute for socket %s.",
|
||||||
obj->object, service)));
|
obj->object, service, socket)));
|
||||||
error_count++;
|
error_count++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (port)
|
||||||
|
{
|
||||||
|
CONFIG_CONTEXT *ptr = context;
|
||||||
|
while (ptr && strcmp(ptr->object, service) != 0)
|
||||||
|
ptr = ptr->next;
|
||||||
|
if (ptr && ptr->element)
|
||||||
|
{
|
||||||
|
serviceAddProtocol(ptr->element,
|
||||||
|
protocol,
|
||||||
|
address,
|
||||||
|
atoi(port));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Listener '%s', "
|
||||||
|
"service '%s' not found. "
|
||||||
|
"Listener will not execute.",
|
||||||
|
obj->object, service)));
|
||||||
|
error_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : Listener '%s' is misisng a "
|
"Error : Listener '%s' is missing a "
|
||||||
"required "
|
"required "
|
||||||
"parameter. A Listener must have a "
|
"parameter. A Listener must have a "
|
||||||
"service, port and protocol defined.",
|
"service, port and protocol defined.",
|
||||||
obj->object)));
|
obj->object)));
|
||||||
error_count++;
|
error_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(type, "monitor"))
|
else if (!strcmp(type, "monitor"))
|
||||||
|
|||||||
Reference in New Issue
Block a user