diff options
author | Dr Scofield | 2009-01-28 09:22:12 +0000 |
---|---|---|
committer | Dr Scofield | 2009-01-28 09:22:12 +0000 |
commit | a3ac702941bbae92ca5a3ed452eb3d417bf30f0b (patch) | |
tree | 3a827866b274b86447cc7b2237a7182d95270879 /OpenSim/Region/Environment/Modules | |
parent | Add in a stub for llSHA1String. I believe it is the only one new (diff) | |
download | opensim-SC_OLD-a3ac702941bbae92ca5a3ed452eb3d417bf30f0b.zip opensim-SC_OLD-a3ac702941bbae92ca5a3ed452eb3d417bf30f0b.tar.gz opensim-SC_OLD-a3ac702941bbae92ca5a3ed452eb3d417bf30f0b.tar.bz2 opensim-SC_OLD-a3ac702941bbae92ca5a3ed452eb3d417bf30f0b.tar.xz |
From: Christopher Yeoh <yeohc@au1.ibm.com>
Adding Oarfileloaded and EmptyScriptCompileQueue event support which
allows (with a module) for programmatic notification of when a region
objects and scripts are up and running after a server start or
load-oar.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | 92 |
1 files changed, 55 insertions, 37 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index ce293e4..ee4323c 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -53,6 +53,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
53 | 53 | ||
54 | private Scene m_scene; | 54 | private Scene m_scene; |
55 | private Stream m_loadStream; | 55 | private Stream m_loadStream; |
56 | private string m_errorMessage; | ||
56 | 57 | ||
57 | /// <summary> | 58 | /// <summary> |
58 | /// Used to cache lookups for valid uuids. | 59 | /// Used to cache lookups for valid uuids. |
@@ -63,6 +64,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
63 | { | 64 | { |
64 | m_scene = scene; | 65 | m_scene = scene; |
65 | m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); | 66 | m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); |
67 | m_errorMessage = String.Empty; | ||
66 | } | 68 | } |
67 | 69 | ||
68 | public ArchiveReadRequest(Scene scene, Stream loadStream) | 70 | public ArchiveReadRequest(Scene scene, Stream loadStream) |
@@ -82,62 +84,76 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
82 | 84 | ||
83 | private void DearchiveRegion0DotStar() | 85 | private void DearchiveRegion0DotStar() |
84 | { | 86 | { |
85 | TarArchiveReader archive = new TarArchiveReader(m_loadStream); | 87 | int successfulAssetRestores = 0; |
88 | int failedAssetRestores = 0; | ||
89 | List<string> serialisedSceneObjects = new List<string>(); | ||
86 | 90 | ||
87 | //AssetsDearchiver dearchiver = new AssetsDearchiver(m_scene.AssetCache); | 91 | try |
92 | { | ||
93 | TarArchiveReader archive = new TarArchiveReader(m_loadStream); | ||
88 | 94 | ||
89 | List<string> serialisedSceneObjects = new List<string>(); | 95 | //AssetsDearchiver dearchiver = new AssetsDearchiver(m_scene.AssetCache); |
90 | string filePath = "ERROR"; | ||
91 | 96 | ||
92 | int successfulAssetRestores = 0; | 97 | string filePath = "ERROR"; |
93 | int failedAssetRestores = 0; | ||
94 | 98 | ||
95 | byte[] data; | 99 | byte[] data; |
96 | TarArchiveReader.TarEntryType entryType; | 100 | TarArchiveReader.TarEntryType entryType; |
97 | 101 | ||
98 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) | 102 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) |
99 | { | ||
100 | //m_log.DebugFormat( | ||
101 | // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length); | ||
102 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) | ||
103 | { | 103 | { |
104 | m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}", | 104 | //m_log.DebugFormat( |
105 | filePath); | 105 | // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length); |
106 | } | 106 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) |
107 | else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) | 107 | { |
108 | { | 108 | m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}", |
109 | serialisedSceneObjects.Add(m_asciiEncoding.GetString(data)); | 109 | filePath); |
110 | } | 110 | } |
111 | else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) | ||
112 | { | ||
113 | serialisedSceneObjects.Add(m_asciiEncoding.GetString(data)); | ||
114 | } | ||
111 | // else if (filePath.Equals(ArchiveConstants.ASSETS_METADATA_PATH)) | 115 | // else if (filePath.Equals(ArchiveConstants.ASSETS_METADATA_PATH)) |
112 | // { | 116 | // { |
113 | // string xml = m_asciiEncoding.GetString(data); | 117 | // string xml = m_asciiEncoding.GetString(data); |
114 | // dearchiver.AddAssetMetadata(xml); | 118 | // dearchiver.AddAssetMetadata(xml); |
115 | // } | 119 | // } |
116 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | 120 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) |
117 | { | 121 | { |
118 | if (LoadAsset(filePath, data)) | 122 | if (LoadAsset(filePath, data)) |
119 | successfulAssetRestores++; | 123 | successfulAssetRestores++; |
120 | else | 124 | else |
121 | failedAssetRestores++; | 125 | failedAssetRestores++; |
122 | } | 126 | } |
123 | else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH)) | 127 | else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH)) |
124 | { | 128 | { |
125 | LoadTerrain(filePath, data); | 129 | LoadTerrain(filePath, data); |
126 | } | 130 | } |
127 | else if (filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) | 131 | else if (filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) |
128 | { | 132 | { |
129 | LoadRegionSettings(filePath, data); | 133 | LoadRegionSettings(filePath, data); |
134 | } | ||
130 | } | 135 | } |
131 | } | ||
132 | 136 | ||
133 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); | 137 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); |
134 | 138 | ||
135 | archive.Close(); | 139 | archive.Close(); |
140 | } | ||
141 | catch (Exception e) | ||
142 | { | ||
143 | m_log.ErrorFormat( | ||
144 | "[ARCHIVER]: Error loading oar file. Exception was: {0}", e); | ||
145 | m_errorMessage += e.ToString(); | ||
146 | m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage); | ||
147 | return; | ||
148 | } | ||
136 | 149 | ||
137 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); | 150 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); |
138 | 151 | ||
139 | if (failedAssetRestores > 0) | 152 | if (failedAssetRestores > 0) |
153 | { | ||
140 | m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); | 154 | m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); |
155 | m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); | ||
156 | } | ||
141 | 157 | ||
142 | m_log.Info("[ARCHIVER]: Clearing all existing scene objects"); | 158 | m_log.Info("[ARCHIVER]: Clearing all existing scene objects"); |
143 | m_scene.DeleteAllSceneObjects(); | 159 | m_scene.DeleteAllSceneObjects(); |
@@ -217,6 +233,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
217 | { | 233 | { |
218 | sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); | 234 | sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); |
219 | } | 235 | } |
236 | m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage); | ||
237 | |||
220 | } | 238 | } |
221 | 239 | ||
222 | /// <summary> | 240 | /// <summary> |