C# Класс ACR_DatabaseConnector.DatabaseConnector

This class handles secure database transport connection management. In this implementation, a PLINK.EXE process is created and monitored for the SSH port forward used to access the central MySQL database server.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
DatabaseConnector ( CLRScriptFramework Script ) : System

Create a new DatabaseConnector object, which manages the secure tunnel to the database. If the tunnel is not enabled, then the object does nothing and returns immediately, otherwise, the tunnel process is started (and monitored and restarted in the event of a connection failure). In this case, the game server has two minutes to successfully connect to the tunnel or else the server process will be exited, because a game server does not function without a database being present during startup. During the wait for the database to come online, the logger queue is periodically written out by this module as the ACR_ServerCommunicator (which normally assumes responsibility for flushing the logger queue to the server log file) has not yet been initialized.

Приватные методы

Метод Описание
AssignProcessToJobObject ( IntPtr hJob, IntPtr hProcess ) : int
CloseHandle ( IntPtr hObject ) : int
ConfigureJob ( SafeWaitHandle Job ) : void

Configure a job object for use by the database connector. It is set up so that once the last job handle lapses, all of the processes joined to the job are terminated.

CreateJob ( ) : SafeWaitHandle

Create a job object.

CreateJobObject ( IntPtr lpJobAttributes, IntPtr lpName ) : IntPtr
CreateProcessA ( string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, int bInheritHandles, PROCESSCREATIONFLAGS dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, [ lpStartupInfo, PROCESS_INFORMATION &lpProcessInformation ) : int
CreateProcessInJob ( string ExeFileName, string CommandLine, SafeWaitHandle Job, bool BreakawayOk = false ) : Process

Create a process and attach it to a job. The process is resumed by the time the call returns if the call was successful.

DatabaseConnectionMonitorThread ( ) : void

The thread procedure for the thread that monitors the PLINK.EXE instance that provides a secure SSH port forward to the MySQL database. Initially, it creates a PLINK.EXE process, and from that point it ensures that if the PLINK.EXE process closes, that a new process is started to connect out to the database automatically in the event of a temporary connectivity interruption.

ExtractResource ( string FileName, byte ResourceData ) : string

Extract a resource to disk.

GetCurrentProcess ( ) : IntPtr
GetTunnelProcessCmdLine ( ) : string

Get the command line used to launch the secure tunnel manager process (i.e., PLINK.EXE).

ResumeThread ( IntPtr hThread ) : uint
SetInformationJobObject ( IntPtr hJob, JOBOBJECTINFOCLASS JobObjectInfoClass, IntPtr lpJobObjectInfo, uint cbJobObjectInfoLength ) : int
TerminateProcess ( IntPtr hProcess, uint uExitCode ) : int

Описание методов

DatabaseConnector() публичный Метод

Create a new DatabaseConnector object, which manages the secure tunnel to the database. If the tunnel is not enabled, then the object does nothing and returns immediately, otherwise, the tunnel process is started (and monitored and restarted in the event of a connection failure). In this case, the game server has two minutes to successfully connect to the tunnel or else the server process will be exited, because a game server does not function without a database being present during startup. During the wait for the database to come online, the logger queue is periodically written out by this module as the ACR_ServerCommunicator (which normally assumes responsibility for flushing the logger queue to the server log file) has not yet been initialized.
public DatabaseConnector ( CLRScriptFramework Script ) : System
Script CLRScriptFramework Supplies a script object used to access the /// NWScript API.
Результат System