Add error handling to catch the WebExceptions thrown if you have

no messaging server
0.6.1-post-fixes
Melanie Thielker 2008-11-23 00:36:39 +00:00
parent e082f10884
commit 0460c19bcd
1 changed files with 44 additions and 19 deletions

View File

@ -118,9 +118,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
public void OnConnectionClosed(IClientAPI client) public void OnConnectionClosed(IClientAPI client)
{ {
if (!(client.Scene is Scene))
return;
if (!(m_RootAgents.ContainsKey(client.AgentId))) if (!(m_RootAgents.ContainsKey(client.AgentId)))
return; return;
@ -151,6 +148,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName; xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName;
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(xmlrpcdata); SendParams.Add(xmlrpcdata);
try
{
XmlRpcRequest UpRequest = new XmlRpcRequest("region_startup", SendParams); XmlRpcRequest UpRequest = new XmlRpcRequest("region_startup", SendParams);
XmlRpcResponse resp = UpRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000); XmlRpcResponse resp = UpRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000);
@ -160,6 +159,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName); m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName);
} }
} }
catch (System.Net.WebException)
{
m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName);
}
}
private void NotifyMessageServerOfShutdown(Scene scene) private void NotifyMessageServerOfShutdown(Scene scene)
{ {
@ -167,6 +171,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName; xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName;
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(xmlrpcdata); SendParams.Add(xmlrpcdata);
try
{
XmlRpcRequest DownRequest = new XmlRpcRequest("region_shutdown", SendParams); XmlRpcRequest DownRequest = new XmlRpcRequest("region_shutdown", SendParams);
XmlRpcResponse resp = DownRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000); XmlRpcResponse resp = DownRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000);
@ -176,6 +182,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName); m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName);
} }
} }
catch (System.Net.WebException)
{
m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName);
}
}
private void NotifyMessageServerOfAgentLocation(UUID agentID, string region) private void NotifyMessageServerOfAgentLocation(UUID agentID, string region)
{ {
@ -184,6 +195,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
xmlrpcdata["RegionName"] = region; xmlrpcdata["RegionName"] = region;
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(xmlrpcdata); SendParams.Add(xmlrpcdata);
try
{
XmlRpcRequest LocationRequest = new XmlRpcRequest("agent_location", SendParams); XmlRpcRequest LocationRequest = new XmlRpcRequest("agent_location", SendParams);
XmlRpcResponse resp = LocationRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000); XmlRpcResponse resp = LocationRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000);
@ -193,6 +206,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent location for {0}", agentID.ToString()); m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent location for {0}", agentID.ToString());
} }
} }
catch (System.Net.WebException)
{
m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent location for {0}", agentID.ToString());
}
}
private void NotifyMessageServerOfAgentLeaving(UUID agentID, string region) private void NotifyMessageServerOfAgentLeaving(UUID agentID, string region)
{ {
@ -201,6 +219,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
xmlrpcdata["RegionName"] = region; xmlrpcdata["RegionName"] = region;
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(xmlrpcdata); SendParams.Add(xmlrpcdata);
try
{
XmlRpcRequest LeavingRequest = new XmlRpcRequest("agent_leaving", SendParams); XmlRpcRequest LeavingRequest = new XmlRpcRequest("agent_leaving", SendParams);
XmlRpcResponse resp = LeavingRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000); XmlRpcResponse resp = LeavingRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000);
@ -210,5 +230,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent leaving for {0}", agentID.ToString()); m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent leaving for {0}", agentID.ToString());
} }
} }
catch (System.Net.WebException)
{
m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent leaving for {0}", agentID.ToString());
}
}
} }
} }