diff options
Diffstat (limited to 'OpenSim')
13 files changed, 527 insertions, 54 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs new file mode 100644 index 0000000..9f78948 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using Mono.Addins; | ||
34 | using OpenMetaverse; | ||
35 | using OpenMetaverse.StructuredData; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
42 | |||
43 | namespace OpenSim.Region.ClientStack.Linden | ||
44 | { | ||
45 | /// <summary> | ||
46 | /// SimulatorFeatures capability. This is required for uploading Mesh. | ||
47 | /// Since is accepts an open-ended response, we also send more information | ||
48 | /// for viewers that care to interpret it. | ||
49 | /// | ||
50 | /// NOTE: Part of this code was adapted from the Aurora project, specifically | ||
51 | /// the normal part of the response in the capability handler. | ||
52 | /// </summary> | ||
53 | /// | ||
54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
55 | public class SimulatorFeaturesModule : ISharedRegionModule | ||
56 | { | ||
57 | private static readonly ILog m_log = | ||
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
59 | private Scene m_scene; | ||
60 | |||
61 | private string m_MapImageServerURL = string.Empty; | ||
62 | private string m_SearchURL = string.Empty; | ||
63 | |||
64 | #region ISharedRegionModule Members | ||
65 | |||
66 | public void Initialise(IConfigSource source) | ||
67 | { | ||
68 | IConfig config = source.Configs["SimulatorFeatures"]; | ||
69 | if (config == null) | ||
70 | return; | ||
71 | |||
72 | m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty); | ||
73 | if (m_MapImageServerURL != string.Empty) | ||
74 | { | ||
75 | m_MapImageServerURL = m_MapImageServerURL.Trim(); | ||
76 | if (!m_MapImageServerURL.EndsWith("/")) | ||
77 | m_MapImageServerURL = m_MapImageServerURL + "/"; | ||
78 | } | ||
79 | |||
80 | m_SearchURL = config.GetString("SearchServerURI", string.Empty); | ||
81 | } | ||
82 | |||
83 | public void AddRegion(Scene s) | ||
84 | { | ||
85 | m_scene = s; | ||
86 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
87 | } | ||
88 | |||
89 | public void RemoveRegion(Scene s) | ||
90 | { | ||
91 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | ||
92 | } | ||
93 | |||
94 | public void RegionLoaded(Scene s) | ||
95 | { | ||
96 | } | ||
97 | |||
98 | public void PostInitialise() | ||
99 | { | ||
100 | } | ||
101 | |||
102 | public void Close() { } | ||
103 | |||
104 | public string Name { get { return "SimulatorFeaturesModule"; } } | ||
105 | |||
106 | public Type ReplaceableInterface | ||
107 | { | ||
108 | get { return null; } | ||
109 | } | ||
110 | |||
111 | #endregion | ||
112 | |||
113 | public void RegisterCaps(UUID agentID, Caps caps) | ||
114 | { | ||
115 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), SimulatorFeatures); | ||
116 | caps.RegisterHandler("SimulatorFeatures", reqHandler); | ||
117 | } | ||
118 | |||
119 | private Hashtable SimulatorFeatures(Hashtable mDhttpMethod) | ||
120 | { | ||
121 | m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); | ||
122 | OSDMap data = new OSDMap(); | ||
123 | data["MeshRezEnabled"] = true; | ||
124 | data["MeshUploadEnabled"] = true; | ||
125 | data["MeshXferEnabled"] = true; | ||
126 | data["PhysicsMaterialsEnabled"] = true; | ||
127 | |||
128 | OSDMap typesMap = new OSDMap(); | ||
129 | typesMap["convex"] = true; | ||
130 | typesMap["none"] = true; | ||
131 | typesMap["prim"] = true; | ||
132 | data["PhysicsShapeTypes"] = typesMap; | ||
133 | |||
134 | // Extra information for viewers that want to use it | ||
135 | OSDMap gridServicesMap = new OSDMap(); | ||
136 | if (m_MapImageServerURL != string.Empty) | ||
137 | gridServicesMap["map-server-url"] = m_MapImageServerURL; | ||
138 | if (m_SearchURL != string.Empty) | ||
139 | gridServicesMap["search"] = m_SearchURL; | ||
140 | data["GridServices"] = gridServicesMap; | ||
141 | |||
142 | //Send back data | ||
143 | Hashtable responsedata = new Hashtable(); | ||
144 | responsedata["int_response_code"] = 200; | ||
145 | responsedata["content_type"] = "text/plain"; | ||
146 | responsedata["keepalive"] = false; | ||
147 | responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data); | ||
148 | return responsedata; | ||
149 | } | ||
150 | |||
151 | } | ||
152 | } | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 93657a8..63fde07 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -146,6 +146,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
146 | 146 | ||
147 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) | 147 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) |
148 | { | 148 | { |
149 | if (options.ContainsKey("verbose")) | ||
150 | m_log.InfoFormat( | ||
151 | "[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}", | ||
152 | inventoryItem.ID, inventoryItem.Name, inventoryItem.AssetID); | ||
153 | |||
149 | string filename = path + CreateArchiveItemName(inventoryItem); | 154 | string filename = path + CreateArchiveItemName(inventoryItem); |
150 | 155 | ||
151 | // Record the creator of this item for user record purposes (which might go away soon) | 156 | // Record the creator of this item for user record purposes (which might go away soon) |
@@ -441,4 +446,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
441 | return s; | 446 | return s; |
442 | } | 447 | } |
443 | } | 448 | } |
444 | } \ No newline at end of file | 449 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs new file mode 100644 index 0000000..786e0b5 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs | |||
@@ -0,0 +1,137 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Reflection; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Services.Interfaces; | ||
32 | using OpenMetaverse; | ||
33 | using log4net; | ||
34 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
35 | |||
36 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | ||
37 | { | ||
38 | public class RegionInfoCache | ||
39 | { | ||
40 | private const double CACHE_EXPIRATION_SECONDS = 300.0; // 5 minutes | ||
41 | |||
42 | // private static readonly ILog m_log = | ||
43 | // LogManager.GetLogger( | ||
44 | // MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | internal struct ScopedRegionUUID | ||
47 | { | ||
48 | public UUID m_scopeID; | ||
49 | public UUID m_regionID; | ||
50 | public ScopedRegionUUID(UUID scopeID, UUID regionID) | ||
51 | { | ||
52 | m_scopeID = scopeID; | ||
53 | m_regionID = regionID; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | internal struct ScopedRegionName | ||
58 | { | ||
59 | public UUID m_scopeID; | ||
60 | public string m_name; | ||
61 | public ScopedRegionName(UUID scopeID, string name) | ||
62 | { | ||
63 | m_scopeID = scopeID; | ||
64 | m_name = name; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | private ExpiringCache<ScopedRegionUUID, GridRegion> m_UUIDCache; | ||
69 | private ExpiringCache<ScopedRegionName, ScopedRegionUUID> m_NameCache; | ||
70 | |||
71 | public RegionInfoCache() | ||
72 | { | ||
73 | m_UUIDCache = new ExpiringCache<ScopedRegionUUID, GridRegion>(); | ||
74 | m_NameCache = new ExpiringCache<ScopedRegionName, ScopedRegionUUID>(); | ||
75 | } | ||
76 | |||
77 | public void Cache(GridRegion rinfo) | ||
78 | { | ||
79 | if (rinfo != null) | ||
80 | this.Cache(rinfo.ScopeID,rinfo.RegionID,rinfo); | ||
81 | } | ||
82 | |||
83 | public void Cache(UUID scopeID, UUID regionID, GridRegion rinfo) | ||
84 | { | ||
85 | // for now, do not cache negative results; this is because | ||
86 | // we need to figure out how to handle regions coming online | ||
87 | // in a timely way | ||
88 | if (rinfo == null) | ||
89 | return; | ||
90 | |||
91 | ScopedRegionUUID id = new ScopedRegionUUID(scopeID,regionID); | ||
92 | |||
93 | // Cache even null accounts | ||
94 | m_UUIDCache.AddOrUpdate(id, rinfo, CACHE_EXPIRATION_SECONDS); | ||
95 | if (rinfo != null) | ||
96 | { | ||
97 | ScopedRegionName name = new ScopedRegionName(scopeID,rinfo.RegionName); | ||
98 | m_NameCache.AddOrUpdate(name, id, CACHE_EXPIRATION_SECONDS); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public GridRegion Get(UUID scopeID, UUID regionID, out bool inCache) | ||
103 | { | ||
104 | inCache = false; | ||
105 | |||
106 | GridRegion rinfo = null; | ||
107 | ScopedRegionUUID id = new ScopedRegionUUID(scopeID,regionID); | ||
108 | if (m_UUIDCache.TryGetValue(id, out rinfo)) | ||
109 | { | ||
110 | inCache = true; | ||
111 | return rinfo; | ||
112 | } | ||
113 | |||
114 | return null; | ||
115 | } | ||
116 | |||
117 | public GridRegion Get(UUID scopeID, string name, out bool inCache) | ||
118 | { | ||
119 | inCache = false; | ||
120 | |||
121 | ScopedRegionName sname = new ScopedRegionName(scopeID,name); | ||
122 | |||
123 | ScopedRegionUUID id; | ||
124 | if (m_NameCache.TryGetValue(sname, out id)) | ||
125 | { | ||
126 | GridRegion rinfo = null; | ||
127 | if (m_UUIDCache.TryGetValue(id, out rinfo)) | ||
128 | { | ||
129 | inCache = true; | ||
130 | return rinfo; | ||
131 | } | ||
132 | } | ||
133 | |||
134 | return null; | ||
135 | } | ||
136 | } | ||
137 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 33cc838..6f364ae 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs | |||
@@ -53,6 +53,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
53 | private IGridService m_LocalGridService; | 53 | private IGridService m_LocalGridService; |
54 | private IGridService m_RemoteGridService; | 54 | private IGridService m_RemoteGridService; |
55 | 55 | ||
56 | private RegionInfoCache m_RegionInfoCache = new RegionInfoCache(); | ||
57 | |||
56 | public RemoteGridServicesConnector() | 58 | public RemoteGridServicesConnector() |
57 | { | 59 | { |
58 | } | 60 | } |
@@ -169,10 +171,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
169 | 171 | ||
170 | public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) | 172 | public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) |
171 | { | 173 | { |
172 | GridRegion rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID); | 174 | bool inCache = false; |
175 | GridRegion rinfo = m_RegionInfoCache.Get(scopeID,regionID,out inCache); | ||
176 | if (inCache) | ||
177 | return rinfo; | ||
178 | |||
179 | rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID); | ||
173 | if (rinfo == null) | 180 | if (rinfo == null) |
174 | rinfo = m_RemoteGridService.GetRegionByUUID(scopeID, regionID); | 181 | rinfo = m_RemoteGridService.GetRegionByUUID(scopeID, regionID); |
175 | 182 | ||
183 | m_RegionInfoCache.Cache(scopeID,regionID,rinfo); | ||
176 | return rinfo; | 184 | return rinfo; |
177 | } | 185 | } |
178 | 186 | ||
@@ -187,10 +195,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
187 | 195 | ||
188 | public GridRegion GetRegionByName(UUID scopeID, string regionName) | 196 | public GridRegion GetRegionByName(UUID scopeID, string regionName) |
189 | { | 197 | { |
190 | GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); | 198 | bool inCache = false; |
199 | GridRegion rinfo = m_RegionInfoCache.Get(scopeID,regionName, out inCache); | ||
200 | if (inCache) | ||
201 | return rinfo; | ||
202 | |||
203 | rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); | ||
191 | if (rinfo == null) | 204 | if (rinfo == null) |
192 | rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); | 205 | rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); |
193 | 206 | ||
207 | // can't cache negative results for name lookups | ||
208 | m_RegionInfoCache.Cache(rinfo); | ||
194 | return rinfo; | 209 | return rinfo; |
195 | } | 210 | } |
196 | 211 | ||
@@ -204,8 +219,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
204 | { | 219 | { |
205 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionsByName {0} found {1} regions", name, grinfo.Count); | 220 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionsByName {0} found {1} regions", name, grinfo.Count); |
206 | foreach (GridRegion r in grinfo) | 221 | foreach (GridRegion r in grinfo) |
222 | { | ||
223 | m_RegionInfoCache.Cache(r); | ||
207 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) | 224 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) |
208 | rinfo.Add(r); | 225 | rinfo.Add(r); |
226 | } | ||
209 | } | 227 | } |
210 | 228 | ||
211 | return rinfo; | 229 | return rinfo; |
@@ -221,8 +239,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
221 | { | 239 | { |
222 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionRange {0} found {1} regions", name, grinfo.Count); | 240 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionRange {0} found {1} regions", name, grinfo.Count); |
223 | foreach (GridRegion r in grinfo) | 241 | foreach (GridRegion r in grinfo) |
242 | { | ||
243 | m_RegionInfoCache.Cache(r); | ||
224 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) | 244 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) |
225 | rinfo.Add(r); | 245 | rinfo.Add(r); |
246 | } | ||
226 | } | 247 | } |
227 | 248 | ||
228 | return rinfo; | 249 | return rinfo; |
@@ -238,8 +259,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
238 | { | 259 | { |
239 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetDefaultRegions {0} found {1} regions", name, grinfo.Count); | 260 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetDefaultRegions {0} found {1} regions", name, grinfo.Count); |
240 | foreach (GridRegion r in grinfo) | 261 | foreach (GridRegion r in grinfo) |
262 | { | ||
263 | m_RegionInfoCache.Cache(r); | ||
241 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) | 264 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) |
242 | rinfo.Add(r); | 265 | rinfo.Add(r); |
266 | } | ||
243 | } | 267 | } |
244 | 268 | ||
245 | return rinfo; | 269 | return rinfo; |
@@ -255,8 +279,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
255 | { | 279 | { |
256 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetFallbackRegions {0} found {1} regions", name, grinfo.Count); | 280 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetFallbackRegions {0} found {1} regions", name, grinfo.Count); |
257 | foreach (GridRegion r in grinfo) | 281 | foreach (GridRegion r in grinfo) |
282 | { | ||
283 | m_RegionInfoCache.Cache(r); | ||
258 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) | 284 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) |
259 | rinfo.Add(r); | 285 | rinfo.Add(r); |
286 | } | ||
260 | } | 287 | } |
261 | 288 | ||
262 | return rinfo; | 289 | return rinfo; |
@@ -272,8 +299,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
272 | { | 299 | { |
273 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetHyperlinks {0} found {1} regions", name, grinfo.Count); | 300 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetHyperlinks {0} found {1} regions", name, grinfo.Count); |
274 | foreach (GridRegion r in grinfo) | 301 | foreach (GridRegion r in grinfo) |
302 | { | ||
303 | m_RegionInfoCache.Cache(r); | ||
275 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) | 304 | if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null) |
276 | rinfo.Add(r); | 305 | rinfo.Add(r); |
306 | } | ||
277 | } | 307 | } |
278 | 308 | ||
279 | return rinfo; | 309 | return rinfo; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index ee90859..e224670 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs | |||
@@ -112,6 +112,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
112 | 112 | ||
113 | Object[] args = new Object[] { source }; | 113 | Object[] args = new Object[] { source }; |
114 | m_MapService = ServerUtils.LoadPlugin<IMapImageService>(service, args); | 114 | m_MapService = ServerUtils.LoadPlugin<IMapImageService>(service, args); |
115 | if (m_MapService == null) | ||
116 | { | ||
117 | m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Unable to load LocalServiceModule from {0}. MapService module disabled. Please fix the configuration.", service); | ||
118 | return; | ||
119 | } | ||
115 | 120 | ||
116 | m_refreshTimer.Enabled = true; | 121 | m_refreshTimer.Enabled = true; |
117 | m_refreshTimer.AutoReset = true; | 122 | m_refreshTimer.AutoReset = true; |
@@ -202,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
202 | { | 207 | { |
203 | m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: upload maptile for {0}", scene.RegionInfo.RegionName); | 208 | m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: upload maptile for {0}", scene.RegionInfo.RegionName); |
204 | 209 | ||
205 | // Create a PNG map tile and upload it to the AddMapTile API | 210 | // Create a JPG map tile and upload it to the AddMapTile API |
206 | byte[] jpgData = Utils.EmptyBytes; | 211 | byte[] jpgData = Utils.EmptyBytes; |
207 | IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); | 212 | IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); |
208 | if (tileGenerator == null) | 213 | if (tileGenerator == null) |
@@ -220,13 +225,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
220 | } | 225 | } |
221 | } | 226 | } |
222 | 227 | ||
228 | if (jpgData == Utils.EmptyBytes) | ||
229 | { | ||
230 | m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Tile image generation failed"); | ||
231 | return; | ||
232 | } | ||
233 | |||
223 | string reason = string.Empty; | 234 | string reason = string.Empty; |
224 | if (!m_MapService.AddMapTile((int)scene.RegionInfo.RegionLocX, (int)scene.RegionInfo.RegionLocY, jpgData, out reason)) | 235 | if (!m_MapService.AddMapTile((int)scene.RegionInfo.RegionLocX, (int)scene.RegionInfo.RegionLocY, jpgData, out reason)) |
225 | { | 236 | { |
226 | m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: Unable to upload tile image for {0} at {1}-{2}: {3}", | 237 | m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: Unable to upload tile image for {0} at {1}-{2}: {3}", |
227 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, reason); | 238 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, reason); |
228 | } | 239 | } |
229 | |||
230 | } | 240 | } |
231 | } | 241 | } |
232 | } \ No newline at end of file | 242 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index eb00de8..f8f3713 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -198,11 +198,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
198 | m_log.ErrorFormat( | 198 | m_log.ErrorFormat( |
199 | "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT); | 199 | "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT); |
200 | 200 | ||
201 | m_log.Error("[ARCHIVER]: OAR save aborted. PLEASE DO NOT USE THIS OAR, IT WILL BE INCOMPLETE."); | 201 | m_log.Error("[ARCHIVER]: Archive save aborted. PLEASE DO NOT USE THIS ARCHIVE, IT WILL BE INCOMPLETE."); |
202 | } | 202 | } |
203 | catch (Exception e) | 203 | catch (Exception e) |
204 | { | 204 | { |
205 | m_log.ErrorFormat("[ARCHIVER]: Timeout handler exception {0}", e); | 205 | m_log.ErrorFormat("[ARCHIVER]: Timeout handler exception {0}{1}", e.Message, e.StackTrace); |
206 | } | 206 | } |
207 | finally | 207 | finally |
208 | { | 208 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 43dd835..e3744bd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1643,7 +1643,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1643 | { | 1643 | { |
1644 | PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info | 1644 | PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info |
1645 | PhysActor.SOPDescription = this.Description; | 1645 | PhysActor.SOPDescription = this.Description; |
1646 | PhysActor.LocalID = LocalId; | ||
1647 | DoPhysicsPropertyUpdate(RigidBody, true); | 1646 | DoPhysicsPropertyUpdate(RigidBody, true); |
1648 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); | 1647 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); |
1649 | } | 1648 | } |
@@ -4435,6 +4434,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4435 | { | 4434 | { |
4436 | // It's not phantom anymore. So make sure the physics engine get's knowledge of it | 4435 | // It's not phantom anymore. So make sure the physics engine get's knowledge of it |
4437 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 4436 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
4437 | LocalId, | ||
4438 | string.Format("{0}/{1}", Name, UUID), | 4438 | string.Format("{0}/{1}", Name, UUID), |
4439 | Shape, | 4439 | Shape, |
4440 | AbsolutePosition, | 4440 | AbsolutePosition, |
@@ -4446,7 +4446,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4446 | pa = PhysActor; | 4446 | pa = PhysActor; |
4447 | if (pa != null) | 4447 | if (pa != null) |
4448 | { | 4448 | { |
4449 | pa.LocalID = LocalId; | ||
4450 | DoPhysicsPropertyUpdate(UsePhysics, true); | 4449 | DoPhysicsPropertyUpdate(UsePhysics, true); |
4451 | if (m_parentGroup != null) | 4450 | if (m_parentGroup != null) |
4452 | { | 4451 | { |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 880c3ea..1c36e55 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -142,7 +142,12 @@ namespace OpenSim.Region.Physics.Manager | |||
142 | 142 | ||
143 | public abstract PrimitiveBaseShape Shape { set; } | 143 | public abstract PrimitiveBaseShape Shape { set; } |
144 | 144 | ||
145 | public abstract uint LocalID { set; } | 145 | uint m_baseLocalID; |
146 | public virtual uint LocalID | ||
147 | { | ||
148 | set { m_baseLocalID = value; } | ||
149 | get { return m_baseLocalID; } | ||
150 | } | ||
146 | 151 | ||
147 | public abstract bool Grabbed { set; } | 152 | public abstract bool Grabbed { set; } |
148 | 153 | ||
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 217d307..54c50f8 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -66,6 +66,13 @@ namespace OpenSim.Region.Physics.Manager | |||
66 | 66 | ||
67 | public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); | 67 | public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying); |
68 | 68 | ||
69 | public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) | ||
70 | { | ||
71 | PhysicsActor ret = AddAvatar(avName, position, size, isFlying); | ||
72 | if (ret != null) ret.LocalID = localID; | ||
73 | return ret; | ||
74 | } | ||
75 | |||
69 | public abstract void RemoveAvatar(PhysicsActor actor); | 76 | public abstract void RemoveAvatar(PhysicsActor actor); |
70 | 77 | ||
71 | public abstract void RemovePrim(PhysicsActor prim); | 78 | public abstract void RemovePrim(PhysicsActor prim); |
@@ -75,6 +82,14 @@ namespace OpenSim.Region.Physics.Manager | |||
75 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | 82 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
76 | Vector3 size, Quaternion rotation, bool isPhysical); | 83 | Vector3 size, Quaternion rotation, bool isPhysical); |
77 | 84 | ||
85 | public virtual PhysicsActor AddPrimShape(uint localID, string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
86 | Vector3 size, Quaternion rotation, bool isPhysical) | ||
87 | { | ||
88 | PhysicsActor ret = AddPrimShape(primName, pbs, position, size, rotation, isPhysical); | ||
89 | if (ret != null) ret.LocalID = localID; | ||
90 | return ret; | ||
91 | } | ||
92 | |||
78 | public virtual float TimeDilation | 93 | public virtual float TimeDilation |
79 | { | 94 | { |
80 | get { return 1.0f; } | 95 | get { return 1.0f; } |
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index a953cd7..99f98b6 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | |||
@@ -26,7 +26,14 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Xml; | ||
33 | |||
29 | using Nini.Config; | 34 | using Nini.Config; |
35 | using log4net; | ||
36 | |||
30 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.Servers.HttpServer; | 39 | using OpenSim.Framework.Servers.HttpServer; |
@@ -55,7 +62,122 @@ namespace OpenSim.Server.Handlers.MapImage | |||
55 | Object[] args = new Object[] { config }; | 62 | Object[] args = new Object[] { config }; |
56 | m_MapService = ServerUtils.LoadPlugin<IMapImageService>(gridService, args); | 63 | m_MapService = ServerUtils.LoadPlugin<IMapImageService>(gridService, args); |
57 | 64 | ||
58 | //server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService)); | 65 | server.AddStreamHandler(new MapServerPostHandler(m_MapService)); |
66 | } | ||
67 | } | ||
68 | |||
69 | class MapServerPostHandler : BaseStreamHandler | ||
70 | { | ||
71 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
72 | private IMapImageService m_MapService; | ||
73 | |||
74 | public MapServerPostHandler(IMapImageService service) : | ||
75 | base("POST", "/map") | ||
76 | { | ||
77 | m_MapService = service; | ||
78 | } | ||
79 | |||
80 | public override byte[] Handle(string path, Stream requestData, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
81 | { | ||
82 | m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); | ||
83 | StreamReader sr = new StreamReader(requestData); | ||
84 | string body = sr.ReadToEnd(); | ||
85 | sr.Close(); | ||
86 | body = body.Trim(); | ||
87 | |||
88 | try | ||
89 | { | ||
90 | Dictionary<string, object> request = ServerUtils.ParseQueryString(body); | ||
91 | |||
92 | if (!request.ContainsKey("X") || !request.ContainsKey("Y") || !request.ContainsKey("DATA")) | ||
93 | { | ||
94 | httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; | ||
95 | return FailureResult("Bad request."); | ||
96 | } | ||
97 | int x = 0, y = 0; | ||
98 | Int32.TryParse(request["X"].ToString(), out x); | ||
99 | Int32.TryParse(request["Y"].ToString(), out y); | ||
100 | string type = "image/jpeg"; | ||
101 | if (request.ContainsKey("TYPE")) | ||
102 | type = request["TYPE"].ToString(); | ||
103 | byte[] data = Convert.FromBase64String(request["DATA"].ToString()); | ||
104 | |||
105 | string reason = string.Empty; | ||
106 | bool result = m_MapService.AddMapTile(x, y, data, out reason); | ||
107 | |||
108 | if (result) | ||
109 | return SuccessResult(); | ||
110 | else | ||
111 | return FailureResult(reason); | ||
112 | |||
113 | } | ||
114 | catch (Exception e) | ||
115 | { | ||
116 | m_log.ErrorFormat("[MAP SERVICE IMAGE HANDLER]: Exception {0} {1}", e.Message, e.StackTrace); | ||
117 | } | ||
118 | |||
119 | return FailureResult("Unexpected server error"); | ||
120 | |||
121 | } | ||
122 | |||
123 | private byte[] SuccessResult() | ||
124 | { | ||
125 | XmlDocument doc = new XmlDocument(); | ||
126 | |||
127 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | ||
128 | "", ""); | ||
129 | |||
130 | doc.AppendChild(xmlnode); | ||
131 | |||
132 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", | ||
133 | ""); | ||
134 | |||
135 | doc.AppendChild(rootElement); | ||
136 | |||
137 | XmlElement result = doc.CreateElement("", "Result", ""); | ||
138 | result.AppendChild(doc.CreateTextNode("Success")); | ||
139 | |||
140 | rootElement.AppendChild(result); | ||
141 | |||
142 | return DocToBytes(doc); | ||
143 | } | ||
144 | |||
145 | private byte[] FailureResult(string msg) | ||
146 | { | ||
147 | XmlDocument doc = new XmlDocument(); | ||
148 | |||
149 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | ||
150 | "", ""); | ||
151 | |||
152 | doc.AppendChild(xmlnode); | ||
153 | |||
154 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", | ||
155 | ""); | ||
156 | |||
157 | doc.AppendChild(rootElement); | ||
158 | |||
159 | XmlElement result = doc.CreateElement("", "Result", ""); | ||
160 | result.AppendChild(doc.CreateTextNode("Failure")); | ||
161 | |||
162 | rootElement.AppendChild(result); | ||
163 | |||
164 | XmlElement message = doc.CreateElement("", "Message", ""); | ||
165 | message.AppendChild(doc.CreateTextNode(msg)); | ||
166 | |||
167 | rootElement.AppendChild(message); | ||
168 | |||
169 | return DocToBytes(doc); | ||
170 | } | ||
171 | |||
172 | private byte[] DocToBytes(XmlDocument doc) | ||
173 | { | ||
174 | MemoryStream ms = new MemoryStream(); | ||
175 | XmlTextWriter xw = new XmlTextWriter(ms, null); | ||
176 | xw.Formatting = Formatting.Indented; | ||
177 | doc.WriteTo(xw); | ||
178 | xw.Flush(); | ||
179 | |||
180 | return ms.ToArray(); | ||
59 | } | 181 | } |
60 | } | 182 | } |
61 | } | 183 | } |
diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index 53d08fa..e8a424f 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | |||
@@ -80,7 +80,6 @@ namespace OpenSim.Server.Handlers.MapImage | |||
80 | 80 | ||
81 | public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 81 | public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
82 | { | 82 | { |
83 | m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: retrieving {0}", path); | ||
84 | byte[] result = new byte[0]; | 83 | byte[] result = new byte[0]; |
85 | 84 | ||
86 | string format = string.Empty; | 85 | string format = string.Empty; |
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs index ff0e9d9..520d639 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServiceConnector.cs | |||
@@ -36,6 +36,7 @@ using Nini.Config; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Server.Base; | ||
39 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
40 | using OpenMetaverse; | 41 | using OpenMetaverse; |
41 | using OpenMetaverse.StructuredData; | 42 | using OpenMetaverse.StructuredData; |
@@ -83,60 +84,57 @@ namespace OpenSim.Services.Connectors | |||
83 | throw new Exception("MapImage connector init error"); | 84 | throw new Exception("MapImage connector init error"); |
84 | } | 85 | } |
85 | m_ServerURI = serviceURI; | 86 | m_ServerURI = serviceURI; |
87 | m_ServerURI = serviceURI.TrimEnd('/'); | ||
86 | } | 88 | } |
87 | 89 | ||
88 | public bool AddMapTile(int x, int y, byte[] pngData, out string reason) | 90 | public bool AddMapTile(int x, int y, byte[] jpgData, out string reason) |
89 | { | 91 | { |
90 | List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | 92 | reason = string.Empty; |
91 | { | ||
92 | new MultipartForm.Parameter("X", x.ToString()), | ||
93 | new MultipartForm.Parameter("Y", y.ToString()), | ||
94 | new MultipartForm.File("Tile", "tile.png", "image/png", pngData) | ||
95 | }; | ||
96 | |||
97 | reason = string.Empty; | ||
98 | int tickstart = Util.EnvironmentTickCount(); | 93 | int tickstart = Util.EnvironmentTickCount(); |
94 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
95 | sendData["X"] = x.ToString(); | ||
96 | sendData["Y"] = y.ToString(); | ||
97 | sendData["TYPE"] = "image/jpeg"; | ||
98 | sendData["DATA"] = Convert.ToBase64String(jpgData); | ||
99 | |||
100 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
99 | 101 | ||
100 | // Make the remote storage request | ||
101 | try | 102 | try |
102 | { | 103 | { |
103 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); | 104 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
104 | request.Timeout = 20000; | 105 | m_ServerURI + "/map", |
105 | request.ReadWriteTimeout = 5000; | 106 | reqString); |
106 | 107 | if (reply != string.Empty) | |
107 | using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) | ||
108 | { | 108 | { |
109 | using (Stream responseStream = response.GetResponseStream()) | 109 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
110 | |||
111 | if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success")) | ||
110 | { | 112 | { |
111 | string responseStr = responseStream.GetStreamString(); | 113 | return true; |
112 | OSD responseOSD = OSDParser.Deserialize(responseStr); | ||
113 | if (responseOSD.Type == OSDType.Map) | ||
114 | { | ||
115 | OSDMap responseMap = (OSDMap)responseOSD; | ||
116 | if (responseMap["Success"].AsBoolean()) | ||
117 | return true; | ||
118 | |||
119 | reason = "Upload failed: " + responseMap["Message"].AsString(); | ||
120 | } | ||
121 | else | ||
122 | { | ||
123 | reason = "Response format was invalid:\n" + responseStr; | ||
124 | } | ||
125 | } | 114 | } |
115 | else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure")) | ||
116 | { | ||
117 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString()); | ||
118 | reason = replyData["Message"].ToString(); | ||
119 | return false; | ||
120 | } | ||
121 | else if (!replyData.ContainsKey("Result")) | ||
122 | { | ||
123 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field"); | ||
124 | } | ||
125 | else | ||
126 | { | ||
127 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); | ||
128 | reason = "Unexpected result " + replyData["Result"].ToString(); | ||
129 | } | ||
130 | |||
126 | } | 131 | } |
132 | else | ||
133 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: RegisterRegion received null reply"); | ||
127 | } | 134 | } |
128 | catch (WebException we) | 135 | catch (Exception e) |
129 | { | ||
130 | reason = we.Message; | ||
131 | if (we.Status == WebExceptionStatus.ProtocolError) | ||
132 | { | ||
133 | HttpWebResponse webResponse = (HttpWebResponse)we.Response; | ||
134 | reason = String.Format("[{0}] {1}", webResponse.StatusCode, webResponse.StatusDescription); | ||
135 | } | ||
136 | } | ||
137 | catch (Exception ex) | ||
138 | { | 136 | { |
139 | reason = ex.Message; | 137 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting grid server: {0}", e.Message); |
140 | } | 138 | } |
141 | finally | 139 | finally |
142 | { | 140 | { |
@@ -146,6 +144,7 @@ namespace OpenSim.Services.Connectors | |||
146 | } | 144 | } |
147 | 145 | ||
148 | return false; | 146 | return false; |
147 | |||
149 | } | 148 | } |
150 | 149 | ||
151 | public byte[] GetMapTile(string fileName, out string format) | 150 | public byte[] GetMapTile(string fileName, out string format) |
diff --git a/OpenSim/Services/MapImageService/MapImageService.cs b/OpenSim/Services/MapImageService/MapImageService.cs index 27722bb..7e7391c 100644 --- a/OpenSim/Services/MapImageService/MapImageService.cs +++ b/OpenSim/Services/MapImageService/MapImageService.cs | |||
@@ -143,7 +143,7 @@ namespace OpenSim.Services.MapImageService | |||
143 | if (File.Exists(fullName)) | 143 | if (File.Exists(fullName)) |
144 | { | 144 | { |
145 | format = Path.GetExtension(fileName).ToLower(); | 145 | format = Path.GetExtension(fileName).ToLower(); |
146 | m_log.DebugFormat("[MAP IMAGE SERVICE]: Found file {0}, extension {1}", fileName, format); | 146 | //m_log.DebugFormat("[MAP IMAGE SERVICE]: Found file {0}, extension {1}", fileName, format); |
147 | return File.ReadAllBytes(fullName); | 147 | return File.ReadAllBytes(fullName); |
148 | } | 148 | } |
149 | else if (File.Exists(m_WaterTileFile)) | 149 | else if (File.Exists(m_WaterTileFile)) |