Aura.Channel.ChannelServer.Shutdown C# (CSharp) Method

Shutdown() public method

Shutdown procedure for the current channel.
public Shutdown ( int time ) : void
time int The amount of time in seconds until shutdown.
return void
		public void Shutdown(int time)
		{
			this.ShuttingDown = true;

			var channel = this.ServerList.GetChannel(this.Conf.Channel.ChannelServer, this.Conf.Channel.ChannelName);

			if (channel == null)
			{
				Log.Warning("Unregistered channel.");
			}
			else
			{
				channel.State = ChannelState.Maintenance;
				Send.Internal_ChannelStatus();
				Log.Info("{0} switched to maintenance.", this.Conf.Channel.ChannelName);
			}

			var notice = Localization.GetPlural(
				"The server will be brought down for maintenance in {0} second. Please log out safely before then.",
				"The server will be brought down for maintenance in {0} seconds. Please log out safely before then.",
				time
			);

			Send.Internal_Broadcast(string.Format(notice, time));
			Send.RequestClientDisconnect(time);

			// Add a few seconds, as `time` is the moment when all clients
			// send their DC request, because of RequestClientDisconnect.
			// The channel should shutdown *after* that's done. 10 seconds
			// should be plenty.
			time += 10;

			Log.Info("Shutting down in {0} seconds...", time);

			this.Timer.Change(time * 1000, Timeout.Infinite);
		}