Skip to content

Native_Connect never returns false after successfully connected #20

Open
@ppalex7

Description

@ppalex7

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 :( )

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions