Assertion `nMaxEntries > 0' failed with cs_max_packets == 0
We should print a nice error message instead of crashing.
[...] 1457018941.499514 INFO: [TablesConfigSection] Setting CS max packets to 0 nfd: ../daemon/table/cs-policy.cpp:44: void nfd::cs::Policy::setLimit(std::size_t): Assertion `nMaxEntries > 0' failed.
Updated by Junxiao Shi over 4 years ago
- Assignee set to Minsheng Zhang
cs::Policy::setLimit has no
nMaxEntries > 0 declaration in Doxygen.
If this condition is in fact needed for all policies, it should be declared as part of
\param, and the caller has the responsibility to ensure the argument is positive;
if this condition is only needed for some policies, it should be mentioned in a
\throw, and the callee should use an exception rather than an assertion to check the condition, and the caller may catch the exception and produce an error message.
It's wrong for
cs::Policy::setLimit to print an error message and retain the previous setting, because this would admit an incorrect configuration file.
I'm assigning this to @MinSheng who authored