-
Notifications
You must be signed in to change notification settings - Fork 173
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
Begin to break into modules #625
base: v1.x
Are you sure you want to change the base?
Conversation
enum { /* States */ | ||
SBPP_SQL_State_None = 0, | ||
SBPP_SQL_State_Connecting = 1 << 0, | ||
SBPP_SQL_State_Wait = 1 << 1, | ||
SBPP_SQL_State_Connected = 1 << 2, } |
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.
Indentation seems to be all over the place with this enum
SBPP_SQL_State_Wait = 1 << 1, | ||
SBPP_SQL_State_Connected = 1 << 2, } | ||
|
||
forward Action _SBPP_SQL_Find (Database &db, int &iState); |
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.
Nit, indentation.
stock Database g_dbSQL; | ||
stock static int s_iState; | ||
stock static bool s_bIgnoreForward; | ||
stock static ConnectCallback s_fnCallback; /* For now, Database.Connect() can't have function as pass data. */ | ||
stock static char s_szPrevError[PLATFORM_MAX_PATH]; | ||
stock static Handle s_hSBPP_SQL_Find, s_hSBPP_SQL_Close, s_hSBPP_SQL_Release; |
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.
What's the case here for defining symbol usage as stock? Also, this seems like a UB.
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.
If I understand your question correctly, stock
is not include if never used.
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.
But if they include that file, will it ever be not used?
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.
If someone forgets to call SBPP_SQL_Init()
.
I'm think build failed because don't set include dir (spcomp flag |
#undef REQUIRE_PLUGIN | ||
#include <sourcebanspp> | ||
#include <sourcebanspp> |
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.
Nit
Build fixed but It's not quite |
One connection for all plugins can be implemented too easy, if plugins will be connect to DB in single-thread. https://sm.alliedmods.net/new-api/dbi/SQL_Connect |
If i remember correctly, this function called from main game thread and should have caused a lag. |
When you starts plugin - what's the difference? Few people launch plugins when people play. These peoples should understand any risks related with starting plugin in the middle of the game. Yes, you remember correctly. This function really causes the lag. |
You are certainly right, loading plugins often causes lags. However, connection to database can occur at different times, including during important game events, if, for example, something happened with db / db server. Just as I mentioned above, this is something like a module that is designed to stop duplication of code from plugin to plugin. |
This reverts commit 05df755.
|
||
stock void SBPP_SQL_Init (const ConnectCallback fnCallback) | ||
{ | ||
LoadTranslations( "sbpp.sql.phrases.txt" ); |
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.
Seems unnecessary to add a separate translation file for one phrase, this would do better added into sbpp_main.phrases.txt
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.
Seems unnecessary to add a separate translation file for one phrase, this would do better added into
sbpp_main.phrases.txt
I planned that this module will be included not only in sbpp_main. Therefore, it would be nonsensical to add a dependency on sbpp_main translations, it is desirable that each plugin can work absolutely independently.
BuildPath( Path_SM, szLog, sizeof szLog, "logs/sbpp.log" ); | ||
BuildPath( Path_SM, szIssues, sizeof szIssues, "logs/sbpp.issues.log" ); |
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 change the name to sbpp.error.log
BuildPath( Path_SM, szLog, sizeof szLog, "logs/sbpp.log" ); | |
BuildPath( Path_SM, szIssues, sizeof szIssues, "logs/sbpp.issues.log" ); | |
BuildPath( Path_SM, szLog, sizeof szLog, "logs/sbpp.log" ); | |
BuildPath( Path_SM, szIssues, sizeof szIssues, "logs/sbpp.error.log" ); |
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.
Most of the errors are logged by sourcemod itself, most often there will be exactly problems there like can't connect to
or can't find file
.
My english is not perfect, but they should be called as issues
in this case, right?
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.
error
is the more universally adapted name, especially when it comes to logs and log levels. My intention behind that change is to make the naming more inline with SM and the other software stack that is needed to run SBPP (e.g nginx / Apache, PHP, etc) since they all use error
logs and not issue
logs.
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.
Renamed. (Absolute forgot about string)
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.
Renamed. Sorry for that.
Motivation and Context
Begin to break into modules for preventing duplication of code.
Also resolve #464.
How Has This Been Tested?
I tested it in different situations.
Types of changes
Checklist: