bugfix: after streamReload handlers and variables that existed before but do not exist any more had not been deleted

This commit is contained in:
2018-07-24 11:42:53 +02:00
parent fe44bf4fde
commit 8e02c65b09
2 changed files with 7 additions and 5 deletions

View File

@ -254,10 +254,12 @@ compile(StreamProtocolParser::Protocol* protocol)
protocol->getNumberVariable("pollperiod", pollPeriod))) protocol->getNumberVariable("pollperiod", pollPeriod)))
return false; return false;
if (!(protocol->getStringVariable("terminator", inTerminator, &inTerminatorDefined) && if (!(protocol->getStringVariable("interminator", inTerminator, &inTerminatorDefined) &&
protocol->getStringVariable("terminator", outTerminator, &outTerminatorDefined) &&
protocol->getStringVariable("interminator", inTerminator, &inTerminatorDefined) &&
protocol->getStringVariable("outterminator", outTerminator, &outTerminatorDefined) && protocol->getStringVariable("outterminator", outTerminator, &outTerminatorDefined) &&
(inTerminatorDefined ||
protocol->getStringVariable("terminator", inTerminator, &inTerminatorDefined)) &&
(outTerminatorDefined ||
protocol->getStringVariable("terminator", outTerminator, &outTerminatorDefined)) &&
protocol->getStringVariable("separator", separator))) protocol->getStringVariable("separator", separator)))
return false; return false;

View File

@ -882,12 +882,12 @@ getEnumVariable(const char* varname, unsigned short& value, const char** enumstr
bool StreamProtocolParser::Protocol:: bool StreamProtocolParser::Protocol::
getStringVariable(const char* varname, StreamBuffer& value, bool* defined) getStringVariable(const char* varname, StreamBuffer& value, bool* defined)
{ {
value.clear();
const Variable* pvar = getVariable(varname); const Variable* pvar = getVariable(varname);
if (!pvar) return true; if (!pvar) return true;
if (defined) *defined = true; if (defined) *defined = true;
const StreamBuffer* pvalue = &pvar->value; const StreamBuffer* pvalue = &pvar->value;
const char* source = (*pvalue)(); const char* source = (*pvalue)();
value.clear();
if (!compileString(value, source)) if (!compileString(value, source))
{ {
error("in string variable '%s' in protocol file '%s' line %d\n", error("in string variable '%s' in protocol file '%s' line %d\n",
@ -909,10 +909,10 @@ getStringVariable(const char* varname, StreamBuffer& value, bool* defined)
bool StreamProtocolParser::Protocol:: bool StreamProtocolParser::Protocol::
getCommands(const char* handlername,StreamBuffer& code, Client* client) getCommands(const char* handlername,StreamBuffer& code, Client* client)
{ {
code.clear();
const Variable* pvar = getVariable(handlername); const Variable* pvar = getVariable(handlername);
if (!pvar) return true; if (!pvar) return true;
if (!pvar->value) return true; if (!pvar->value) return true;
code.clear();
const char* source = pvar->value(); const char* source = pvar->value();
debug("StreamProtocolParser::Protocol::getCommands" debug("StreamProtocolParser::Protocol::getCommands"
"(handlername=\"%s\", client=\"%s\"): source=%s\n", "(handlername=\"%s\", client=\"%s\"): source=%s\n",