Make the "delay restart" button delay restart for 1 hour rather than aborting

it altogether. Allow a maximum of three uses before the restart goes through.
avinationmerge
Melanie 2012-06-07 16:32:07 +02:00
parent a945105003
commit e93308072e
3 changed files with 61 additions and 31 deletions

View File

@ -61,6 +61,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
public event ChangeDelegate OnEstateInfoChange; public event ChangeDelegate OnEstateInfoChange;
public event MessageDelegate OnEstateMessage; public event MessageDelegate OnEstateMessage;
private int m_delayCount = 0;
#region Packet Data Responders #region Packet Data Responders
private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice)
@ -259,7 +261,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
if (timeInSeconds == -1) if (timeInSeconds == -1)
{ {
restartModule.AbortRestart("Restart aborted by region manager"); m_delayCount++;
if (m_delayCount > 3)
return;
restartModule.DelayRestart(3600, "Restart delayed by region manager");
return; return;
} }

View File

@ -59,6 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Region
protected bool m_Notice = false; protected bool m_Notice = false;
protected IDialogModule m_DialogModule = null; protected IDialogModule m_DialogModule = null;
protected string m_MarkerPath = String.Empty; protected string m_MarkerPath = String.Empty;
private int[] m_CurrentAlerts = null;
public void Initialise(IConfigSource config) public void Initialise(IConfigSource config)
{ {
@ -141,6 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Region
m_Message = message; m_Message = message;
m_Initiator = initiator; m_Initiator = initiator;
m_Notice = notice; m_Notice = notice;
m_CurrentAlerts = alerts;
m_Alerts = new List<int>(alerts); m_Alerts = new List<int>(alerts);
m_Alerts.Sort(); m_Alerts.Sort();
m_Alerts.Reverse(); m_Alerts.Reverse();
@ -152,12 +154,12 @@ namespace OpenSim.Region.CoreModules.World.Region
return; return;
} }
int nextInterval = DoOneNotice(); int nextInterval = DoOneNotice(true);
SetTimer(nextInterval); SetTimer(nextInterval);
} }
public int DoOneNotice() public int DoOneNotice(bool sendOut)
{ {
if (m_Alerts.Count == 0 || m_Alerts[0] == 0) if (m_Alerts.Count == 0 || m_Alerts[0] == 0)
{ {
@ -182,6 +184,8 @@ namespace OpenSim.Region.CoreModules.World.Region
m_Alerts.RemoveAt(0); m_Alerts.RemoveAt(0);
if (sendOut)
{
int minutes = currentAlert / 60; int minutes = currentAlert / 60;
string currentAlertString = String.Empty; string currentAlertString = String.Empty;
if (minutes > 0) if (minutes > 0)
@ -211,6 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Region
else else
m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg); m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg);
} }
}
return currentAlert - nextAlert; return currentAlert - nextAlert;
} }
@ -226,7 +231,25 @@ namespace OpenSim.Region.CoreModules.World.Region
private void OnTimer(object source, ElapsedEventArgs e) private void OnTimer(object source, ElapsedEventArgs e)
{ {
int nextInterval = DoOneNotice(); int nextInterval = DoOneNotice(true);
SetTimer(nextInterval);
}
public void DelayRestart(int seconds, string message)
{
if (m_CountdownTimer == null)
return;
m_CountdownTimer.Stop();
m_CountdownTimer = null;
m_Alerts = new List<int>(m_CurrentAlerts);
m_Alerts.Add(seconds);
m_Alerts.Sort();
m_Alerts.Reverse();
int nextInterval = DoOneNotice(false);
SetTimer(nextInterval); SetTimer(nextInterval);
} }

View File

@ -35,5 +35,6 @@ namespace OpenSim.Region.Framework.Interfaces
TimeSpan TimeUntilRestart { get; } TimeSpan TimeUntilRestart { get; }
void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice); void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice);
void AbortRestart(string message); void AbortRestart(string message);
void DelayRestart(int seconds, string message);
} }
} }