Skip to content
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

Native_Connect never returns false after successfully connected #20

Open
ppalex7 opened this issue Nov 2, 2013 · 0 comments · May be fixed by #30
Open

Native_Connect never returns false after successfully connected #20

ppalex7 opened this issue Nov 2, 2013 · 0 comments · May be fixed by #30

Comments

@ppalex7
Copy link
Contributor

ppalex7 commented Nov 2, 2013

Native_Connect native doesn't work properly to checking that sourcebans plugin is connected to db if plugin successfully connected to database at start, and then database goes down.

In this case, SB_Connect still returns "true", because g_hDatabase has "valid" value.
For example, I added this code to Query_ExecuteCallback:
PrintToServer("EXECUTE CALLBACK: hDatabase %d, owner %d, hndl %d, error: %s", g_hDatabase, owner, hndl, error); I start game server with sourcebans, and then - stop mysql server and join to server. I get in server console:
EXECUTE CALLBACK: hDatabase 9502860, owner 12517521, hndl 0, error: Can't connect to MySQL server on '127.0.0.1' (111)
And later, each SB_Connect call returns true, with this error. This is not the expected behavior.

It will be great (for properly SB_Connect working), if you add to sourcebans plugin native, that can manually close g_hDatabase handle and set g_iDatabaseState to DatabaseState_None). Or you can add this functionality to ExecuteCallback (check hndl for zero value, but hndl equals to zero even for sql syntax errors :( )

ppalex7 pushed a commit to ppalex7/SourceBans that referenced this issue Jan 25, 2014
@ghost ghost mentioned this issue Mar 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant