API: Shutdown: Difference between revisions
Appearance
m →Termination: typo |
No edit summary |
||
| Line 18: | Line 18: | ||
##Save and unload PlayerDB | ##Save and unload PlayerDB | ||
##Save and unload IPBanList | ##Save and unload IPBanList | ||
##Set Environment.ExitCode to the appropriate ShutdownReason code. | |||
##''Server.ShutdownEnded'' | ##''Server.ShutdownEnded'' | ||
==Termination== | ==Termination== | ||
:ServerGUI does a clean shutdown on < | :ServerGUI does a clean shutdown on <code>WM_QUIT</code>/<code>WM_CLOSE</code> (<code>SIGTERM</code> on *nix). ServerCLI handles Ctrl+C and Ctrl+Break interrupts, but quits abruptly signals. | ||
: | :CLR does not provide a low-level way of handling signals/interrupts, but WinForms applications handle it internally, and call the Form.Closing event. Command-line applications just die. | ||
[[Category:Dev]] | [[Category:Dev]] | ||
Revision as of 23:56, 26 August 2012
When an fCraft server is being shut down, the following sequence of events takes place:
- Server.Shutdown
- Cancels any previous shutdown attempt.
- Verifies ShutdownParams
- Announces shutdown and starts the countdown.
After the timer elapses, Server.ShutdownNow (internal) is called on a separate thread:
- Server.ShutdownNow
- Server.ShutdownBegan
- Scheduler clears the list of tasks, and prevents future tasks from being added. Current task is allowed to finish.
- Stop listening for connections
- Kick all players, allow 1000ms to deliver the kick packet
- Disconnect IRC
- Save and unload all worlds
- Scheduler waits for current task to finish (if it is still running).
- Save and unload PlayerDB
- Save and unload IPBanList
- Set Environment.ExitCode to the appropriate ShutdownReason code.
- Server.ShutdownEnded
Termination
- ServerGUI does a clean shutdown on
WM_QUIT/WM_CLOSE(SIGTERMon *nix). ServerCLI handles Ctrl+C and Ctrl+Break interrupts, but quits abruptly signals. - CLR does not provide a low-level way of handling signals/interrupts, but WinForms applications handle it internally, and call the Form.Closing event. Command-line applications just die.