aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-27 22:53:02 +0100
committerJustin Clark-Casey (justincc)2010-08-27 22:53:02 +0100
commitb4278510f2244c46dc91568998ffe53a74fc5314 (patch)
treedae93b72ed613b119b748413fa8bf11218ddb69d /OpenSim
parentrefactor: Make IAR tests set up standard iar for loading (diff)
parentMerge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-b4278510f2244c46dc91568998ffe53a74fc5314.zip
opensim-SC-b4278510f2244c46dc91568998ffe53a74fc5314.tar.gz
opensim-SC-b4278510f2244c46dc91568998ffe53a74fc5314.tar.bz2
opensim-SC-b4278510f2244c46dc91568998ffe53a74fc5314.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs5
-rw-r--r--OpenSim/Region/DataSnapshot/SnapshotStore.cs48
2 files changed, 40 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 677bd14..34cc7d9 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2728,6 +2728,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2728 DirPlacesReplyPacket.StatusDataBlock[] status = 2728 DirPlacesReplyPacket.StatusDataBlock[] status =
2729 new DirPlacesReplyPacket.StatusDataBlock[0]; 2729 new DirPlacesReplyPacket.StatusDataBlock[0];
2730 2730
2731 packet.QueryReplies = replies;
2732 packet.StatusData = status;
2733
2731 foreach (DirPlacesReplyData d in data) 2734 foreach (DirPlacesReplyData d in data)
2732 { 2735 {
2733 int idx = replies.Length; 2736 int idx = replies.Length;
@@ -2766,7 +2769,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2766 } 2769 }
2767 } 2770 }
2768 2771
2769 if (replies.Length > 0) 2772 if (replies.Length > 0 || data.Length == 0)
2770 OutPacket(packet, ThrottleOutPacketType.Task); 2773 OutPacket(packet, ThrottleOutPacketType.Task);
2771 } 2774 }
2772 2775
diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs
index 70cb205..aa3d2ff 100644
--- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs
+++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Text; 32using System.Text;
33using System.Text.RegularExpressions;
33using System.Xml; 34using System.Xml;
34using log4net; 35using log4net;
35using OpenSim.Region.DataSnapshot.Interfaces; 36using OpenSim.Region.DataSnapshot.Interfaces;
@@ -98,13 +99,21 @@ namespace OpenSim.Region.DataSnapshot
98 { 99 {
99 String path = DataFileNameFragment(provider.GetParentScene, provider.Name); 100 String path = DataFileNameFragment(provider.GetParentScene, provider.Name);
100 101
101 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default)) 102 try
102 { 103 {
103 snapXWriter.Formatting = Formatting.Indented; 104 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
104 snapXWriter.WriteStartDocument(); 105 {
105 data.WriteTo(snapXWriter); 106 snapXWriter.Formatting = Formatting.Indented;
106 snapXWriter.WriteEndDocument(); 107 snapXWriter.WriteStartDocument();
108 data.WriteTo(snapXWriter);
109 snapXWriter.WriteEndDocument();
110 }
111 }
112 catch (Exception e)
113 {
114 m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
107 } 115 }
116
108 } 117 }
109 118
110 //mark provider as not stale, parent scene as stale 119 //mark provider as not stale, parent scene as stale
@@ -185,12 +194,19 @@ namespace OpenSim.Region.DataSnapshot
185 //save snapshot 194 //save snapshot
186 String path = DataFileNameScene(scene); 195 String path = DataFileNameScene(scene);
187 196
188 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default)) 197 try
198 {
199 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
200 {
201 snapXWriter.Formatting = Formatting.Indented;
202 snapXWriter.WriteStartDocument();
203 regionElement.WriteTo(snapXWriter);
204 snapXWriter.WriteEndDocument();
205 }
206 }
207 catch (Exception e)
189 { 208 {
190 snapXWriter.Formatting = Formatting.Indented; 209 m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
191 snapXWriter.WriteStartDocument();
192 regionElement.WriteTo(snapXWriter);
193 snapXWriter.WriteEndDocument();
194 } 210 }
195 211
196 m_scenes[scene] = false; 212 m_scenes[scene] = false;
@@ -206,15 +222,23 @@ namespace OpenSim.Region.DataSnapshot
206 #region Helpers 222 #region Helpers
207 private string DataFileNameFragment(Scene scene, String fragmentName) 223 private string DataFileNameFragment(Scene scene, String fragmentName)
208 { 224 {
209 return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName + "_" + fragmentName, "xml")); 225 return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName + "_" + fragmentName), "xml"));
210 } 226 }
211 227
212 private string DataFileNameScene(Scene scene) 228 private string DataFileNameScene(Scene scene)
213 { 229 {
214 return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName, "xml")); 230 return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName), "xml"));
215 //return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml"); 231 //return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml");
216 } 232 }
217 233
234 private static string Sanitize(string name)
235 {
236 string invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars()));
237 string invalidReStr = string.Format(@"[{0}]", invalidChars);
238 string newname = Regex.Replace(name, invalidReStr, "_");
239 return newname.Replace('.', '_');
240 }
241
218 private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc) 242 private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc)
219 { 243 {
220 XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", ""); 244 XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", "");