aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2017-01-03 11:24:16 +0000
committerUbitUmarov2017-01-03 11:24:16 +0000
commit82a26671b8e96a4959896759e9ad250924ebedda (patch)
treebf6f3ed18113014e2e1db611ebc1fd0c73883658 /OpenSim
parentsome cleanup, use more using(), more checks so http request mem stream is closed (diff)
parentMerge branch 'master' of opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-82a26671b8e96a4959896759e9ad250924ebedda.zip
opensim-SC-82a26671b8e96a4959896759e9ad250924ebedda.tar.gz
opensim-SC-82a26671b8e96a4959896759e9ad250924ebedda.tar.bz2
opensim-SC-82a26671b8e96a4959896759e9ad250924ebedda.tar.xz
Merge branch 'master' into httptests
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs14
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs2
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs12
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs12
-rw-r--r--OpenSim/Services/FSAssetService/FSAssetService.cs3
-rw-r--r--OpenSim/Services/HypergridService/HGRemoteAssetService.cs240
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs9
7 files changed, 282 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5082b9d..f906d9f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3674,12 +3674,18 @@ namespace OpenSim.Region.Framework.Scenes
3674 // vec, Rotation, thisAddSpeedModifier, Name); 3674 // vec, Rotation, thisAddSpeedModifier, Name);
3675 3675
3676 // rotate from avatar coord space to world 3676 // rotate from avatar coord space to world
3677 // for now all controls assume this is only a rotation around Z 3677 Quaternion rot = Rotation;
3678 // if not all checks below need to be done before this rotation 3678 if (!Flying && PresenceType != PresenceType.Npc)
3679 Vector3 direc = vec * Rotation; 3679 {
3680 // force rotation to be around Z only, if not flying
3681 // needed for mouselook
3682 rot.X = 0;
3683 rot.Y = 0;
3684 }
3685
3686 Vector3 direc = vec * rot;
3680 direc.Normalize(); 3687 direc.Normalize();
3681 3688
3682 // mouse look situation ?
3683 if ((vec.Z == 0f) && !Flying) 3689 if ((vec.Z == 0f) && !Flying)
3684 direc.Z = 0f; // Prevent camera WASD up. 3690 direc.Z = 0f; // Prevent camera WASD up.
3685 3691
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index f642699..410463c 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -2267,8 +2267,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2267 2267
2268 IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); 2268 IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
2269 2269
2270 GC.Collect(1);
2271
2272 TerrainHeightFieldHeightsHandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned); 2270 TerrainHeightFieldHeightsHandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned);
2273 2271
2274 d.GeomHeightfieldDataBuildSingle(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0, 2272 d.GeomHeightfieldDataBuildSingle(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0,
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index 18a4266..57d0a8d 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -242,6 +242,18 @@ namespace OpenSim.Server.Base
242 className = parts[2]; 242 className = parts[2];
243 } 243 }
244 244
245 // Handle extra string arguments in a more generic way
246 if (dllName.Contains("@"))
247 {
248 string[] dllNameParts = dllName.Split(new char[] {'@'});
249 dllName = dllNameParts[dllNameParts.Length - 1];
250 List<Object> argList = new List<Object>(args);
251 for (int i = 0 ; i < dllNameParts.Length - 1 ; ++i)
252 argList.Add(dllNameParts[i]);
253
254 args = argList.ToArray();
255 }
256
245 return LoadPlugin<T>(dllName, className, args); 257 return LoadPlugin<T>(dllName, className, args);
246 } 258 }
247 259
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
index 2ddd7a2..bd5841b 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
@@ -63,6 +63,7 @@ namespace OpenSim.Services.Connectors
63 /// In this case, -1 is default timeout (100 seconds), not infinite. 63 /// In this case, -1 is default timeout (100 seconds), not infinite.
64 /// </remarks> 64 /// </remarks>
65 private int m_requestTimeoutSecs = -1; 65 private int m_requestTimeoutSecs = -1;
66 private string m_configName = "InventoryService";
66 67
67 private const double CACHE_EXPIRATION_SECONDS = 20.0; 68 private const double CACHE_EXPIRATION_SECONDS = 20.0;
68 private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache = new ExpiringCache<UUID,InventoryItemBase>(); 69 private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache = new ExpiringCache<UUID,InventoryItemBase>();
@@ -76,6 +77,13 @@ namespace OpenSim.Services.Connectors
76 m_ServerURI = serverURI.TrimEnd('/'); 77 m_ServerURI = serverURI.TrimEnd('/');
77 } 78 }
78 79
80 public XInventoryServicesConnector(IConfigSource source, string configName)
81 : base(source, configName)
82 {
83 m_configName = configName;
84 Initialise(source);
85 }
86
79 public XInventoryServicesConnector(IConfigSource source) 87 public XInventoryServicesConnector(IConfigSource source)
80 : base(source, "InventoryService") 88 : base(source, "InventoryService")
81 { 89 {
@@ -84,10 +92,10 @@ namespace OpenSim.Services.Connectors
84 92
85 public virtual void Initialise(IConfigSource source) 93 public virtual void Initialise(IConfigSource source)
86 { 94 {
87 IConfig config = source.Configs["InventoryService"]; 95 IConfig config = source.Configs[m_configName];
88 if (config == null) 96 if (config == null)
89 { 97 {
90 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); 98 m_log.ErrorFormat("[INVENTORY CONNECTOR]: {0} missing from OpenSim.ini", m_configName);
91 throw new Exception("Inventory connector init error"); 99 throw new Exception("Inventory connector init error");
92 } 100 }
93 101
diff --git a/OpenSim/Services/FSAssetService/FSAssetService.cs b/OpenSim/Services/FSAssetService/FSAssetService.cs
index 7f14462..cddd288 100644
--- a/OpenSim/Services/FSAssetService/FSAssetService.cs
+++ b/OpenSim/Services/FSAssetService/FSAssetService.cs
@@ -668,6 +668,9 @@ namespace OpenSim.Services.FSAssetService
668 668
669 if (!m_DataConnector.Store(asset.Metadata, hash)) 669 if (!m_DataConnector.Store(asset.Metadata, hash))
670 { 670 {
671 if (asset.Metadata.Type == -2)
672 return asset.ID;
673
671 return UUID.Zero.ToString(); 674 return UUID.Zero.ToString();
672 } 675 }
673 else 676 else
diff --git a/OpenSim/Services/HypergridService/HGRemoteAssetService.cs b/OpenSim/Services/HypergridService/HGRemoteAssetService.cs
new file mode 100644
index 0000000..a53435b
--- /dev/null
+++ b/OpenSim/Services/HypergridService/HGRemoteAssetService.cs
@@ -0,0 +1,240 @@
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 */
27using System;
28using System.Collections.Generic;
29using System.IO;
30using System.Reflection;
31using System.Xml;
32
33using Nini.Config;
34using log4net;
35using OpenMetaverse;
36
37using OpenSim.Framework;
38using OpenSim.Framework.Serialization.External;
39using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces;
41using OpenSim.Services.AssetService;
42
43namespace OpenSim.Services.HypergridService
44{
45 /// <summary>
46 /// Hypergrid asset service. It serves the IAssetService interface,
47 /// but implements it in ways that are appropriate for inter-grid
48 /// asset exchanges.
49 /// </summary>
50 public class HGRemoteAssetService : IAssetService
51 {
52 private static readonly ILog m_log =
53 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType);
55
56 private string m_HomeURL;
57 private IUserAccountService m_UserAccountService;
58 private IAssetService m_assetConnector;
59
60 private UserAccountCache m_Cache;
61
62 private AssetPermissions m_AssetPerms;
63
64 public HGRemoteAssetService(IConfigSource config, string configName)
65 {
66 m_log.Debug("[HGRemoteAsset Service]: Starting");
67 IConfig assetConfig = config.Configs[configName];
68 if (assetConfig == null)
69 throw new Exception("No HGAssetService configuration");
70
71 Object[] args = new Object[] { config };
72
73 string assetConnectorDll = assetConfig.GetString("AssetConnector", String.Empty);
74 if (assetConnectorDll == String.Empty)
75 throw new Exception("Please specify AssetConnector in HGAssetService configuration");
76
77 m_assetConnector = ServerUtils.LoadPlugin<IAssetService>(assetConnectorDll, args);
78 if (m_assetConnector == null)
79 throw new Exception(String.Format("Unable to create AssetConnector from {0}", assetConnectorDll));
80
81 string userAccountsDll = assetConfig.GetString("UserAccountsService", string.Empty);
82 if (userAccountsDll == string.Empty)
83 throw new Exception("Please specify UserAccountsService in HGAssetService configuration");
84
85 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountsDll, args);
86 if (m_UserAccountService == null)
87 throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
88
89 m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI",
90 new string[] { "Startup", "Hypergrid", configName }, string.Empty);
91 if (m_HomeURL == string.Empty)
92 throw new Exception("[HGAssetService] No HomeURI specified");
93
94 m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
95
96 // Permissions
97 m_AssetPerms = new AssetPermissions(assetConfig);
98
99 }
100
101 #region IAssetService overrides
102 public AssetBase Get(string id)
103 {
104 AssetBase asset = m_assetConnector.Get(id);
105
106 if (asset == null)
107 return null;
108
109 if (!m_AssetPerms.AllowedExport(asset.Type))
110 return null;
111
112 if (asset.Metadata.Type == (sbyte)AssetType.Object)
113 asset.Data = AdjustIdentifiers(asset.Data);
114
115 AdjustIdentifiers(asset.Metadata);
116
117 return asset;
118 }
119
120 public AssetMetadata GetMetadata(string id)
121 {
122 AssetMetadata meta = m_assetConnector.GetMetadata(id);
123
124 if (meta == null)
125 return null;
126
127 AdjustIdentifiers(meta);
128
129 return meta;
130 }
131
132 public byte[] GetData(string id)
133 {
134 AssetBase asset = Get(id);
135
136 if (asset == null)
137 return null;
138
139 if (!m_AssetPerms.AllowedExport(asset.Type))
140 return null;
141
142 // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
143 // Fix bad assets before sending them elsewhere
144 if (asset.Type == (int)AssetType.Object && asset.Data != null)
145 {
146 string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data));
147 asset.Data = Utils.StringToBytes(xml);
148 }
149
150 return asset.Data;
151 }
152
153 // public delegate void AssetRetrieved(string id, Object sender, AssetBase asset);
154 public virtual bool Get(string id, Object sender, AssetRetrieved handler)
155 {
156 return m_assetConnector.Get(id, sender, (i, s, asset) =>
157 {
158 if (asset != null)
159 {
160 if (!m_AssetPerms.AllowedExport(asset.Type))
161 {
162 asset = null;
163 }
164 else
165 {
166 if (asset.Metadata.Type == (sbyte)AssetType.Object)
167 asset.Data = AdjustIdentifiers(asset.Data);
168
169 AdjustIdentifiers(asset.Metadata);
170 }
171 }
172
173 handler(i, s, asset);
174 });
175 }
176
177 public string Store(AssetBase asset)
178 {
179 if (!m_AssetPerms.AllowedImport(asset.Type))
180 return string.Empty;
181
182 // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
183 // Fix bad assets before storing on this server
184 if (asset.Type == (int)AssetType.Object && asset.Data != null)
185 {
186 string xml = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(asset.Data));
187 asset.Data = Utils.StringToBytes(xml);
188 }
189
190 return m_assetConnector.Store(asset);
191 }
192
193 public bool Delete(string id)
194 {
195 // NOGO
196 return false;
197 }
198
199 #endregion
200
201 protected void AdjustIdentifiers(AssetMetadata meta)
202 {
203 if (meta == null || m_Cache == null)
204 return;
205
206 UserAccount creator = m_Cache.GetUser(meta.CreatorID);
207 if (creator != null)
208 meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName;
209 }
210
211 // Only for Object
212 protected byte[] AdjustIdentifiers(byte[] data)
213 {
214 string xml = Utils.BytesToString(data);
215
216 // Deal with bug introduced in Oct. 20 (1eb3e6cc43e2a7b4053bc1185c7c88e22356c5e8)
217 // Fix bad assets before sending them elsewhere
218 xml = ExternalRepresentationUtils.SanitizeXml(xml);
219
220 return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, "HGAssetService", m_HomeURL, m_Cache, UUID.Zero));
221 }
222
223 public AssetBase GetCached(string id)
224 {
225 return Get(id);
226 }
227
228 public bool[] AssetsExist(string[] ids)
229 {
230 return m_assetConnector.AssetsExist(ids);
231 }
232
233 public bool UpdateContent(string id, byte[] data)
234 {
235 // SO not happening!!
236 return false;
237 }
238 }
239
240}
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 6d63959..5d69705 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -180,9 +180,14 @@ namespace OpenSim.Services.LLLoginService
180 string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty); 180 string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty);
181 if (hgInvServicePlugin != string.Empty) 181 if (hgInvServicePlugin != string.Empty)
182 { 182 {
183 // TODO: Remove HGInventoryServiceConstructorArg after 0.9 release
183 string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty); 184 string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty);
184 Object[] args2 = new Object[] { config, hgInvServiceArg }; 185 if (hgInvServiceArg != String.Empty)
185 m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args2); 186 {
187 m_log.Warn("[LLOGIN SERVICE]: You are using HGInventoryServiceConstructorArg, which is deprecated. See example file for correct syntax.");
188 hgInvServicePlugin = hgInvServiceArg + "@" + hgInvServicePlugin;
189 }
190 m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args);
186 } 191 }
187 192
188 // 193 //