Make the messageing server re-register with all it's user servers every five

minutes. This ensures that things don't get messy if a user server is restarted
and the user server's operator has no control over the host the message servers
run on.
0.6.1-post-fixes
Melanie Thielker 2008-11-17 05:04:33 +00:00
parent 08b1e1a1f6
commit fa50156b4c
1 changed files with 11 additions and 1 deletions

View File

@ -29,8 +29,8 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Reflection;
using System.Threading; using System.Threading;
using System.Reflection;
using OpenMetaverse; using OpenMetaverse;
using log4net; using log4net;
using Nwc.XmlRpc; using Nwc.XmlRpc;
@ -52,6 +52,8 @@ namespace OpenSim.Grid.MessagingServer
// a dictionary of all current regions this server knows about // a dictionary of all current regions this server knows about
private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong,RegionProfileData>(); private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong,RegionProfileData>();
private System.Timers.Timer reconnectTimer = new System.Timers.Timer(300000); // 5 mins
public MessageService(MessageServerConfig cfg) public MessageService(MessageServerConfig cfg)
{ {
m_cfg = cfg; m_cfg = cfg;
@ -61,6 +63,9 @@ namespace OpenSim.Grid.MessagingServer
uc.DatabaseProvider = cfg.DatabaseProvider; uc.DatabaseProvider = cfg.DatabaseProvider;
m_userManager.AddPlugin(cfg.DatabaseProvider, cfg.DatabaseConnect); m_userManager.AddPlugin(cfg.DatabaseProvider, cfg.DatabaseConnect);
reconnectTimer.Elapsed += registerWithUserServer;
reconnectTimer.Start();
} }
@ -497,6 +502,11 @@ namespace OpenSim.Grid.MessagingServer
return regionProfile; return regionProfile;
} }
public void registerWithUserServer(object sender, System.Timers.ElapsedEventArgs e)
{
registerWithUserServer();
}
public bool registerWithUserServer () public bool registerWithUserServer ()
{ {
Hashtable UserParams = new Hashtable(); Hashtable UserParams = new Hashtable();