aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-23 00:36:39 +0000
committerMelanie Thielker2008-11-23 00:36:39 +0000
commit0460c19bcd690a8e3922f46c42f50cdca06b85d1 (patch)
tree98b9514d5fca76b803e43e532ea86e5ae947261e /OpenSim
parentAdding root agent position messages to the message server (diff)
downloadopensim-SC_OLD-0460c19bcd690a8e3922f46c42f50cdca06b85d1.zip
opensim-SC_OLD-0460c19bcd690a8e3922f46c42f50cdca06b85d1.tar.gz
opensim-SC_OLD-0460c19bcd690a8e3922f46c42f50cdca06b85d1.tar.bz2
opensim-SC_OLD-0460c19bcd690a8e3922f46c42f50cdca06b85d1.tar.xz
Add error handling to catch the WebExceptions thrown if you have
no messaging server
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs71
1 files changed, 48 insertions, 23 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs
index 1b18f3c..aa1db1d 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs
@@ -118,9 +118,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
118 118
119 public void OnConnectionClosed(IClientAPI client) 119 public void OnConnectionClosed(IClientAPI client)
120 { 120 {
121 if (!(client.Scene is Scene))
122 return;
123
124 if (!(m_RootAgents.ContainsKey(client.AgentId))) 121 if (!(m_RootAgents.ContainsKey(client.AgentId)))
125 return; 122 return;
126 123
@@ -151,11 +148,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
151 xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName; 148 xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName;
152 ArrayList SendParams = new ArrayList(); 149 ArrayList SendParams = new ArrayList();
153 SendParams.Add(xmlrpcdata); 150 SendParams.Add(xmlrpcdata);
154 XmlRpcRequest UpRequest = new XmlRpcRequest("region_startup", SendParams); 151 try
155 XmlRpcResponse resp = UpRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000); 152 {
156 153 XmlRpcRequest UpRequest = new XmlRpcRequest("region_startup", SendParams);
157 Hashtable responseData = (Hashtable)resp.Value; 154 XmlRpcResponse resp = UpRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000);
158 if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") 155
156 Hashtable responseData = (Hashtable)resp.Value;
157 if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
158 {
159 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName);
160 }
161 }
162 catch (System.Net.WebException)
159 { 163 {
160 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName); 164 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName);
161 } 165 }
@@ -167,11 +171,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
167 xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName; 171 xmlrpcdata["RegionName"] = scene.RegionInfo.RegionName;
168 ArrayList SendParams = new ArrayList(); 172 ArrayList SendParams = new ArrayList();
169 SendParams.Add(xmlrpcdata); 173 SendParams.Add(xmlrpcdata);
170 XmlRpcRequest DownRequest = new XmlRpcRequest("region_shutdown", SendParams); 174 try
171 XmlRpcResponse resp = DownRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000); 175 {
172 176 XmlRpcRequest DownRequest = new XmlRpcRequest("region_shutdown", SendParams);
173 Hashtable responseData = (Hashtable)resp.Value; 177 XmlRpcResponse resp = DownRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000);
174 if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") 178
179 Hashtable responseData = (Hashtable)resp.Value;
180 if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
181 {
182 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName);
183 }
184 }
185 catch (System.Net.WebException)
175 { 186 {
176 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName); 187 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName);
177 } 188 }
@@ -184,11 +195,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
184 xmlrpcdata["RegionName"] = region; 195 xmlrpcdata["RegionName"] = region;
185 ArrayList SendParams = new ArrayList(); 196 ArrayList SendParams = new ArrayList();
186 SendParams.Add(xmlrpcdata); 197 SendParams.Add(xmlrpcdata);
187 XmlRpcRequest LocationRequest = new XmlRpcRequest("agent_location", SendParams); 198 try
188 XmlRpcResponse resp = LocationRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000); 199 {
189 200 XmlRpcRequest LocationRequest = new XmlRpcRequest("agent_location", SendParams);
190 Hashtable responseData = (Hashtable)resp.Value; 201 XmlRpcResponse resp = LocationRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000);
191 if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") 202
203 Hashtable responseData = (Hashtable)resp.Value;
204 if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
205 {
206 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent location for {0}", agentID.ToString());
207 }
208 }
209 catch (System.Net.WebException)
192 { 210 {
193 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent location for {0}", agentID.ToString()); 211 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent location for {0}", agentID.ToString());
194 } 212 }
@@ -201,11 +219,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
201 xmlrpcdata["RegionName"] = region; 219 xmlrpcdata["RegionName"] = region;
202 ArrayList SendParams = new ArrayList(); 220 ArrayList SendParams = new ArrayList();
203 SendParams.Add(xmlrpcdata); 221 SendParams.Add(xmlrpcdata);
204 XmlRpcRequest LeavingRequest = new XmlRpcRequest("agent_leaving", SendParams); 222 try
205 XmlRpcResponse resp = LeavingRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000); 223 {
206 224 XmlRpcRequest LeavingRequest = new XmlRpcRequest("agent_leaving", SendParams);
207 Hashtable responseData = (Hashtable)resp.Value; 225 XmlRpcResponse resp = LeavingRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000);
208 if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE") 226
227 Hashtable responseData = (Hashtable)resp.Value;
228 if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
229 {
230 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent leaving for {0}", agentID.ToString());
231 }
232 }
233 catch (System.Net.WebException)
209 { 234 {
210 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent leaving for {0}", agentID.ToString()); 235 m_log.ErrorFormat("[PRESENCE] Failed to notify message server of agent leaving for {0}", agentID.ToString());
211 } 236 }