-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework server.ini parsing to not depend on the real console #1659
base: master
Are you sure you want to change the base?
Conversation
The commands under the Server group are only meant for server.ini files and aren't usable anywhere else. Similarly, server.ini files aren't supposed to call any other console commands. This is now enforced by not handling the server settings as real commands, but with a new dedicated server.ini parser that handles only server settings and nothing else. This new parser intentionally doesn't support some obscure features of the full console, such as spaces as command group/name separators (e. g. "Server Status" instead of "Server.Status") and console variables. This is strictly speaking a breaking change, but unlikely to cause issues - these features were never documented and are unused in practice.
This is now in pnNcEncrypt.cpp.
ST::string Parse(const plFileName& fileName); | ||
void Apply(); | ||
|
||
static ST::string Load(const plFileName& fileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a preference for returning a boolean status value and having the error string fetch being a separate call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a boolean return and an out parameter for the error message be okay too?
static bool Load(const plFileName& fileName, ST::string& errorMsg);
pfServerIni::Load
is a static method and I would rather not introduce a new global "last error" variable just for this one call...
Use the methods FromData_BE and FromData_LE instead, which make the endianness explicit (or rather, more explicit than an unnamed bool parameter with a default value).
8080b72
to
6f31c4a
Compare
ad7788f
to
c54e52e
Compare
Reworks how server.ini files are parsed, based on my console parsing refactoring in #1459. Advantages of this reworked code include:
Also includes some bonus refactoring of how the Diffie-Hellman keys are stored and passed around.
Example of the new error messages: