aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Addons/Groups/GroupsMessagingModule.cs25
-rw-r--r--OpenSim/Addons/Groups/GroupsModule.cs4
-rw-r--r--OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs15
-rw-r--r--OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs1
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsService.cs4
-rw-r--r--OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs25
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs65
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs25
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs26
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs39
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs64
-rw-r--r--OpenSim/Region/Framework/Interfaces/IExternalCapsModule.cs48
-rwxr-xr-xOpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs54
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs75
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs18
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs11
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs13
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs15
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs507
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs12
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs8
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs179
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs8
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs114
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs131
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs18
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs30
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs18
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs6
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs8
31 files changed, 1143 insertions, 425 deletions
diff --git a/OpenSim/Addons/Groups/GroupsMessagingModule.cs b/OpenSim/Addons/Groups/GroupsMessagingModule.cs
index 5de1fb4..be59c62 100644
--- a/OpenSim/Addons/Groups/GroupsMessagingModule.cs
+++ b/OpenSim/Addons/Groups/GroupsMessagingModule.cs
@@ -246,7 +246,7 @@ namespace OpenSim.Groups
246 public void SendMessageToGroup(GridInstantMessage im, UUID groupID) 246 public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
247 { 247 {
248 UUID fromAgentID = new UUID(im.fromAgentID); 248 UUID fromAgentID = new UUID(im.fromAgentID);
249 List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers("all", groupID); 249 List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(UUID.Zero.ToString(), groupID);
250 int groupMembersCount = groupMembers.Count; 250 int groupMembersCount = groupMembers.Count;
251 PresenceInfo[] onlineAgents = null; 251 PresenceInfo[] onlineAgents = null;
252 252
@@ -297,6 +297,10 @@ namespace OpenSim.Groups
297 if (member.AgentID.Guid == im.fromAgentID) 297 if (member.AgentID.Guid == im.fromAgentID)
298 continue; 298 continue;
299 299
300 if (clientsAlreadySent.Contains(member.AgentID))
301 continue;
302 clientsAlreadySent.Add(member.AgentID);
303
300 if (hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID)) 304 if (hasAgentDroppedGroupChatSession(member.AgentID.ToString(), groupID))
301 { 305 {
302 // Don't deliver messages to people who have dropped this session 306 // Don't deliver messages to people who have dropped this session
@@ -336,12 +340,9 @@ namespace OpenSim.Groups
336 // Deliver locally, directly 340 // Deliver locally, directly
337 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); 341 if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name);
338 342
339 if (clientsAlreadySent.Contains(member.AgentID))
340 continue;
341 clientsAlreadySent.Add(member.AgentID);
342
343 ProcessMessageFromGroupSession(im); 343 ProcessMessageFromGroupSession(im);
344 } 344 }
345
345 } 346 }
346 347
347 if (m_debugEnabled) 348 if (m_debugEnabled)
@@ -403,8 +404,7 @@ namespace OpenSim.Groups
403 Scene aScene = m_sceneList[0]; 404 Scene aScene = m_sceneList[0];
404 GridRegion regionOfOrigin = aScene.GridService.GetRegionByUUID(aScene.RegionInfo.ScopeID, regionID); 405 GridRegion regionOfOrigin = aScene.GridService.GetRegionByUUID(aScene.RegionInfo.ScopeID, regionID);
405 406
406 List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers("all", GroupID); 407 List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(UUID.Zero.ToString(), GroupID);
407 List<UUID> alreadySeen = new List<UUID>();
408 408
409 //if (m_debugEnabled) 409 //if (m_debugEnabled)
410 // foreach (GroupMembersData m in groupMembers) 410 // foreach (GroupMembersData m in groupMembers)
@@ -414,15 +414,10 @@ namespace OpenSim.Groups
414 { 414 {
415 s.ForEachScenePresence(sp => 415 s.ForEachScenePresence(sp =>
416 { 416 {
417 // We need this, because we are searching through all 417 // If we got this via grid messaging, it's because the caller thinks
418 // SPs, both root and children 418 // that the root agent is here. We should only send the IM to root agents.
419 if (alreadySeen.Contains(sp.UUID)) 419 if (sp.IsChildAgent)
420 {
421 if (m_debugEnabled)
422 m_log.DebugFormat("[Groups.Messaging]: skipping agent {0} because we've already seen it", sp.UUID);
423 return; 420 return;
424 }
425 alreadySeen.Add(sp.UUID);
426 421
427 GroupMembersData m = groupMembers.Find(gmd => 422 GroupMembersData m = groupMembers.Find(gmd =>
428 { 423 {
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index 826fcbf..da8030c 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -991,6 +991,10 @@ namespace OpenSim.Groups
991 991
992 // Should this send updates to everyone in the group? 992 // Should this send updates to everyone in the group?
993 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient)); 993 SendAgentGroupDataUpdate(remoteClient, GetRequestingAgentID(remoteClient));
994
995 if (reason != string.Empty)
996 // A warning
997 remoteClient.SendAlertMessage("Warning: " + reason);
994 } 998 }
995 else 999 else
996 remoteClient.SendJoinGroupReply(groupID, false); 1000 remoteClient.SendJoinGroupReply(groupID, false);
diff --git a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs
index daa0728..c33168c 100644
--- a/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs
+++ b/OpenSim/Addons/Groups/Hypergrid/GroupsServiceHGConnectorModule.cs
@@ -254,7 +254,10 @@ namespace OpenSim.Groups
254 { 254 {
255 string url = string.Empty, gname = string.Empty; 255 string url = string.Empty, gname = string.Empty;
256 if (IsLocal(GroupID, out url, out gname)) 256 if (IsLocal(GroupID, out url, out gname))
257 return m_LocalGroupsConnector.GetGroupMembers(AgentUUI(RequestingAgentID), GroupID); 257 {
258 string agentID = AgentUUI(RequestingAgentID);
259 return m_LocalGroupsConnector.GetGroupMembers(agentID, GroupID);
260 }
258 else if (!string.IsNullOrEmpty(url)) 261 else if (!string.IsNullOrEmpty(url))
259 { 262 {
260 ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, GroupID); 263 ExtendedGroupMembershipData membership = m_LocalGroupsConnector.GetAgentGroupMembership(RequestingAgentID, RequestingAgentID, GroupID);
@@ -396,17 +399,21 @@ namespace OpenSim.Groups
396 399
397 if (success) 400 if (success)
398 { 401 {
402 // Here we always return true. The user has been added to the local group,
403 // independent of whether the remote operation succeeds or not
399 url = m_UserManagement.GetUserServerURL(uid, "GroupsServerURI"); 404 url = m_UserManagement.GetUserServerURL(uid, "GroupsServerURI");
400 if (url == string.Empty) 405 if (url == string.Empty)
401 { 406 {
402 reason = "User doesn't have a groups server"; 407 reason = "You don't have have an accessible groups server in your home world. You membership to this group in only within this grid.";
403 return false; 408 return true;
404 } 409 }
405 410
406 GroupsServiceHGConnector c = GetConnector(url); 411 GroupsServiceHGConnector c = GetConnector(url);
407 if (c != null) 412 if (c != null)
408 return c.CreateProxy(AgentUUI(RequestingAgentID), AgentID, token, GroupID, m_LocalGroupsServiceLocation, name, out reason); 413 c.CreateProxy(AgentUUI(RequestingAgentID), AgentID, token, GroupID, m_LocalGroupsServiceLocation, name, out reason);
414 return true;
409 } 415 }
416 return false;
410 } 417 }
411 } 418 }
412 else if (m_UserManagement.IsLocalGridUser(uid)) // local user 419 else if (m_UserManagement.IsLocalGridUser(uid)) // local user
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
index 9a3e125..161ca0c 100644
--- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
+++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs
@@ -256,6 +256,7 @@ namespace OpenSim.Groups
256 Dictionary<string, object> sendData = new Dictionary<string, object>(); 256 Dictionary<string, object> sendData = new Dictionary<string, object>();
257 sendData["GroupID"] = GroupID.ToString(); 257 sendData["GroupID"] = GroupID.ToString();
258 sendData["RequestingAgentID"] = RequestingAgentID; 258 sendData["RequestingAgentID"] = RequestingAgentID;
259
259 Dictionary<string, object> ret = MakeRequest("GETGROUPMEMBERS", sendData); 260 Dictionary<string, object> ret = MakeRequest("GETGROUPMEMBERS", sendData);
260 261
261 if (ret == null) 262 if (ret == null)
diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs
index 294b89a..037ef59 100644
--- a/OpenSim/Addons/Groups/Service/GroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsService.cs
@@ -257,8 +257,8 @@ namespace OpenSim.Groups
257 257
258 // Check visibility? 258 // Check visibility?
259 // When we don't want to check visibility, we pass it "all" as the requestingAgentID 259 // When we don't want to check visibility, we pass it "all" as the requestingAgentID
260 bool checkVisibility = !RequestingAgentID.Equals("all"); 260 bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
261 m_log.DebugFormat("[ZZZ]: AgentID is {0}. checkVisibility is {1}", RequestingAgentID, checkVisibility); 261
262 if (checkVisibility) 262 if (checkVisibility)
263 { 263 {
264 // Is the requester a member of the group? 264 // Is the requester a member of the group?
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
index 6a68322..f6f458d 100644
--- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Linq;
30using System.Text; 31using System.Text;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenMetaverse.StructuredData; 33using OpenMetaverse.StructuredData;
@@ -39,8 +40,6 @@ namespace OpenSim.Framework.Monitoring
39 /// </summary> 40 /// </summary>
40 public class SimExtraStatsCollector : BaseStatsCollector 41 public class SimExtraStatsCollector : BaseStatsCollector
41 { 42 {
42 private long abnormalClientThreadTerminations;
43
44// private long assetsInCache; 43// private long assetsInCache;
45// private long texturesInCache; 44// private long texturesInCache;
46// private long assetCacheMemoryUsage; 45// private long assetCacheMemoryUsage;
@@ -73,11 +72,6 @@ namespace OpenSim.Framework.Monitoring
73 private volatile float activeScripts; 72 private volatile float activeScripts;
74 private volatile float scriptLinesPerSecond; 73 private volatile float scriptLinesPerSecond;
75 74
76 /// <summary>
77 /// Number of times that a client thread terminated because of an exception
78 /// </summary>
79 public long AbnormalClientThreadTerminations { get { return abnormalClientThreadTerminations; } }
80
81// /// <summary> 75// /// <summary>
82// /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the 76// /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the
83// /// notion of providing some flow statistics (which pull wouldn't give us). Though admittedly these 77// /// notion of providing some flow statistics (which pull wouldn't give us). Though admittedly these
@@ -166,11 +160,6 @@ namespace OpenSim.Framework.Monitoring
166 private IDictionary<UUID, PacketQueueStatsCollector> packetQueueStatsCollectors 160 private IDictionary<UUID, PacketQueueStatsCollector> packetQueueStatsCollectors
167 = new Dictionary<UUID, PacketQueueStatsCollector>(); 161 = new Dictionary<UUID, PacketQueueStatsCollector>();
168 162
169 public void AddAbnormalClientThreadTermination()
170 {
171 abnormalClientThreadTerminations++;
172 }
173
174// public void AddAsset(AssetBase asset) 163// public void AddAsset(AssetBase asset)
175// { 164// {
176// assetsInCache++; 165// assetsInCache++;
@@ -324,10 +313,12 @@ Asset service request failures: {3}" + Environment.NewLine,
324 sb.Append(Environment.NewLine); 313 sb.Append(Environment.NewLine);
325 sb.Append("CONNECTION STATISTICS"); 314 sb.Append("CONNECTION STATISTICS");
326 sb.Append(Environment.NewLine); 315 sb.Append(Environment.NewLine);
327 sb.Append( 316
328 string.Format( 317 List<Stat> stats = StatsManager.GetStatsFromEachContainer("clientstack", "ClientLogoutsDueToNoReceives");
329 "Abnormal client thread terminations: {0}" + Environment.NewLine, 318
330 abnormalClientThreadTerminations)); 319 sb.AppendFormat(
320 "Client logouts due to no data receive timeout: {0}\n\n",
321 stats != null ? stats.Sum(s => s.Value).ToString() : "unknown");
331 322
332// sb.Append(Environment.NewLine); 323// sb.Append(Environment.NewLine);
333// sb.Append("INVENTORY STATISTICS"); 324// sb.Append("INVENTORY STATISTICS");
@@ -338,7 +329,7 @@ Asset service request failures: {3}" + Environment.NewLine,
338// InventoryServiceRetrievalFailures)); 329// InventoryServiceRetrievalFailures));
339 330
340 sb.Append(Environment.NewLine); 331 sb.Append(Environment.NewLine);
341 sb.Append("FRAME STATISTICS"); 332 sb.Append("SAMPLE FRAME STATISTICS");
342 sb.Append(Environment.NewLine); 333 sb.Append(Environment.NewLine);
343 sb.Append("Dilatn SimFPS PhyFPS AgntUp RootAg ChldAg Prims AtvPrm AtvScr ScrLPS"); 334 sb.Append("Dilatn SimFPS PhyFPS AgntUp RootAg ChldAg Prims AtvPrm AtvScr ScrLPS");
344 sb.Append(Environment.NewLine); 335 sb.Append(Environment.NewLine);
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index a5b54c9..e6a2304 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -271,7 +271,7 @@ namespace OpenSim.Framework.Monitoring
271 // Stat name is not unique across category/container/shortname key. 271 // Stat name is not unique across category/container/shortname key.
272 // XXX: For now just return false. This is to avoid problems in regression tests where all tests 272 // XXX: For now just return false. This is to avoid problems in regression tests where all tests
273 // in a class are run in the same instance of the VM. 273 // in a class are run in the same instance of the VM.
274 if (TryGetStat(stat, out category, out container)) 274 if (TryGetStatParents(stat, out category, out container))
275 return false; 275 return false;
276 276
277 // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed. 277 // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
@@ -307,7 +307,7 @@ namespace OpenSim.Framework.Monitoring
307 307
308 lock (RegisteredStats) 308 lock (RegisteredStats)
309 { 309 {
310 if (!TryGetStat(stat, out category, out container)) 310 if (!TryGetStatParents(stat, out category, out container))
311 return false; 311 return false;
312 312
313 newContainer = new SortedDictionary<string, Stat>(container); 313 newContainer = new SortedDictionary<string, Stat>(container);
@@ -323,12 +323,67 @@ namespace OpenSim.Framework.Monitoring
323 } 323 }
324 } 324 }
325 325
326 public static bool TryGetStats(string category, out SortedDictionary<string, SortedDictionary<string, Stat>> stats) 326 public static bool TryGetStat(string category, string container, string statShortName, out Stat stat)
327 { 327 {
328 return RegisteredStats.TryGetValue(category, out stats); 328 stat = null;
329 SortedDictionary<string, SortedDictionary<string, Stat>> categoryStats;
330
331 lock (RegisteredStats)
332 {
333 if (!TryGetStatsForCategory(category, out categoryStats))
334 return false;
335
336 SortedDictionary<string, Stat> containerStats;
337
338 if (!categoryStats.TryGetValue(container, out containerStats))
339 return false;
340
341 return containerStats.TryGetValue(statShortName, out stat);
342 }
343 }
344
345 public static bool TryGetStatsForCategory(
346 string category, out SortedDictionary<string, SortedDictionary<string, Stat>> stats)
347 {
348 lock (RegisteredStats)
349 return RegisteredStats.TryGetValue(category, out stats);
350 }
351
352 /// <summary>
353 /// Get the same stat for each container in a given category.
354 /// </summary>
355 /// <returns>
356 /// The stats if there were any to fetch. Otherwise null.
357 /// </returns>
358 /// <param name='category'></param>
359 /// <param name='statShortName'></param>
360 public static List<Stat> GetStatsFromEachContainer(string category, string statShortName)
361 {
362 SortedDictionary<string, SortedDictionary<string, Stat>> categoryStats;
363
364 lock (RegisteredStats)
365 {
366 if (!RegisteredStats.TryGetValue(category, out categoryStats))
367 return null;
368
369 List<Stat> stats = null;
370
371 foreach (SortedDictionary<string, Stat> containerStats in categoryStats.Values)
372 {
373 if (containerStats.ContainsKey(statShortName))
374 {
375 if (stats == null)
376 stats = new List<Stat>();
377
378 stats.Add(containerStats[statShortName]);
379 }
380 }
381
382 return stats;
383 }
329 } 384 }
330 385
331 public static bool TryGetStat( 386 public static bool TryGetStatParents(
332 Stat stat, 387 Stat stat,
333 out SortedDictionary<string, SortedDictionary<string, Stat>> category, 388 out SortedDictionary<string, SortedDictionary<string, Stat>> category,
334 out SortedDictionary<string, Stat> container) 389 out SortedDictionary<string, Stat> container)
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index c12b8d6..c8e1e83 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -82,6 +82,8 @@ namespace OpenSim.Region.ClientStack.Linden
82 82
83 private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); 83 private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
84 84
85 private string m_URL;
86
85 #region ISharedRegionModule Members 87 #region ISharedRegionModule Members
86 88
87 public void Initialise(IConfigSource source) 89 public void Initialise(IConfigSource source)
@@ -343,13 +345,13 @@ namespace OpenSim.Region.ClientStack.Linden
343 345
344 private void RegisterCaps(UUID agentID, Caps caps) 346 private void RegisterCaps(UUID agentID, Caps caps)
345 { 347 {
346 string capUrl = "/CAPS/" + UUID.Random() + "/"; 348 m_URL = "/CAPS/" + UUID.Random() + "/";
347 349
348 // Register this as a poll service 350 // Register this as a poll service
349 PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene); 351 PollServiceTextureEventArgs args = new PollServiceTextureEventArgs(agentID, m_scene);
350 352
351 args.Type = PollServiceEventArgs.EventType.Texture; 353 args.Type = PollServiceEventArgs.EventType.Texture;
352 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); 354 MainServer.Instance.AddPollServiceHTTPHandler(m_URL, args);
353 355
354 string hostName = m_scene.RegionInfo.ExternalHostName; 356 string hostName = m_scene.RegionInfo.ExternalHostName;
355 uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; 357 uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
@@ -361,20 +363,23 @@ namespace OpenSim.Region.ClientStack.Linden
361 port = MainServer.Instance.SSLPort; 363 port = MainServer.Instance.SSLPort;
362 protocol = "https"; 364 protocol = "https";
363 } 365 }
364 caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); 366
367 IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>();
368 if (handler != null)
369 handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", m_URL);
370 else
371 caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, m_URL));
365 m_pollservices[agentID] = args; 372 m_pollservices[agentID] = args;
366 m_capsDict[agentID] = capUrl; 373 m_capsDict[agentID] = m_URL;
367 } 374 }
368 375
369 private void DeregisterCaps(UUID agentID, Caps caps) 376 private void DeregisterCaps(UUID agentID, Caps caps)
370 { 377 {
371 string capUrl;
372 PollServiceTextureEventArgs args; 378 PollServiceTextureEventArgs args;
373 if (m_capsDict.TryGetValue(agentID, out capUrl)) 379
374 { 380 MainServer.Instance.RemoveHTTPHandler("", m_URL);
375 MainServer.Instance.RemoveHTTPHandler("", capUrl); 381 m_capsDict.Remove(agentID);
376 m_capsDict.Remove(agentID); 382
377 }
378 if (m_pollservices.TryGetValue(agentID, out args)) 383 if (m_pollservices.TryGetValue(agentID, out args))
379 { 384 {
380 m_pollservices.Remove(agentID); 385 m_pollservices.Remove(agentID);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index 7d9f935..e4d8a20 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -68,7 +68,6 @@ namespace OpenSim.Region.ClientStack.Linden
68 /// </summary> 68 /// </summary>
69 private OSDMap m_features = new OSDMap(); 69 private OSDMap m_features = new OSDMap();
70 70
71 private string m_MapImageServerURL = string.Empty;
72 private string m_SearchURL = string.Empty; 71 private string m_SearchURL = string.Empty;
73 private bool m_ExportSupported = false; 72 private bool m_ExportSupported = false;
74 73
@@ -78,15 +77,7 @@ namespace OpenSim.Region.ClientStack.Linden
78 { 77 {
79 IConfig config = source.Configs["SimulatorFeatures"]; 78 IConfig config = source.Configs["SimulatorFeatures"];
80 if (config != null) 79 if (config != null)
81 { 80 {
82 m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
83 if (m_MapImageServerURL != string.Empty)
84 {
85 m_MapImageServerURL = m_MapImageServerURL.Trim();
86 if (!m_MapImageServerURL.EndsWith("/"))
87 m_MapImageServerURL = m_MapImageServerURL + "/";
88 }
89
90 m_SearchURL = config.GetString("SearchServerURI", string.Empty); 81 m_SearchURL = config.GetString("SearchServerURI", string.Empty);
91 82
92 m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); 83 m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
@@ -149,15 +140,16 @@ namespace OpenSim.Region.ClientStack.Linden
149 m_features["PhysicsShapeTypes"] = typesMap; 140 m_features["PhysicsShapeTypes"] = typesMap;
150 141
151 // Extra information for viewers that want to use it 142 // Extra information for viewers that want to use it
152 OSDMap gridServicesMap = new OSDMap(); 143 // TODO: Take these out of here into their respective modules, like map-server-url
153 if (m_MapImageServerURL != string.Empty) 144 OSDMap extrasMap = new OSDMap();
154 gridServicesMap["map-server-url"] = m_MapImageServerURL;
155 if (m_SearchURL != string.Empty) 145 if (m_SearchURL != string.Empty)
156 gridServicesMap["search"] = m_SearchURL; 146 extrasMap["search-server-url"] = m_SearchURL;
157 m_features["GridServices"] = gridServicesMap;
158
159 if (m_ExportSupported) 147 if (m_ExportSupported)
160 m_features["ExportSupported"] = true; 148 extrasMap["ExportSupported"] = true;
149
150 if (extrasMap.Count > 0)
151 m_features["OpenSimExtras"] = extrasMap;
152
161 } 153 }
162 } 154 }
163 155
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 544b54b..2a2c819 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -69,9 +69,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
69 69
70 StatsManager.RegisterStat( 70 StatsManager.RegisterStat(
71 new Stat( 71 new Stat(
72 "ClientLogoutsDueToNoReceives",
73 "Number of times a client has been logged out because no packets were received before the timeout.",
74 "",
75 "",
76 "clientstack",
77 scene.Name,
78 StatType.Pull,
79 MeasuresOfInterest.None,
80 stat => stat.Value = m_udpServer.ClientLogoutsDueToNoReceives,
81 StatVerbosity.Debug));
82
83 StatsManager.RegisterStat(
84 new Stat(
72 "IncomingUDPReceivesCount", 85 "IncomingUDPReceivesCount",
73 "Number of UDP receives performed", 86 "Number of UDP receives performed",
74 "Number of UDP receives performed", 87 "",
75 "", 88 "",
76 "clientstack", 89 "clientstack",
77 scene.Name, 90 scene.Name,
@@ -84,7 +97,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
84 new Stat( 97 new Stat(
85 "IncomingPacketsProcessedCount", 98 "IncomingPacketsProcessedCount",
86 "Number of inbound LL protocol packets processed", 99 "Number of inbound LL protocol packets processed",
87 "Number of inbound LL protocol packets processed", 100 "",
88 "", 101 "",
89 "clientstack", 102 "clientstack",
90 scene.Name, 103 scene.Name,
@@ -97,7 +110,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
97 new Stat( 110 new Stat(
98 "OutgoingUDPSendsCount", 111 "OutgoingUDPSendsCount",
99 "Number of UDP sends performed", 112 "Number of UDP sends performed",
100 "Number of UDP sends performed", 113 "",
101 "", 114 "",
102 "clientstack", 115 "clientstack",
103 scene.Name, 116 scene.Name,
@@ -149,6 +162,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
149 /// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary> 162 /// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary>
150 public const int MTU = 1400; 163 public const int MTU = 1400;
151 164
165 /// <summary>Number of forced client logouts due to no receipt of packets before timeout.</summary>
166 public int ClientLogoutsDueToNoReceives { get; private set; }
167
152 /// <summary> 168 /// <summary>
153 /// Default packet debug level given to new clients 169 /// Default packet debug level given to new clients
154 /// </summary> 170 /// </summary>
@@ -1058,7 +1074,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1058 // Fire this out on a different thread so that we don't hold up outgoing packet processing for 1074 // Fire this out on a different thread so that we don't hold up outgoing packet processing for
1059 // everybody else if this is being called due to an ack timeout. 1075 // everybody else if this is being called due to an ack timeout.
1060 // This is the same as processing as the async process of a logout request. 1076 // This is the same as processing as the async process of a logout request.
1061 Util.FireAndForget(o => DeactivateClientDueToTimeout(client)); 1077 Util.FireAndForget(o => DeactivateClientDueToTimeout(client, timeoutTicks));
1062 1078
1063 return; 1079 return;
1064 } 1080 }
@@ -1842,18 +1858,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1842 /// regular client pings. 1858 /// regular client pings.
1843 /// </remarks> 1859 /// </remarks>
1844 /// <param name='client'></param> 1860 /// <param name='client'></param>
1845 private void DeactivateClientDueToTimeout(LLClientView client) 1861 /// <param name='timeoutTicks'></param>
1862 private void DeactivateClientDueToTimeout(LLClientView client, int timeoutTicks)
1846 { 1863 {
1847 lock (client.CloseSyncLock) 1864 lock (client.CloseSyncLock)
1848 { 1865 {
1866 ClientLogoutsDueToNoReceives++;
1867
1849 m_log.WarnFormat( 1868 m_log.WarnFormat(
1850 "[LLUDPSERVER]: Ack timeout, disconnecting {0} agent for {1} in {2}", 1869 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
1851 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, m_scene.RegionInfo.RegionName); 1870 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name);
1852
1853 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
1854 1871
1855 if (!client.SceneAgent.IsChildAgent) 1872 if (!client.SceneAgent.IsChildAgent)
1856 client.Kick("Simulator logged you out due to connection timeout"); 1873 client.Kick("Simulator logged you out due to connection timeout.");
1857 1874
1858 client.CloseWithoutChecks(true); 1875 client.CloseWithoutChecks(true);
1859 } 1876 }
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
index 7b11658..f196973 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenMetaverse.StructuredData;
34using Mono.Addins; 35using Mono.Addins;
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Region.CoreModules.World.WorldMap; 37using OpenSim.Region.CoreModules.World.WorldMap;
@@ -48,20 +49,63 @@ namespace OpenSim.Region.CoreModules.Hypergrid
48 // Remember the map area that each client has been exposed to in this region 49 // Remember the map area that each client has been exposed to in this region
49 private Dictionary<UUID, List<MapBlockData>> m_SeenMapBlocks = new Dictionary<UUID, List<MapBlockData>>(); 50 private Dictionary<UUID, List<MapBlockData>> m_SeenMapBlocks = new Dictionary<UUID, List<MapBlockData>>();
50 51
52 private string m_MapImageServerURL = string.Empty;
53
54 private IUserManagement m_UserManagement;
55
51 #region INonSharedRegionModule Members 56 #region INonSharedRegionModule Members
52 57
53 public override void Initialise(IConfigSource config) 58 public override void Initialise(IConfigSource source)
54 { 59 {
55 if (Util.GetConfigVarFromSections<string>( 60 if (Util.GetConfigVarFromSections<string>(
56 config, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap") 61 source, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap")
62 {
57 m_Enabled = true; 63 m_Enabled = true;
64
65 m_MapImageServerURL = Util.GetConfigVarFromSections<string>(source, "MapTileURL", new string[] {"LoginService", "HGWorldMap", "SimulatorFeatures"});
66
67 if (!string.IsNullOrEmpty(m_MapImageServerURL))
68 {
69 m_MapImageServerURL = m_MapImageServerURL.Trim();
70 if (!m_MapImageServerURL.EndsWith("/"))
71 m_MapImageServerURL = m_MapImageServerURL + "/";
72 }
73
74
75 }
58 } 76 }
59 77
60 public override void AddRegion(Scene scene) 78 public override void AddRegion(Scene scene)
61 { 79 {
80 if (!m_Enabled)
81 return;
82
62 base.AddRegion(scene); 83 base.AddRegion(scene);
63 84
64 scene.EventManager.OnClientClosed += new EventManager.ClientClosed(EventManager_OnClientClosed); 85 scene.EventManager.OnClientClosed += EventManager_OnClientClosed;
86 }
87
88 public override void RegionLoaded(Scene scene)
89 {
90 if (!m_Enabled)
91 return;
92
93 base.RegionLoaded(scene);
94 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
95
96 if (featuresModule != null)
97 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
98
99 m_UserManagement = m_scene.RequestModuleInterface<IUserManagement>();
100
101 }
102
103 public override void RemoveRegion(Scene scene)
104 {
105 if (!m_Enabled)
106 return;
107
108 scene.EventManager.OnClientClosed -= EventManager_OnClientClosed;
65 } 109 }
66 110
67 public override string Name 111 public override string Name
@@ -115,6 +159,20 @@ namespace OpenSim.Region.CoreModules.Hypergrid
115 return mapBlocks; 159 return mapBlocks;
116 } 160 }
117 161
162 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
163 {
164 if (m_UserManagement != null && !string.IsNullOrEmpty(m_MapImageServerURL) && !m_UserManagement.IsLocalGridUser(agentID))
165 {
166 OSD extras = new OSDMap();
167 if (features.ContainsKey("OpenSimExtras"))
168 extras = features["OpenSimExtras"];
169 else
170 features["OpenSimExtras"] = extras;
171
172 ((OSDMap)extras)["map-server-url"] = m_MapImageServerURL;
173
174 }
175 }
118 } 176 }
119 177
120 class MapArea 178 class MapArea
diff --git a/OpenSim/Region/Framework/Interfaces/IExternalCapsModule.cs b/OpenSim/Region/Framework/Interfaces/IExternalCapsModule.cs
new file mode 100644
index 0000000..a730cfd
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IExternalCapsModule.cs
@@ -0,0 +1,48 @@
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
28using System;
29using OpenMetaverse;
30using OpenSim.Framework;
31using Caps=OpenSim.Framework.Capabilities.Caps;
32
33namespace OpenSim.Region.Framework.Interfaces
34{
35 public interface IExternalCapsModule
36 {
37 /// <summary>
38 /// This function extends the simple URL configuration in the caps handlers
39 /// to facilitate more interesting computation when an external handler is
40 /// sent to the viewer.
41 /// </summary>
42 /// <param name="agentID">New user UUID</param>
43 /// <param name="caps">Internal caps registry, where the external handler will be registered</param>
44 /// <param name="capName">Name of the specific cap we are registering</param>
45 /// <param name="urlSkel">The skeleton URL provided in the caps configuration</param>
46 bool RegisterExternalUserCapsHandler(UUID agentID, Caps caps, String capName, String urlSkel);
47 }
48}
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
index 6009dc5..0cbc5f9 100755
--- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
@@ -31,10 +31,10 @@ using System.Reflection;
31using System.Text; 31using System.Text;
32 32
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.CoreModules;
34using OpenSim.Region.Framework; 35using OpenSim.Region.Framework;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.CoreModules;
38 38
39using Mono.Addins; 39using Mono.Addins;
40using Nini.Config; 40using Nini.Config;
@@ -49,6 +49,10 @@ public class ExtendedPhysics : INonSharedRegionModule
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private static string LogHeader = "[EXTENDED PHYSICS]"; 50 private static string LogHeader = "[EXTENDED PHYSICS]";
51 51
52 // Since BulletSim is a plugin, this these values aren't defined easily in one place.
53 // This table must coorespond to an identical table in BSScene.
54 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
55
52 private IConfig Configuration { get; set; } 56 private IConfig Configuration { get; set; }
53 private bool Enabled { get; set; } 57 private bool Enabled { get; set; }
54 private Scene BaseScene { get; set; } 58 private Scene BaseScene { get; set; }
@@ -143,13 +147,6 @@ public class ExtendedPhysics : INonSharedRegionModule
143 [ScriptConstant] 147 [ScriptConstant]
144 public static int PHYS_CENTER_OF_MASS = 1 << 0; 148 public static int PHYS_CENTER_OF_MASS = 1 << 0;
145 149
146 [ScriptConstant]
147 public static int PHYS_LINKSET_TYPE_CONSTRAINT = 1;
148 [ScriptConstant]
149 public static int PHYS_LINKSET_TYPE_COMPOUND = 2;
150 [ScriptConstant]
151 public static int PHYS_LINKSET_TYPE_MANUAL = 3;
152
153 [ScriptInvocation] 150 [ScriptInvocation]
154 public string physGetEngineType(UUID hostID, UUID scriptID) 151 public string physGetEngineType(UUID hostID, UUID scriptID)
155 { 152 {
@@ -163,9 +160,50 @@ public class ExtendedPhysics : INonSharedRegionModule
163 return ret; 160 return ret;
164 } 161 }
165 162
163 [ScriptConstant]
164 public static int PHYS_LINKSET_TYPE_CONSTRAINT = 0;
165 [ScriptConstant]
166 public static int PHYS_LINKSET_TYPE_COMPOUND = 1;
167 [ScriptConstant]
168 public static int PHYS_LINKSET_TYPE_MANUAL = 2;
169
166 [ScriptInvocation] 170 [ScriptInvocation]
167 public void physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) 171 public void physSetLinksetType(UUID hostID, UUID scriptID, int linksetType)
168 { 172 {
173 if (!Enabled) return;
174
175 // The part that is requesting the change.
176 SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID);
177
178 if (requestingPart != null)
179 {
180 // The change is always made to the root of a linkset.
181 SceneObjectGroup containingGroup = requestingPart.ParentGroup;
182 SceneObjectPart rootPart = containingGroup.RootPart;
183
184 if (rootPart != null)
185 {
186 Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor;
187 if (rootPhysActor != null)
188 {
189 rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType);
190 }
191 else
192 {
193 m_log.WarnFormat("{0} physSetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}",
194 LogHeader, rootPart.Name, hostID);
195 }
196 }
197 else
198 {
199 m_log.WarnFormat("{0} physSetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}",
200 LogHeader, requestingPart.Name, hostID);
201 }
202 }
203 else
204 {
205 m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID);
206 }
169 } 207 }
170} 208}
171} 209}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 59e7f5f..58a417e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -75,7 +75,7 @@ public sealed class BSCharacter : BSPhysObject
75 RawVelocity = OMV.Vector3.Zero; 75 RawVelocity = OMV.Vector3.Zero;
76 _buoyancy = ComputeBuoyancyFromFlying(isFlying); 76 _buoyancy = ComputeBuoyancyFromFlying(isFlying);
77 Friction = BSParam.AvatarStandingFriction; 77 Friction = BSParam.AvatarStandingFriction;
78 Density = BSParam.AvatarDensity / BSParam.DensityScaleFactor; 78 Density = BSParam.AvatarDensity;
79 79
80 // Old versions of ScenePresence passed only the height. If width and/or depth are zero, 80 // Old versions of ScenePresence passed only the height. If width and/or depth are zero,
81 // replace with the default values. 81 // replace with the default values.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 82d7c44..f0d17d3 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -589,10 +589,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
589 m_vehicleMass = ControllingPrim.TotalMass; 589 m_vehicleMass = ControllingPrim.TotalMass;
590 590
591 // Friction affects are handled by this vehicle code 591 // Friction affects are handled by this vehicle code
592 m_physicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction); 592 // m_physicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction);
593 m_physicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution); 593 // m_physicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution);
594 // ControllingPrim.Linkset.SetPhysicalFriction(BSParam.VehicleFriction); 594 ControllingPrim.Linkset.SetPhysicalFriction(BSParam.VehicleFriction);
595 // ControllingPrim.Linkset.SetPhysicalRestitution(BSParam.VehicleRestitution); 595 ControllingPrim.Linkset.SetPhysicalRestitution(BSParam.VehicleRestitution);
596 596
597 // Moderate angular movement introduced by Bullet. 597 // Moderate angular movement introduced by Bullet.
598 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. 598 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle.
@@ -602,21 +602,21 @@ namespace OpenSim.Region.Physics.BulletSPlugin
602 m_physicsScene.PE.SetAngularFactorV(ControllingPrim.PhysBody, BSParam.VehicleAngularFactor); 602 m_physicsScene.PE.SetAngularFactorV(ControllingPrim.PhysBody, BSParam.VehicleAngularFactor);
603 603
604 // Vehicles report collision events so we know when it's on the ground 604 // Vehicles report collision events so we know when it's on the ground
605 m_physicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); 605 // m_physicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
606 // ControllingPrim.Linkset.SetPhysicalCollisionFlags(CollisionFlags.BS_VEHICLE_COLLISIONS); 606 ControllingPrim.Linkset.AddToPhysicalCollisionFlags(CollisionFlags.BS_VEHICLE_COLLISIONS);
607 607
608 Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape.physShapeInfo, m_vehicleMass); 608 // Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape.physShapeInfo, m_vehicleMass);
609 ControllingPrim.Inertia = inertia * BSParam.VehicleInertiaFactor; 609 // ControllingPrim.Inertia = inertia * BSParam.VehicleInertiaFactor;
610 m_physicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia); 610 // m_physicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia);
611 m_physicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody); 611 // m_physicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody);
612 // ControllingPrim.Linkset.ComputeLocalInertia(BSParam.VehicleInertiaFactor); 612 ControllingPrim.Linkset.ComputeAndSetLocalInertia(BSParam.VehicleInertiaFactor, m_vehicleMass);
613 613
614 // Set the gravity for the vehicle depending on the buoyancy 614 // Set the gravity for the vehicle depending on the buoyancy
615 // TODO: what should be done if prim and vehicle buoyancy differ? 615 // TODO: what should be done if prim and vehicle buoyancy differ?
616 m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy); 616 m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy);
617 // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. 617 // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same.
618 m_physicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero); 618 // m_physicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero);
619 // ControllingPrim.Linkset.SetPhysicalGravity(Vector3.Zero); 619 ControllingPrim.Linkset.SetPhysicalGravity(Vector3.Zero);
620 620
621 VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", 621 VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}",
622 ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity, 622 ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity,
@@ -1121,7 +1121,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1121 { 1121 {
1122 m_VhoverTargetHeight = m_VhoverHeight; 1122 m_VhoverTargetHeight = m_VhoverHeight;
1123 } 1123 }
1124
1125 if ((m_flags & VehicleFlag.HOVER_UP_ONLY) != 0) 1124 if ((m_flags & VehicleFlag.HOVER_UP_ONLY) != 0)
1126 { 1125 {
1127 // If body is already heigher, use its height as target height 1126 // If body is already heigher, use its height as target height
@@ -1170,7 +1169,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1170 m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, 1169 m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight,
1171 verticalError, verticalCorrection); 1170 verticalError, verticalCorrection);
1172 } 1171 }
1173
1174 } 1172 }
1175 } 1173 }
1176 1174
@@ -1357,6 +1355,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1357 private void ComputeAngularTurning(float pTimestep) 1355 private void ComputeAngularTurning(float pTimestep)
1358 { 1356 {
1359 // The user wants this many radians per second angular change? 1357 // The user wants this many radians per second angular change?
1358 Vector3 origVehicleRotationalVelocity = VehicleRotationalVelocity; // DEBUG DEBUG
1360 Vector3 currentAngularV = VehicleRotationalVelocity * Quaternion.Inverse(VehicleOrientation); 1359 Vector3 currentAngularV = VehicleRotationalVelocity * Quaternion.Inverse(VehicleOrientation);
1361 Vector3 angularMotorContributionV = m_angularMotor.Step(pTimestep, currentAngularV); 1360 Vector3 angularMotorContributionV = m_angularMotor.Step(pTimestep, currentAngularV);
1362 1361
@@ -1369,20 +1368,20 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1369 // TODO: This is here because this is where ODE put it but documentation says it 1368 // TODO: This is here because this is where ODE put it but documentation says it
1370 // is a linear effect. Where should this check go? 1369 // is a linear effect. Where should this check go?
1371 //if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) 1370 //if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0)
1372 // { 1371 // {
1373 // angularMotorContributionV.X = 0f; 1372 // angularMotorContributionV.X = 0f;
1374 // angularMotorContributionV.Y = 0f; 1373 // angularMotorContributionV.Y = 0f;
1375 // } 1374 // }
1376 1375
1377 // Reduce any velocity by friction. 1376 // Reduce any velocity by friction.
1378 Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep); 1377 Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep);
1379 angularMotorContributionV -= (currentAngularV * frictionFactorW); 1378 angularMotorContributionV -= (currentAngularV * frictionFactorW);
1380 1379
1381 VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation; 1380 Vector3 angularMotorContributionW = angularMotorContributionV * VehicleOrientation;
1382 1381 VehicleRotationalVelocity += angularMotorContributionW;
1383
1384 1382
1385 VDetailLog("{0}, MoveAngular,angularTurning,angContribV={1}", ControllingPrim.LocalID, angularMotorContributionV); 1383 VDetailLog("{0}, MoveAngular,angularTurning,curAngVelV={1},origVehRotVel={2},vehRotVel={3},frictFact={4}, angContribV={5},angContribW={6}",
1384 ControllingPrim.LocalID, currentAngularV, origVehicleRotationalVelocity, VehicleRotationalVelocity, frictionFactorW, angularMotorContributionV, angularMotorContributionW);
1386 } 1385 }
1387 1386
1388 // From http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial: 1387 // From http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial:
@@ -1409,7 +1408,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1409 1408
1410 // Flipping what was originally a timescale into a speed variable and then multiplying it by 2 1409 // Flipping what was originally a timescale into a speed variable and then multiplying it by 2
1411 // since only computing half the distance between the angles. 1410 // since only computing half the distance between the angles.
1412 float VerticalAttractionSpeed = (1 / m_verticalAttractionTimescale) * 2.0f; 1411 float verticalAttractionSpeed = (1 / m_verticalAttractionTimescale) * 2.0f;
1413 1412
1414 // Make a prediction of where the up axis will be when this is applied rather then where it is now as 1413 // Make a prediction of where the up axis will be when this is applied rather then where it is now as
1415 // this makes for a smoother adjustment and less fighting between the various forces. 1414 // this makes for a smoother adjustment and less fighting between the various forces.
@@ -1419,12 +1418,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1419 Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ); 1418 Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ);
1420 1419
1421 // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared 1420 // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared
1422 Vector3 vertContributionV = torqueVector * VerticalAttractionSpeed * VerticalAttractionSpeed; 1421 Vector3 vertContributionV = torqueVector * verticalAttractionSpeed * verticalAttractionSpeed;
1423 1422
1424 VehicleRotationalVelocity += vertContributionV; 1423 VehicleRotationalVelocity += vertContributionV;
1425 1424
1426 VDetailLog("{0}, MoveAngular,verticalAttraction,upAxis={1},PredictedUp={2},torqueVector={3},contrib={4}", 1425 VDetailLog("{0}, MoveAngular,verticalAttraction,vertAttrSpeed={1},upAxis={2},PredictedUp={3},torqueVector={4},contrib={5}",
1427 ControllingPrim.LocalID, 1426 ControllingPrim.LocalID,
1427 verticalAttractionSpeed,
1428 vehicleUpAxis, 1428 vehicleUpAxis,
1429 predictedUp, 1429 predictedUp,
1430 torqueVector, 1430 torqueVector,
@@ -1437,37 +1437,38 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1437 // http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no 1437 // http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no
1438 1438
1439 // Create a rotation that is only the vehicle's rotation around Z 1439 // Create a rotation that is only the vehicle's rotation around Z
1440 Vector3 currentEuler = Vector3.Zero; 1440 Vector3 currentEulerW = Vector3.Zero;
1441 VehicleOrientation.GetEulerAngles(out currentEuler.X, out currentEuler.Y, out currentEuler.Z); 1441 VehicleOrientation.GetEulerAngles(out currentEulerW.X, out currentEulerW.Y, out currentEulerW.Z);
1442 Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEuler.Z); 1442 Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEulerW.Z);
1443 1443
1444 // Create the axis that is perpendicular to the up vector and the rotated up vector. 1444 // Create the axis that is perpendicular to the up vector and the rotated up vector.
1445 Vector3 differenceAxis = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleOrientation); 1445 Vector3 differenceAxisW = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleOrientation);
1446 // Compute the angle between those to vectors. 1446 // Compute the angle between those to vectors.
1447 double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleOrientation))); 1447 double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleOrientation)));
1448 // 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical 1448 // 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical
1449 1449
1450 // Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied. 1450 // Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied.
1451 // TODO: add 'efficiency'. 1451 // TODO: add 'efficiency'.
1452 differenceAngle /= m_verticalAttractionTimescale; 1452 // differenceAngle /= m_verticalAttractionTimescale;
1453 1453
1454 // Create the quaterian representing the correction angle 1454 // Create the quaterian representing the correction angle
1455 Quaternion correctionRotation = Quaternion.CreateFromAxisAngle(differenceAxis, (float)differenceAngle); 1455 Quaternion correctionRotationW = Quaternion.CreateFromAxisAngle(differenceAxisW, (float)differenceAngle);
1456 1456
1457 // Turn that quaternion into Euler values to make it into velocities to apply. 1457 // Turn that quaternion into Euler values to make it into velocities to apply.
1458 Vector3 vertContributionV = Vector3.Zero; 1458 Vector3 vertContributionW = Vector3.Zero;
1459 correctionRotation.GetEulerAngles(out vertContributionV.X, out vertContributionV.Y, out vertContributionV.Z); 1459 correctionRotationW.GetEulerAngles(out vertContributionW.X, out vertContributionW.Y, out vertContributionW.Z);
1460 vertContributionV *= -1f; 1460 vertContributionW *= -1f;
1461 vertContributionW /= m_verticalAttractionTimescale;
1461 1462
1462 VehicleRotationalVelocity += vertContributionV; 1463 VehicleRotationalVelocity += vertContributionW;
1463 1464
1464 VDetailLog("{0}, MoveAngular,verticalAttraction,upAxis={1},diffAxis={2},diffAng={3},corrRot={4},contrib={5}", 1465 VDetailLog("{0}, MoveAngular,verticalAttraction,upAxis={1},diffAxis={2},diffAng={3},corrRot={4},contrib={5}",
1465 ControllingPrim.LocalID, 1466 ControllingPrim.LocalID,
1466 vehicleUpAxis, 1467 vehicleUpAxis,
1467 differenceAxis, 1468 differenceAxisW,
1468 differenceAngle, 1469 differenceAngle,
1469 correctionRotation, 1470 correctionRotationW,
1470 vertContributionV); 1471 vertContributionW);
1471 break; 1472 break;
1472 } 1473 }
1473 case 2: 1474 case 2:
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 960c0b4..7f94666 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -309,16 +309,18 @@ public abstract class BSLinkset
309 } 309 }
310 ); 310 );
311 } 311 }
312 public virtual void ComputeLocalInertia(OMV.Vector3 inertiaFactor) 312 public virtual void ComputeAndSetLocalInertia(OMV.Vector3 inertiaFactor, float linksetMass)
313 { 313 {
314 ForEachMember((member) => 314 ForEachMember((member) =>
315 { 315 {
316 if (member.PhysBody.HasPhysicalBody) 316 if (member.PhysBody.HasPhysicalBody)
317 { 317 {
318 OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(member.PhysShape.physShapeInfo, member.Mass); 318 OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(member.PhysShape.physShapeInfo, linksetMass);
319 member.Inertia = inertia * inertiaFactor; 319 member.Inertia = inertia * inertiaFactor;
320 m_physicsScene.PE.SetMassProps(member.PhysBody, member.Mass, member.Inertia); 320 m_physicsScene.PE.SetMassProps(member.PhysBody, linksetMass, member.Inertia);
321 m_physicsScene.PE.UpdateInertiaTensor(member.PhysBody); 321 m_physicsScene.PE.UpdateInertiaTensor(member.PhysBody);
322 DetailLog("{0},BSLinkset.ComputeAndSetLocalInertia,m.mass={1}, inertia={2}", member.LocalID, linksetMass, member.Inertia);
323
322 } 324 }
323 return false; // 'false' says to continue looping 325 return false; // 'false' says to continue looping
324 } 326 }
@@ -334,6 +336,16 @@ public abstract class BSLinkset
334 } 336 }
335 ); 337 );
336 } 338 }
339 public virtual void AddToPhysicalCollisionFlags(CollisionFlags collFlags)
340 {
341 ForEachMember((member) =>
342 {
343 if (member.PhysBody.HasPhysicalBody)
344 m_physicsScene.PE.AddToCollisionFlags(member.PhysBody, collFlags);
345 return false; // 'false' says to continue looping
346 }
347 );
348 }
337 public virtual void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags) 349 public virtual void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags)
338 { 350 {
339 ForEachMember((member) => 351 ForEachMember((member) =>
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 33ae5a5..6359046 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -61,11 +61,11 @@ public sealed class BSLinksetCompound : BSLinkset
61 if (LinksetRoot.PhysBody.HasPhysicalBody) 61 if (LinksetRoot.PhysBody.HasPhysicalBody)
62 m_physicsScene.PE.SetGravity(LinksetRoot.PhysBody, gravity); 62 m_physicsScene.PE.SetGravity(LinksetRoot.PhysBody, gravity);
63 } 63 }
64 public override void ComputeLocalInertia(OMV.Vector3 inertiaFactor) 64 public override void ComputeAndSetLocalInertia(OMV.Vector3 inertiaFactor, float linksetMass)
65 { 65 {
66 OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(LinksetRoot.PhysShape.physShapeInfo, LinksetRoot.Mass); 66 OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(LinksetRoot.PhysShape.physShapeInfo, linksetMass);
67 LinksetRoot.Inertia = inertia * inertiaFactor; 67 LinksetRoot.Inertia = inertia * inertiaFactor;
68 m_physicsScene.PE.SetMassProps(LinksetRoot.PhysBody, LinksetRoot.Mass, LinksetRoot.Inertia); 68 m_physicsScene.PE.SetMassProps(LinksetRoot.PhysBody, linksetMass, LinksetRoot.Inertia);
69 m_physicsScene.PE.UpdateInertiaTensor(LinksetRoot.PhysBody); 69 m_physicsScene.PE.UpdateInertiaTensor(LinksetRoot.PhysBody);
70 } 70 }
71 public override void SetPhysicalCollisionFlags(CollisionFlags collFlags) 71 public override void SetPhysicalCollisionFlags(CollisionFlags collFlags)
@@ -73,6 +73,11 @@ public sealed class BSLinksetCompound : BSLinkset
73 if (LinksetRoot.PhysBody.HasPhysicalBody) 73 if (LinksetRoot.PhysBody.HasPhysicalBody)
74 m_physicsScene.PE.SetCollisionFlags(LinksetRoot.PhysBody, collFlags); 74 m_physicsScene.PE.SetCollisionFlags(LinksetRoot.PhysBody, collFlags);
75 } 75 }
76 public override void AddToPhysicalCollisionFlags(CollisionFlags collFlags)
77 {
78 if (LinksetRoot.PhysBody.HasPhysicalBody)
79 m_physicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, collFlags);
80 }
76 public override void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags) 81 public override void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags)
77 { 82 {
78 if (LinksetRoot.PhysBody.HasPhysicalBody) 83 if (LinksetRoot.PhysBody.HasPhysicalBody)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 0bdb5f1..4520171 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -463,7 +463,7 @@ public static class BSParam
463 // Density is passed around as 100kg/m3. This scales that to 1kg/m3. 463 // Density is passed around as 100kg/m3. This scales that to 1kg/m3.
464 // Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well 464 // Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well
465 new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", 465 new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)",
466 0.0001f ), 466 0.01f ),
467 467
468 new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing", 468 new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing",
469 2200f ), 469 2200f ),
@@ -474,8 +474,9 @@ public static class BSParam
474 0.2f, 474 0.2f,
475 (s) => { return DefaultFriction; }, 475 (s) => { return DefaultFriction; },
476 (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), 476 (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ),
477 // For historical reasons, the viewer and simulator multiply the density by 100
477 new ParameterDefn<float>("DefaultDensity", "Density for new objects" , 478 new ParameterDefn<float>("DefaultDensity", "Density for new objects" ,
478 10.000006836f, // Aluminum g/cm3 479 1000.0006836f, // Aluminum g/cm3 * 100
479 (s) => { return DefaultDensity; }, 480 (s) => { return DefaultDensity; },
480 (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), 481 (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ),
481 new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" , 482 new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" ,
@@ -555,8 +556,9 @@ public static class BSParam
555 0.95f ), 556 0.95f ),
556 new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", 557 new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run",
557 1.3f ), 558 1.3f ),
558 new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", 559 // For historical reasons, density is reported * 100
559 3.5f) , 560 new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation. Scaled times 100.",
561 3500f) , // 3.5 * 100
560 new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 562 new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
561 0f ), 563 0f ),
562 new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 564 new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule",
@@ -608,9 +610,8 @@ public static class BSParam
608 0.0f ), 610 0.0f ),
609 new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", 611 new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)",
610 0.0f ), 612 0.0f ),
611 // Turn off fudge with DensityScaleFactor = 0.0001. Value used to be 0.2f;
612 new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", 613 new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)",
613 1.0f ), 614 0.2f ),
614 new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", 615 new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.",
615 60.0f ), 616 60.0f ),
616 new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect", 617 new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect",
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index d34b797..0704591 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -187,10 +187,23 @@ public abstract class BSPhysObject : PhysicsActor
187 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false); 187 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false);
188 Friction = matAttrib.friction; 188 Friction = matAttrib.friction;
189 Restitution = matAttrib.restitution; 189 Restitution = matAttrib.restitution;
190 Density = matAttrib.density / BSParam.DensityScaleFactor; 190 Density = matAttrib.density;
191 // DetailLog("{0},{1}.SetMaterial,Mat={2},frict={3},rest={4},den={5}", LocalID, TypeName, Material, Friction, Restitution, Density); 191 // DetailLog("{0},{1}.SetMaterial,Mat={2},frict={3},rest={4},den={5}", LocalID, TypeName, Material, Friction, Restitution, Density);
192 } 192 }
193 193
194 public override float Density
195 {
196 get
197 {
198 return base.Density;
199 }
200 set
201 {
202 DetailLog("{0},BSPhysObject.Density,set,den={1}", LocalID, value);
203 base.Density = value;
204 }
205 }
206
194 // Stop all physical motion. 207 // Stop all physical motion.
195 public abstract void ZeroMotion(bool inTaintTime); 208 public abstract void ZeroMotion(bool inTaintTime);
196 public abstract void ZeroAngularMotion(bool inTaintTime); 209 public abstract void ZeroAngularMotion(bool inTaintTime);
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 74b980c..6f8d9ed 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized;
30using System.IO; 31using System.IO;
31using System.Net; 32using System.Net;
32using System.Reflection; 33using System.Reflection;
@@ -122,7 +123,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
122 m_Enabled = true; 123 m_Enabled = true;
123 } 124 }
124 125
125 #region IAssetService 126#region IAssetService
126 127
127 public AssetBase Get(string id) 128 public AssetBase Get(string id)
128 { 129 {
@@ -140,8 +141,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
140 return asset; 141 return asset;
141 } 142 }
142 143
143 return GetRemote(id); 144 return SimianGetOperation(id);
144 } 145 }
146
145 147
146 public AssetBase GetCached(string id) 148 public AssetBase GetCached(string id)
147 { 149 {
@@ -164,8 +166,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
164 throw new InvalidOperationException(); 166 throw new InvalidOperationException();
165 } 167 }
166 168
167 AssetMetadata metadata = null;
168
169 // Cache fetch 169 // Cache fetch
170 if (m_cache != null) 170 if (m_cache != null)
171 { 171 {
@@ -174,50 +174,18 @@ namespace OpenSim.Services.Connectors.SimianGrid
174 return asset.Metadata; 174 return asset.Metadata;
175 } 175 }
176 176
177 Uri url; 177 // return GetRemoteMetadata(id);
178 178 return SimianGetMetadataOperation(id);
179 // Determine if id is an absolute URL or a grid-relative UUID
180 if (!Uri.TryCreate(id, UriKind.Absolute, out url))
181 url = new Uri(m_serverUrl + id);
182
183 try
184 {
185 HttpWebRequest request = UntrustedHttpWebRequest.Create(url);
186 request.Method = "HEAD";
187
188 using (WebResponse response = request.GetResponse())
189 {
190 using (Stream responseStream = response.GetResponseStream())
191 {
192 // Create the metadata object
193 metadata = new AssetMetadata();
194 metadata.ContentType = response.ContentType;
195 metadata.ID = id;
196
197 UUID uuid;
198 if (UUID.TryParse(id, out uuid))
199 metadata.FullID = uuid;
200
201 string lastModifiedStr = response.Headers.Get("Last-Modified");
202 if (!String.IsNullOrEmpty(lastModifiedStr))
203 {
204 DateTime lastModified;
205 if (DateTime.TryParse(lastModifiedStr, out lastModified))
206 metadata.CreationDate = lastModified;
207 }
208 }
209 }
210 }
211 catch (Exception ex)
212 {
213 m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset HEAD from " + url + " failed: " + ex.Message);
214 }
215
216 return metadata;
217 } 179 }
218 180
219 public byte[] GetData(string id) 181 public byte[] GetData(string id)
220 { 182 {
183 if (String.IsNullOrEmpty(m_serverUrl))
184 {
185 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
186 throw new InvalidOperationException();
187 }
188
221 AssetBase asset = Get(id); 189 AssetBase asset = Get(id);
222 190
223 if (asset != null) 191 if (asset != null)
@@ -255,7 +223,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
255 Util.FireAndForget( 223 Util.FireAndForget(
256 delegate(object o) 224 delegate(object o)
257 { 225 {
258 AssetBase asset = GetRemote(id); 226 AssetBase asset = SimianGetOperation(id);
259 handler(id, sender, asset); 227 handler(id, sender, asset);
260 } 228 }
261 ); 229 );
@@ -278,7 +246,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
278 } 246 }
279 247
280 bool storedInCache = false; 248 bool storedInCache = false;
281 string errorMessage = null;
282 249
283 // AssetID handling 250 // AssetID handling
284 if (String.IsNullOrEmpty(asset.ID) || asset.ID == ZeroID) 251 if (String.IsNullOrEmpty(asset.ID) || asset.ID == ZeroID)
@@ -307,83 +274,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
307 return asset.ID; 274 return asset.ID;
308 } 275 }
309 276
310 // Distinguish public and private assets 277 return SimianStoreOperation(asset);
311 bool isPublic = true;
312 switch ((AssetType)asset.Type)
313 {
314 case AssetType.CallingCard:
315 case AssetType.Gesture:
316 case AssetType.LSLBytecode:
317 case AssetType.LSLText:
318 isPublic = false;
319 break;
320 }
321
322 // Make sure ContentType is set
323 if (String.IsNullOrEmpty(asset.Metadata.ContentType))
324 asset.Metadata.ContentType = SLUtil.SLAssetTypeToContentType(asset.Type);
325
326 // Build the remote storage request
327 List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
328 {
329 new MultipartForm.Parameter("AssetID", asset.FullID.ToString()),
330 new MultipartForm.Parameter("CreatorID", asset.Metadata.CreatorID),
331 new MultipartForm.Parameter("Temporary", asset.Temporary ? "1" : "0"),
332 new MultipartForm.Parameter("Public", isPublic ? "1" : "0"),
333 new MultipartForm.File("Asset", asset.Name, asset.Metadata.ContentType, asset.Data)
334 };
335
336 // Make the remote storage request
337 try
338 {
339 // Simian does not require the asset ID to be in the URL because it's in the post data.
340 // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs
341 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString());
342
343 using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
344 {
345 using (Stream responseStream = response.GetResponseStream())
346 {
347 string responseStr = null;
348
349 try
350 {
351 responseStr = responseStream.GetStreamString();
352 OSD responseOSD = OSDParser.Deserialize(responseStr);
353 if (responseOSD.Type == OSDType.Map)
354 {
355 OSDMap responseMap = (OSDMap)responseOSD;
356 if (responseMap["Success"].AsBoolean())
357 return asset.ID;
358 else
359 errorMessage = "Upload failed: " + responseMap["Message"].AsString();
360 }
361 else
362 {
363 errorMessage = "Response format was invalid:\n" + responseStr;
364 }
365 }
366 catch (Exception ex)
367 {
368 if (!String.IsNullOrEmpty(responseStr))
369 errorMessage = "Failed to parse the response:\n" + responseStr;
370 else
371 errorMessage = "Failed to retrieve the response: " + ex.Message;
372 }
373 }
374 }
375 }
376 catch (WebException ex)
377 {
378 errorMessage = ex.Message;
379 }
380
381 m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}",
382 asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage);
383
384 return null;
385 } 278 }
386 279
387 /// <summary> 280 /// <summary>
388 /// Update an asset's content 281 /// Update an asset's content
389 /// </summary> 282 /// </summary>
@@ -393,11 +286,17 @@ namespace OpenSim.Services.Connectors.SimianGrid
393 /// <returns></returns> 286 /// <returns></returns>
394 public bool UpdateContent(string id, byte[] data) 287 public bool UpdateContent(string id, byte[] data)
395 { 288 {
289 if (String.IsNullOrEmpty(m_serverUrl))
290 {
291 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
292 throw new InvalidOperationException();
293 }
294
396 AssetBase asset = Get(id); 295 AssetBase asset = Get(id);
397 296
398 if (asset == null) 297 if (asset == null)
399 { 298 {
400 m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to fetch asset " + id + " for updating"); 299 m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to fetch asset {0} for updating", id);
401 return false; 300 return false;
402 } 301 }
403 302
@@ -420,83 +319,347 @@ namespace OpenSim.Services.Connectors.SimianGrid
420 throw new InvalidOperationException(); 319 throw new InvalidOperationException();
421 } 320 }
422 321
423 //string errorMessage = String.Empty;
424 string url = m_serverUrl + id;
425
426 if (m_cache != null) 322 if (m_cache != null)
427 m_cache.Expire(id); 323 m_cache.Expire(id);
428 324
325 return SimianDeleteOperation(id);
326 }
327
328#endregion IAssetService
329
330#region SimianOperations
331 /// <summary>
332 /// Invokes the xRemoveAsset operation on the simian server to delete an asset
333 /// </summary>
334 /// <param name="id"></param>
335 /// <returns></returns>
336 private bool SimianDeleteOperation(string id)
337 {
429 try 338 try
430 { 339 {
431 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); 340 NameValueCollection requestArgs = new NameValueCollection
432 request.Method = "DELETE"; 341 {
342 { "RequestMethod", "xRemoveAsset" },
343 { "AssetID", id }
344 };
433 345
434 using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) 346 OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
347 if (! response["Success"].AsBoolean())
435 { 348 {
436 if (response.StatusCode != HttpStatusCode.NoContent) 349 m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to delete asset; {0}",response["Message"].AsString());
437 { 350 return false;
438 m_log.Warn("[SIMIAN ASSET CONNECTOR]: Unexpected response when deleting asset " + url + ": " +
439 response.StatusCode + " (" + response.StatusDescription + ")");
440 }
441 } 351 }
442 352
443 return true; 353 return true;
354
444 } 355 }
445 catch (Exception ex) 356 catch (Exception ex)
446 { 357 {
447 m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service: " + ex.Message); 358 m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to delete asset {0}; {1}", id, ex.Message);
448 return false;
449 } 359 }
450 }
451 360
452 #endregion IAssetService 361 return false;
362 }
453 363
454 private AssetBase GetRemote(string id) 364 /// <summary>
365 /// Invokes the xAddAsset operation on the simian server to create or update an asset
366 /// </summary>
367 /// <param name="id"></param>
368 /// <returns></returns>
369 private string SimianStoreOperation(AssetBase asset)
455 { 370 {
456 AssetBase asset = null; 371 try
457 Uri url; 372 {
373 NameValueCollection requestArgs = new NameValueCollection
374 {
375 { "RequestMethod", "xAddAsset" },
376 { "ContentType", asset.Metadata.ContentType },
377 { "EncodedData", Convert.ToBase64String(asset.Data) },
378 { "AssetID", asset.FullID.ToString() },
379 { "CreatorID", asset.Metadata.CreatorID },
380 { "Temporary", asset.Temporary ? "1" : "0" },
381 { "Name", asset.Name }
382 };
383
384 OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
385 if (! response["Success"].AsBoolean())
386 {
387 m_log.WarnFormat("[SIMIAN ASSET CONNECTOR] failed to store asset; {0}",response["Message"].AsString());
388 return null;
389 }
458 390
459 // Determine if id is an absolute URL or a grid-relative UUID 391 // asset.ID is always set before calling this function
460 if (!Uri.TryCreate(id, UriKind.Absolute, out url)) 392 return asset.ID;
461 url = new Uri(m_serverUrl + id); 393
394 }
395 catch (Exception ex)
396 {
397 m_log.ErrorFormat("[SIMIAN ASSET CONNECTOR] failed to store asset; {0}",ex.Message);
398 }
399
400 return null;
401 }
462 402
463 try 403 /// <summary>
404 /// Invokes the xGetAsset operation on the simian server to get data associated with an asset
405 /// </summary>
406 /// <param name="id"></param>
407 /// <returns></returns>
408 private AssetBase SimianGetOperation(string id)
409 {
410 try
464 { 411 {
465 HttpWebRequest request = UntrustedHttpWebRequest.Create(url); 412 NameValueCollection requestArgs = new NameValueCollection
413 {
414 { "RequestMethod", "xGetAsset" },
415 { "ID", id }
416 };
466 417
467 using (WebResponse response = request.GetResponse()) 418 OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
419 if (! response["Success"].AsBoolean())
468 { 420 {
469 using (Stream responseStream = response.GetResponseStream()) 421 m_log.WarnFormat("[SIMIAN ASSET CONNECTOR] Failed to get asset; {0}",response["Message"].AsString());
470 { 422 return null;
471 string creatorID = response.Headers.GetOne("X-Asset-Creator-Id") ?? String.Empty;
472
473 // Create the asset object
474 asset = new AssetBase(id, String.Empty, SLUtil.ContentTypeToSLAssetType(response.ContentType), creatorID);
475
476 UUID assetID;
477 if (UUID.TryParse(id, out assetID))
478 asset.FullID = assetID;
479
480 // Grab the asset data from the response stream
481 using (MemoryStream stream = new MemoryStream())
482 {
483 responseStream.CopyStream(stream, Int32.MaxValue);
484 asset.Data = stream.ToArray();
485 }
486 }
487 } 423 }
424
425 AssetBase asset = new AssetBase();
488 426
489 // Cache store 427 asset.ID = id;
490 if (m_cache != null && asset != null) 428 asset.Name = String.Empty;
491 m_cache.Cache(asset); 429 asset.Metadata.ContentType = response["ContentType"].AsString(); // this will also set the asset Type property
430 asset.CreatorID = response["CreatorID"].AsString();
431 asset.Data = System.Convert.FromBase64String(response["EncodedData"].AsString());
432 asset.Local = false;
433 asset.Temporary = response["Temporary"];
492 434
493 return asset; 435 return asset;
494 } 436 }
495 catch (Exception ex) 437 catch (Exception ex)
496 { 438 {
497 m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message); 439 m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to retrieve asset {0}; {1}", id, ex.Message);
498 return null;
499 } 440 }
441
442 return null;
443 }
444
445 /// <summary>
446 /// Invokes the xGetAssetMetadata operation on the simian server to retrieve metadata for an asset
447 /// This operation is generally used to determine if an asset exists in the database
448 /// </summary>
449 /// <param name="id"></param>
450 /// <returns></returns>
451 private AssetMetadata SimianGetMetadataOperation(string id)
452 {
453 try
454 {
455 NameValueCollection requestArgs = new NameValueCollection
456 {
457 { "RequestMethod", "xGetAssetMetadata" },
458 { "ID", id }
459 };
460
461 OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
462 if (! response["Success"].AsBoolean())
463 {
464 // this is not really an error, this call is used to test existence
465 // m_log.DebugFormat("[SIMIAN ASSET CONNECTOR] Failed to get asset metadata; {0}",response["Message"].AsString());
466 return null;
467 }
468
469 AssetMetadata metadata = new AssetMetadata();
470 metadata.ID = id;
471 metadata.ContentType = response["ContentType"].AsString();
472 metadata.CreatorID = response["CreatorID"].AsString();
473 metadata.Local = false;
474 metadata.Temporary = response["Temporary"];
475
476 string lastModifiedStr = response["Last-Modified"].AsString();
477 if (! String.IsNullOrEmpty(lastModifiedStr))
478 {
479 DateTime lastModified;
480 if (DateTime.TryParse(lastModifiedStr, out lastModified))
481 metadata.CreationDate = lastModified;
482 }
483
484 return metadata;
485 }
486 catch (Exception ex)
487 {
488 m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to get asset metadata; {0}", ex.Message);
489 }
490
491 return null;
500 } 492 }
493#endregion
494
495 // private AssetMetadata GetRemoteMetadata(string id)
496 // {
497 // Uri url;
498 // AssetMetadata metadata = null;
499
500 // // Determine if id is an absolute URL or a grid-relative UUID
501 // if (!Uri.TryCreate(id, UriKind.Absolute, out url))
502 // url = new Uri(m_serverUrl + id);
503
504 // try
505 // {
506 // HttpWebRequest request = UntrustedHttpWebRequest.Create(url);
507 // request.Method = "HEAD";
508
509 // using (WebResponse response = request.GetResponse())
510 // {
511 // using (Stream responseStream = response.GetResponseStream())
512 // {
513 // // Create the metadata object
514 // metadata = new AssetMetadata();
515 // metadata.ContentType = response.ContentType;
516 // metadata.ID = id;
517
518 // UUID uuid;
519 // if (UUID.TryParse(id, out uuid))
520 // metadata.FullID = uuid;
521
522 // string lastModifiedStr = response.Headers.Get("Last-Modified");
523 // if (!String.IsNullOrEmpty(lastModifiedStr))
524 // {
525 // DateTime lastModified;
526 // if (DateTime.TryParse(lastModifiedStr, out lastModified))
527 // metadata.CreationDate = lastModified;
528 // }
529 // }
530 // }
531 // }
532 // catch (Exception ex)
533 // {
534 // m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset HEAD from " + url + " failed: " + ex.Message);
535 // }
536
537 // return metadata;
538 // }
539
540 // private AssetBase GetRemote(string id)
541 // {
542 // AssetBase asset = null;
543 // Uri url;
544
545 // // Determine if id is an absolute URL or a grid-relative UUID
546 // if (!Uri.TryCreate(id, UriKind.Absolute, out url))
547 // url = new Uri(m_serverUrl + id);
548
549 // try
550 // {
551 // HttpWebRequest request = UntrustedHttpWebRequest.Create(url);
552
553 // using (WebResponse response = request.GetResponse())
554 // {
555 // using (Stream responseStream = response.GetResponseStream())
556 // {
557 // string creatorID = response.Headers.GetOne("X-Asset-Creator-Id") ?? String.Empty;
558
559 // // Create the asset object
560 // asset = new AssetBase(id, String.Empty, SLUtil.ContentTypeToSLAssetType(response.ContentType), creatorID);
561
562 // UUID assetID;
563 // if (UUID.TryParse(id, out assetID))
564 // asset.FullID = assetID;
565
566 // // Grab the asset data from the response stream
567 // using (MemoryStream stream = new MemoryStream())
568 // {
569 // responseStream.CopyStream(stream, Int32.MaxValue);
570 // asset.Data = stream.ToArray();
571 // }
572 // }
573 // }
574
575 // // Cache store
576 // if (m_cache != null && asset != null)
577 // m_cache.Cache(asset);
578
579 // return asset;
580 // }
581 // catch (Exception ex)
582 // {
583 // m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message);
584 // return null;
585 // }
586 // }
587
588 // private string StoreRemote(AssetBase asset)
589 // {
590 // // Distinguish public and private assets
591 // bool isPublic = true;
592 // switch ((AssetType)asset.Type)
593 // {
594 // case AssetType.CallingCard:
595 // case AssetType.Gesture:
596 // case AssetType.LSLBytecode:
597 // case AssetType.LSLText:
598 // isPublic = false;
599 // break;
600 // }
601
602 // string errorMessage = null;
603
604 // // Build the remote storage request
605 // List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
606 // {
607 // new MultipartForm.Parameter("AssetID", asset.FullID.ToString()),
608 // new MultipartForm.Parameter("CreatorID", asset.Metadata.CreatorID),
609 // new MultipartForm.Parameter("Temporary", asset.Temporary ? "1" : "0"),
610 // new MultipartForm.Parameter("Public", isPublic ? "1" : "0"),
611 // new MultipartForm.File("Asset", asset.Name, asset.Metadata.ContentType, asset.Data)
612 // };
613
614 // // Make the remote storage request
615 // try
616 // {
617 // // Simian does not require the asset ID to be in the URL because it's in the post data.
618 // // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs
619 // HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString());
620
621 // using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
622 // {
623 // using (Stream responseStream = response.GetResponseStream())
624 // {
625 // string responseStr = null;
626
627 // try
628 // {
629 // responseStr = responseStream.GetStreamString();
630 // OSD responseOSD = OSDParser.Deserialize(responseStr);
631 // if (responseOSD.Type == OSDType.Map)
632 // {
633 // OSDMap responseMap = (OSDMap)responseOSD;
634 // if (responseMap["Success"].AsBoolean())
635 // return asset.ID;
636 // else
637 // errorMessage = "Upload failed: " + responseMap["Message"].AsString();
638 // }
639 // else
640 // {
641 // errorMessage = "Response format was invalid:\n" + responseStr;
642 // }
643 // }
644 // catch (Exception ex)
645 // {
646 // if (!String.IsNullOrEmpty(responseStr))
647 // errorMessage = "Failed to parse the response:\n" + responseStr;
648 // else
649 // errorMessage = "Failed to retrieve the response: " + ex.Message;
650 // }
651 // }
652 // }
653 // }
654 // catch (WebException ex)
655 // {
656 // errorMessage = ex.Message;
657 // }
658
659 // m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}",
660 // asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage);
661
662 // return null;
663 // }
501 } 664 }
502} 665}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index 03b19ae..c402907 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -116,7 +116,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
116 { "UserID", principalID.ToString() } 116 { "UserID", principalID.ToString() }
117 }; 117 };
118 118
119 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 119 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
120 if (response["Success"].AsBoolean() && response["Identities"] is OSDArray) 120 if (response["Success"].AsBoolean() && response["Identities"] is OSDArray)
121 { 121 {
122 bool md5hashFound = false; 122 bool md5hashFound = false;
@@ -159,7 +159,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
159 { "SessionID", token } 159 { "SessionID", token }
160 }; 160 };
161 161
162 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 162 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
163 if (response["Success"].AsBoolean()) 163 if (response["Success"].AsBoolean())
164 { 164 {
165 return true; 165 return true;
@@ -181,7 +181,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
181 { "UserID", principalID.ToString() } 181 { "UserID", principalID.ToString() }
182 }; 182 };
183 183
184 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 184 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
185 if (response["Success"].AsBoolean()) 185 if (response["Success"].AsBoolean())
186 { 186 {
187 return true; 187 return true;
@@ -204,7 +204,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
204 { "UserID", principalID.ToString() } 204 { "UserID", principalID.ToString() }
205 }; 205 };
206 206
207 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 207 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
208 if (response["Success"].AsBoolean() && response["User"] is OSDMap) 208 if (response["Success"].AsBoolean() && response["User"] is OSDMap)
209 { 209 {
210 OSDMap userMap = (OSDMap)response["User"]; 210 OSDMap userMap = (OSDMap)response["User"];
@@ -224,7 +224,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
224 { "UserID", principalID.ToString() } 224 { "UserID", principalID.ToString() }
225 }; 225 };
226 226
227 response = WebUtil.PostToService(m_serverUrl, requestArgs); 227 response = SimianGrid.PostToService(m_serverUrl, requestArgs);
228 bool success = response["Success"].AsBoolean(); 228 bool success = response["Success"].AsBoolean();
229 229
230 if (!success) 230 if (!success)
@@ -303,7 +303,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
303 { "UserID", userID.ToString() } 303 { "UserID", userID.ToString() }
304 }; 304 };
305 305
306 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 306 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
307 if (response["Success"].AsBoolean()) 307 if (response["Success"].AsBoolean())
308 return response["SessionID"].AsUUID().ToString(); 308 return response["SessionID"].AsUUID().ToString();
309 else 309 else
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index 841bfa0..a397740 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
122 { "UserID", userID.ToString() } 122 { "UserID", userID.ToString() }
123 }; 123 };
124 124
125 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 125 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
126 if (response["Success"].AsBoolean()) 126 if (response["Success"].AsBoolean())
127 { 127 {
128 OSDMap map = null; 128 OSDMap map = null;
@@ -168,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
168 { "LLPackedAppearance", OSDParser.SerializeJsonString(map) } 168 { "LLPackedAppearance", OSDParser.SerializeJsonString(map) }
169 }; 169 };
170 170
171 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 171 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
172 bool success = response["Success"].AsBoolean(); 172 bool success = response["Success"].AsBoolean();
173 173
174 if (! success) 174 if (! success)
@@ -189,7 +189,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
189 { "UserID", userID.ToString() } 189 { "UserID", userID.ToString() }
190 }; 190 };
191 191
192 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 192 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
193 if (response["Success"].AsBoolean()) 193 if (response["Success"].AsBoolean())
194 { 194 {
195 OSDMap map = null; 195 OSDMap map = null;
@@ -306,7 +306,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
306 { "LLAttachments", OSDParser.SerializeJsonString(items) } 306 { "LLAttachments", OSDParser.SerializeJsonString(items) }
307 }; 307 };
308 308
309 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 309 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
310 bool success = response["Success"].AsBoolean(); 310 bool success = response["Success"].AsBoolean();
311 311
312 if (!success) 312 if (!success)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs
new file mode 100644
index 0000000..8226705
--- /dev/null
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs
@@ -0,0 +1,179 @@
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
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using System.IO;
33using System.Web;
34
35using log4net;
36using Nini.Config;
37using Mono.Addins;
38
39using OpenMetaverse;
40using OpenMetaverse.StructuredData;
41
42using OpenSim.Framework;
43using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.Framework.Scenes;
45using OpenSim.Services.Interfaces;
46using Caps = OpenSim.Framework.Capabilities.Caps;
47
48namespace OpenSim.Services.Connectors.SimianGrid
49{
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianExternalCapsModule")]
51 public class SimianExternalCapsModule : INonSharedRegionModule, IExternalCapsModule
52 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
55 private bool m_enabled = true;
56 private Scene m_scene;
57 private String m_simianURL;
58
59 private IGridUserService m_GridUserService;
60
61#region IRegionModule Members
62
63
64 public string Name
65 {
66 get { return this.GetType().Name; }
67 }
68
69 public void Initialise(IConfigSource config)
70 {
71 try
72 {
73 IConfig m_config;
74
75 if ((m_config = config.Configs["SimianExternalCaps"]) != null)
76 {
77 m_enabled = m_config.GetBoolean("Enabled", m_enabled);
78 if ((m_config = config.Configs["SimianGrid"]) != null)
79 {
80 m_simianURL = m_config.GetString("SimianServiceURL");
81 if (String.IsNullOrEmpty(m_simianURL))
82 m_log.ErrorFormat("[SimianGrid] service URL is not defined");
83 }
84 }
85 else
86 m_enabled = false;
87 }
88 catch (Exception e)
89 {
90 m_log.ErrorFormat("[SimianExternalCaps] initialization error: {0}",e.Message);
91 return;
92 }
93 }
94
95 public void PostInitialise() { }
96 public void Close() { }
97
98 public void AddRegion(Scene scene)
99 {
100 if (! m_enabled)
101 return;
102
103 m_scene = scene;
104 m_scene.RegisterModuleInterface<IExternalCapsModule>(this);
105 }
106
107 public void RemoveRegion(Scene scene)
108 {
109 if (! m_enabled)
110 return;
111
112 m_scene.EventManager.OnRegisterCaps -= RegisterCapsEventHandler;
113 m_scene.EventManager.OnDeregisterCaps -= DeregisterCapsEventHandler;
114 }
115
116 public void RegionLoaded(Scene scene)
117 {
118 if (! m_enabled)
119 return;
120
121 m_scene.EventManager.OnRegisterCaps += RegisterCapsEventHandler;
122 m_scene.EventManager.OnDeregisterCaps += DeregisterCapsEventHandler;
123 }
124
125 public Type ReplaceableInterface
126 {
127 get { return null; }
128 }
129
130#endregion
131
132#region IExternalCapsModule
133 // Eg http://grid.sciencesim.com/GridPublic/%CAP%/%OP%/"
134 public bool RegisterExternalUserCapsHandler(UUID agentID, Caps caps, String capName, String urlSkel)
135 {
136 UUID cap = UUID.Random();
137
138 // Call to simian to register the cap we generated
139 // NameValueCollection requestArgs = new NameValueCollection
140 // {
141 // { "RequestMethod", "AddCapability" },
142 // { "Resource", "user" },
143 // { "Expiration", 0 },
144 // { "OwnerID", agentID.ToString() },
145 // { "CapabilityID", cap.ToString() }
146 // };
147
148 // OSDMap response = SimianGrid.PostToService(m_simianURL, requestArgs);
149
150 Dictionary<String,String> subs = new Dictionary<String,String>();
151 subs["%OP%"] = capName;
152 subs["%USR%"] = agentID.ToString();
153 subs["%CAP%"] = cap.ToString();
154 subs["%SIM%"] = m_scene.RegionInfo.RegionID.ToString();
155
156 caps.RegisterHandler(capName,ExpandSkeletonURL(urlSkel,subs));
157 return true;
158 }
159
160#endregion
161
162#region EventHandlers
163 public void RegisterCapsEventHandler(UUID agentID, Caps caps) { }
164 public void DeregisterCapsEventHandler(UUID agentID, Caps caps) { }
165#endregion
166
167 private String ExpandSkeletonURL(String urlSkel, Dictionary<String,String> subs)
168 {
169 String result = urlSkel;
170
171 foreach (KeyValuePair<String,String> kvp in subs)
172 {
173 result = result.Replace(kvp.Key,kvp.Value);
174 }
175
176 return result;
177 }
178 }
179} \ No newline at end of file
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
index 7422d94..9a8164c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
153 { "Value", flags.ToString() } 153 { "Value", flags.ToString() }
154 }; 154 };
155 155
156 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 156 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
157 bool success = response["Success"].AsBoolean(); 157 bool success = response["Success"].AsBoolean();
158 158
159 if (!success) 159 if (!success)
@@ -180,7 +180,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
180 { "Key", friend } 180 { "Key", friend }
181 }; 181 };
182 182
183 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 183 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
184 bool success = response["Success"].AsBoolean(); 184 bool success = response["Success"].AsBoolean();
185 185
186 if (!success) 186 if (!success)
@@ -200,7 +200,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
200 { "Type", "Friend" } 200 { "Type", "Friend" }
201 }; 201 };
202 202
203 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 203 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
204 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) 204 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
205 { 205 {
206 return (OSDArray)response["Entries"]; 206 return (OSDArray)response["Entries"];
@@ -221,7 +221,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
221 { "Type", "Friend" } 221 { "Type", "Friend" }
222 }; 222 };
223 223
224 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 224 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
225 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) 225 if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
226 { 226 {
227 return (OSDArray)response["Entries"]; 227 return (OSDArray)response["Entries"];
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
index 847319c..a4dd36c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
@@ -26,8 +26,122 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
30using System.Collections.Specialized;
31using System.Reflection;
32
33using log4net;
29using Mono.Addins; 34using Mono.Addins;
30using Nini.Config; 35using Nini.Config;
31 36
37using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces;
41using OpenMetaverse;
42using OpenMetaverse.StructuredData;
43
32[assembly: Addin("SimianGrid", "1.0")] 44[assembly: Addin("SimianGrid", "1.0")]
33[assembly: AddinDependency("OpenSim", "0.5")] 45[assembly: AddinDependency("OpenSim", "0.5")]
46
47namespace OpenSim.Services.Connectors.SimianGrid
48{
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianExternalCapsModule")]
50 public class SimianGrid : ISharedRegionModule
51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53
54 private IConfig m_config = null;
55 private bool m_enabled = true;
56
57 private String m_simianURL;
58
59#region IRegionModule Members
60
61 public string Name
62 {
63 get { return this.GetType().Name; }
64 }
65
66
67 public void Initialise(IConfigSource config)
68 {
69 try
70 {
71 m_config = config.Configs["SimianGrid"];
72
73 if (m_config != null)
74 {
75 m_simianURL = m_config.GetString("SimianServiceURL");
76 if (String.IsNullOrEmpty(m_simianURL))
77 m_log.ErrorFormat("[SimianGrid] service URL is not defined");
78
79 InitialiseSimCap();
80 SimulatorCapability = SimulatorCapability.Trim();
81 m_log.WarnFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability);
82 }
83 }
84 catch (Exception e)
85 {
86 m_log.ErrorFormat("[SimianExternalCaps] initialization error: {0}",e.Message);
87 return;
88 }
89 }
90
91 public void PostInitialise() { }
92 public void Close() { }
93 public void AddRegion(Scene scene) { }
94 public void RemoveRegion(Scene scene) { }
95 public void RegionLoaded(Scene scene) { }
96
97 public Type ReplaceableInterface
98 {
99 get { return null; }
100 }
101
102 ///<summary>
103 /// Try a variety of methods for finding the simian simulator capability; first check the
104 /// configuration itself, then look for a file that contains the cap, then finally look
105 /// for an environment variable that contains it.
106 ///</summary>
107 private void InitialiseSimCap()
108 {
109 if (m_config.Contains("SimulatorCapability"))
110 {
111 SimulatorCapability = m_config.GetString("SimulatorCapability");
112 return;
113 }
114
115 if (m_config.Contains("SimulatorCapabilityFile"))
116 {
117 String filename = m_config.GetString("SimulatorCapabilityFile");
118 if (System.IO.File.Exists(filename))
119 {
120 SimulatorCapability = System.IO.File.ReadAllText(filename);
121 return;
122 }
123 }
124
125 if (m_config.Contains("SimulatorCapabilityVariable"))
126 {
127 String envname = m_config.GetString("SimulatorCapabilityVariable");
128 String envvalue = System.Environment.GetEnvironmentVariable(envname);
129 if (envvalue != null)
130 {
131 SimulatorCapability = envvalue;
132 return;
133 }
134 }
135
136 m_log.WarnFormat("[SimianExternalCaps] no method specified for simulator capability");
137 }
138
139#endregion
140 public static String SimulatorCapability = UUID.Zero.ToString();
141 public static OSDMap PostToService(string url, NameValueCollection data)
142 {
143 data["cap"] = SimulatorCapability;
144 return WebUtil.PostToService(url, data);
145 }
146 }
147}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs
index 93fdae3..b999509 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized;
30using System.Reflection; 31using System.Reflection;
31using System.Net; 32using System.Net;
32using System.IO; 33using System.IO;
@@ -43,7 +44,8 @@ using OpenSim.Region.Framework.Scenes;
43using OpenMetaverse; 44using OpenMetaverse;
44using OpenMetaverse.StructuredData; 45using OpenMetaverse.StructuredData;
45 46
46namespace OpenSim.Region.OptionalModules.Simian 47//namespace OpenSim.Region.OptionalModules.Simian
48namespace OpenSim.Services.Connectors.SimianGrid
47{ 49{
48 /// <summary> 50 /// <summary>
49 /// </summary> 51 /// </summary>
@@ -196,67 +198,84 @@ namespace OpenSim.Region.OptionalModules.Simian
196 } 198 }
197 } 199 }
198 200
199 List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() 201 NameValueCollection requestArgs = new NameValueCollection
202 {
203 { "RequestMethod", "xAddMapTile" },
204 { "X", scene.RegionInfo.RegionLocX.ToString() },
205 { "Y", scene.RegionInfo.RegionLocY.ToString() },
206 { "ContentType", "image/png" },
207 { "EncodedData", System.Convert.ToBase64String(pngData) }
208 };
209
210 OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
211 if (! response["Success"].AsBoolean())
200 { 212 {
201 new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), 213 m_log.WarnFormat("[SIMIAN MAPTILE] failed to store map tile; {0}",response["Message"].AsString());
202 new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), 214 return;
203 new MultipartForm.File("Tile", "tile.png", "image/png", pngData) 215 }
204 };
205 216
206 string errorMessage = null; 217 // List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
207 int tickstart = Util.EnvironmentTickCount(); 218 // {
219 // new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
220 // new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
221 // new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
222 // };
208 223
209 // Make the remote storage request 224 // string errorMessage = null;
210 try 225 // int tickstart = Util.EnvironmentTickCount();
211 {
212 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl);
213 request.Timeout = 20000;
214 request.ReadWriteTimeout = 5000;
215 226
216 using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) 227 // // Make the remote storage request
217 { 228 // try
218 using (Stream responseStream = response.GetResponseStream()) 229 // {
219 { 230 // HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl);
220 string responseStr = responseStream.GetStreamString(); 231 // request.Timeout = 20000;
221 OSD responseOSD = OSDParser.Deserialize(responseStr); 232 // request.ReadWriteTimeout = 5000;
222 if (responseOSD.Type == OSDType.Map)
223 {
224 OSDMap responseMap = (OSDMap)responseOSD;
225 if (responseMap["Success"].AsBoolean())
226 return;
227 233
228 errorMessage = "Upload failed: " + responseMap["Message"].AsString(); 234 // using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
229 } 235 // {
230 else 236 // using (Stream responseStream = response.GetResponseStream())
231 { 237 // {
232 errorMessage = "Response format was invalid:\n" + responseStr; 238 // string responseStr = responseStream.GetStreamString();
233 } 239 // OSD responseOSD = OSDParser.Deserialize(responseStr);
234 } 240 // if (responseOSD.Type == OSDType.Map)
235 } 241 // {
236 } 242 // OSDMap responseMap = (OSDMap)responseOSD;
237 catch (WebException we) 243 // if (responseMap["Success"].AsBoolean())
238 { 244 // return;
239 errorMessage = we.Message; 245
240 if (we.Status == WebExceptionStatus.ProtocolError) 246 // errorMessage = "Upload failed: " + responseMap["Message"].AsString();
241 { 247 // }
242 HttpWebResponse webResponse = (HttpWebResponse)we.Response; 248 // else
243 errorMessage = String.Format("[{0}] {1}", 249 // {
244 webResponse.StatusCode,webResponse.StatusDescription); 250 // errorMessage = "Response format was invalid:\n" + responseStr;
245 } 251 // }
246 } 252 // }
247 catch (Exception ex) 253 // }
248 { 254 // }
249 errorMessage = ex.Message; 255 // catch (WebException we)
250 } 256 // {
251 finally 257 // errorMessage = we.Message;
252 { 258 // if (we.Status == WebExceptionStatus.ProtocolError)
253 // This just dumps a warning for any operation that takes more than 100 ms 259 // {
254 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 260 // HttpWebResponse webResponse = (HttpWebResponse)we.Response;
255 m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff); 261 // errorMessage = String.Format("[{0}] {1}",
256 } 262 // webResponse.StatusCode,webResponse.StatusDescription);
263 // }
264 // }
265 // catch (Exception ex)
266 // {
267 // errorMessage = ex.Message;
268 // }
269 // finally
270 // {
271 // // This just dumps a warning for any operation that takes more than 100 ms
272 // int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
273 // m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff);
274 // }
275
276 // m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}",
277 // pngData.Length, scene.RegionInfo.RegionName, errorMessage);
257 278
258 m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}",
259 pngData.Length, scene.RegionInfo.RegionName, errorMessage);
260 } 279 }
261 } 280 }
262} \ No newline at end of file 281} \ No newline at end of file
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 20eaa3a..043d131 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -140,7 +140,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
140 { "ExtraData", OSDParser.SerializeJsonString(extraData) } 140 { "ExtraData", OSDParser.SerializeJsonString(extraData) }
141 }; 141 };
142 142
143 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 143 OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
144 if (response["Success"].AsBoolean()) 144 if (response["Success"].AsBoolean())
145 return String.Empty; 145 return String.Empty;
146 else 146 else
@@ -156,7 +156,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
156 { "Enabled", "0" } 156 { "Enabled", "0" }
157 }; 157 };
158 158
159 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 159 OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
160 bool success = response["Success"].AsBoolean(); 160 bool success = response["Success"].AsBoolean();
161 161
162 if (!success) 162 if (!success)
@@ -203,7 +203,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
203 203
204 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region with uuid {0}",regionID.ToString()); 204 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region with uuid {0}",regionID.ToString());
205 205
206 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 206 OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
207 if (response["Success"].AsBoolean()) 207 if (response["Success"].AsBoolean())
208 { 208 {
209 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] uuid request successful {0}",response["Name"].AsString()); 209 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] uuid request successful {0}",response["Name"].AsString());
@@ -231,7 +231,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
231 231
232 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString()); 232 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString());
233 233
234 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 234 OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
235 if (response["Success"].AsBoolean()) 235 if (response["Success"].AsBoolean())
236 { 236 {
237 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] position request successful {0}",response["Name"].AsString()); 237 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] position request successful {0}",response["Name"].AsString());
@@ -272,7 +272,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
272 272
273 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions with name {0}",name); 273 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions with name {0}",name);
274 274
275 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 275 OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
276 if (response["Success"].AsBoolean()) 276 if (response["Success"].AsBoolean())
277 { 277 {
278 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); 278 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name);
@@ -310,7 +310,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
310 //m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString()); 310 //m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString());
311 311
312 312
313 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 313 OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
314 if (response["Success"].AsBoolean()) 314 if (response["Success"].AsBoolean())
315 { 315 {
316 OSDArray array = response["Scenes"] as OSDArray; 316 OSDArray array = response["Scenes"] as OSDArray;
@@ -361,7 +361,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
361 { "Enabled", "1" } 361 { "Enabled", "1" }
362 }; 362 };
363 363
364 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 364 OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
365 if (response["Success"].AsBoolean()) 365 if (response["Success"].AsBoolean())
366 { 366 {
367 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); 367 // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name);
@@ -391,7 +391,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
391 391
392 m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); 392 m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString());
393 393
394 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 394 OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
395 if (response["Success"].AsBoolean()) 395 if (response["Success"].AsBoolean())
396 { 396 {
397 OSDMap extraData = response["ExtraData"] as OSDMap; 397 OSDMap extraData = response["ExtraData"] as OSDMap;
@@ -498,7 +498,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
498 if (onlyEnabled) 498 if (onlyEnabled)
499 requestArgs["Enabled"] = "1"; 499 requestArgs["Enabled"] = "1";
500 500
501 OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); 501 OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
502 if (response["Success"].AsBoolean()) 502 if (response["Success"].AsBoolean())
503 { 503 {
504 return ResponseToGridRegion(response); 504 return ResponseToGridRegion(response);
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 36325ce..97eaabe 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -156,7 +156,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
156 { "OwnerID", userID.ToString() } 156 { "OwnerID", userID.ToString() }
157 }; 157 };
158 158
159 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 159 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
160 bool success = response["Success"].AsBoolean(); 160 bool success = response["Success"].AsBoolean();
161 161
162 if (!success) 162 if (!success)
@@ -182,7 +182,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
182 { "ChildrenOnly", "0" } 182 { "ChildrenOnly", "0" }
183 }; 183 };
184 184
185 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 185 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
186 if (response["Success"].AsBoolean() && response["Items"] is OSDArray) 186 if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
187 { 187 {
188 OSDArray items = (OSDArray)response["Items"]; 188 OSDArray items = (OSDArray)response["Items"];
@@ -244,7 +244,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
244 { "ChildrenOnly", "1" } 244 { "ChildrenOnly", "1" }
245 }; 245 };
246 246
247 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 247 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
248 if (response["Success"].AsBoolean() && response["Items"] is OSDArray) 248 if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
249 { 249 {
250 OSDArray items = (OSDArray)response["Items"]; 250 OSDArray items = (OSDArray)response["Items"];
@@ -274,7 +274,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
274 { "OwnerID", userID.ToString() } 274 { "OwnerID", userID.ToString() }
275 }; 275 };
276 276
277 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 277 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
278 if (response["Success"].AsBoolean() && response["Folder"] is OSDMap) 278 if (response["Success"].AsBoolean() && response["Folder"] is OSDMap)
279 { 279 {
280 OSDMap folder = (OSDMap)response["Folder"]; 280 OSDMap folder = (OSDMap)response["Folder"];
@@ -312,7 +312,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
312 { "ChildrenOnly", "1" } 312 { "ChildrenOnly", "1" }
313 }; 313 };
314 314
315 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 315 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
316 if (response["Success"].AsBoolean() && response["Items"] is OSDArray) 316 if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
317 { 317 {
318 List<InventoryItemBase> items = GetItemsFromResponse((OSDArray)response["Items"]); 318 List<InventoryItemBase> items = GetItemsFromResponse((OSDArray)response["Items"]);
@@ -349,7 +349,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
349 { "ChildrenOnly", "1" } 349 { "ChildrenOnly", "1" }
350 }; 350 };
351 351
352 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 352 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
353 if (response["Success"].AsBoolean() && response["Items"] is OSDArray) 353 if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
354 { 354 {
355 OSDArray items = (OSDArray)response["Items"]; 355 OSDArray items = (OSDArray)response["Items"];
@@ -383,7 +383,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
383 { "ChildrenOnly", "1" } 383 { "ChildrenOnly", "1" }
384 }; 384 };
385 385
386 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 386 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
387 if (response["Success"].AsBoolean() && response["Items"] is OSDArray) 387 if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
388 { 388 {
389 OSDArray items = (OSDArray)response["Items"]; 389 OSDArray items = (OSDArray)response["Items"];
@@ -423,7 +423,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
423 { "ChildrenOnly", "1" } 423 { "ChildrenOnly", "1" }
424 }; 424 };
425 425
426 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 426 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
427 if (response["Success"].AsBoolean() && response["Items"] is OSDArray) 427 if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
428 { 428 {
429 OSDArray items = (OSDArray)response["Items"]; 429 OSDArray items = (OSDArray)response["Items"];
@@ -454,7 +454,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
454 { "ContentType", SLUtil.SLAssetTypeToContentType(folder.Type) } 454 { "ContentType", SLUtil.SLAssetTypeToContentType(folder.Type) }
455 }; 455 };
456 456
457 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 457 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
458 bool success = response["Success"].AsBoolean(); 458 bool success = response["Success"].AsBoolean();
459 459
460 if (!success) 460 if (!success)
@@ -518,7 +518,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
518 { "ItemID", itemID.ToString() } 518 { "ItemID", itemID.ToString() }
519 }; 519 };
520 520
521 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 521 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
522 bool success = response["Success"].AsBoolean(); 522 bool success = response["Success"].AsBoolean();
523 523
524 if (!success) 524 if (!success)
@@ -546,7 +546,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
546 { "FolderID", folder.ID.ToString() } 546 { "FolderID", folder.ID.ToString() }
547 }; 547 };
548 548
549 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 549 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
550 bool success = response["Success"].AsBoolean(); 550 bool success = response["Success"].AsBoolean();
551 551
552 if (!success) 552 if (!success)
@@ -623,7 +623,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
623 { "ExtraData", OSDParser.SerializeJsonString(extraData) } 623 { "ExtraData", OSDParser.SerializeJsonString(extraData) }
624 }; 624 };
625 625
626 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 626 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
627 bool success = response["Success"].AsBoolean(); 627 bool success = response["Success"].AsBoolean();
628 628
629 if (!success) 629 if (!success)
@@ -847,7 +847,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
847 { "Items", String.Join(",", itemIDs) } 847 { "Items", String.Join(",", itemIDs) }
848 }; 848 };
849 849
850 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 850 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
851 bool success = response["Success"].AsBoolean(); 851 bool success = response["Success"].AsBoolean();
852 852
853 if (!success) 853 if (!success)
@@ -885,7 +885,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
885 { "UserID", userID.ToString() } 885 { "UserID", userID.ToString() }
886 }; 886 };
887 887
888 OSDMap response = WebUtil.PostToService(m_userServerUrl, requestArgs); 888 OSDMap response = SimianGrid.PostToService(m_userServerUrl, requestArgs);
889 if (response["Success"].AsBoolean()) 889 if (response["Success"].AsBoolean())
890 { 890 {
891 OSDMap user = response["User"] as OSDMap; 891 OSDMap user = response["User"] as OSDMap;
@@ -916,7 +916,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
916 { "Gestures", OSDParser.SerializeJsonString(gestures) } 916 { "Gestures", OSDParser.SerializeJsonString(gestures) }
917 }; 917 };
918 918
919 OSDMap response = WebUtil.PostToService(m_userServerUrl, requestArgs); 919 OSDMap response = SimianGrid.PostToService(m_userServerUrl, requestArgs);
920 if (!response["Success"].AsBoolean()) 920 if (!response["Success"].AsBoolean())
921 { 921 {
922 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to save active gestures for " + userID + ": " + 922 m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to save active gestures for " + userID + ": " +
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 01163aa..211b775 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -149,7 +149,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
149 requestArgs["SecureSessionID"] = secureSessionID.ToString(); 149 requestArgs["SecureSessionID"] = secureSessionID.ToString();
150 } 150 }
151 151
152 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 152 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
153 bool success = response["Success"].AsBoolean(); 153 bool success = response["Success"].AsBoolean();
154 154
155 if (!success) 155 if (!success)
@@ -168,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
168 { "SessionID", sessionID.ToString() } 168 { "SessionID", sessionID.ToString() }
169 }; 169 };
170 170
171 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 171 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
172 bool success = response["Success"].AsBoolean(); 172 bool success = response["Success"].AsBoolean();
173 173
174 if (!success) 174 if (!success)
@@ -187,7 +187,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
187 { "SceneID", regionID.ToString() } 187 { "SceneID", regionID.ToString() }
188 }; 188 };
189 189
190 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 190 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
191 bool success = response["Success"].AsBoolean(); 191 bool success = response["Success"].AsBoolean();
192 192
193 if (!success) 193 if (!success)
@@ -232,7 +232,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
232 { "UserIDList", String.Join(",",userIDs) } 232 { "UserIDList", String.Join(",",userIDs) }
233 }; 233 };
234 234
235 OSDMap sessionListResponse = WebUtil.PostToService(m_serverUrl, requestArgs); 235 OSDMap sessionListResponse = SimianGrid.PostToService(m_serverUrl, requestArgs);
236 if (! sessionListResponse["Success"].AsBoolean()) 236 if (! sessionListResponse["Success"].AsBoolean())
237 { 237 {
238 m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions: {0}",sessionListResponse["Message"].AsString()); 238 m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions: {0}",sessionListResponse["Message"].AsString());
@@ -275,7 +275,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
275 { "LastLocation", SerializeLocation(regionID, lastPosition, lastLookAt) } 275 { "LastLocation", SerializeLocation(regionID, lastPosition, lastLookAt) }
276 }; 276 };
277 277
278 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 278 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
279 bool success = response["Success"].AsBoolean(); 279 bool success = response["Success"].AsBoolean();
280 280
281 if (!success) 281 if (!success)
@@ -295,7 +295,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
295 { "HomeLocation", SerializeLocation(regionID, position, lookAt) } 295 { "HomeLocation", SerializeLocation(regionID, position, lookAt) }
296 }; 296 };
297 297
298 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 298 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
299 bool success = response["Success"].AsBoolean(); 299 bool success = response["Success"].AsBoolean();
300 300
301 if (!success) 301 if (!success)
@@ -340,7 +340,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
340 { "UserID", userID.ToString() } 340 { "UserID", userID.ToString() }
341 }; 341 };
342 342
343 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 343 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
344 if (response["Success"].AsBoolean() && response["User"] is OSDMap) 344 if (response["Success"].AsBoolean() && response["User"] is OSDMap)
345 return response; 345 return response;
346 346
@@ -356,7 +356,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
356 { "SessionID", sessionID.ToString() } 356 { "SessionID", sessionID.ToString() }
357 }; 357 };
358 358
359 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 359 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
360 if (response["Success"].AsBoolean()) 360 if (response["Success"].AsBoolean())
361 return response; 361 return response;
362 362
@@ -376,7 +376,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
376 { "SceneLookAt", lastLookAt.ToString() } 376 { "SceneLookAt", lastLookAt.ToString() }
377 }; 377 };
378 378
379 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 379 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
380 bool success = response["Success"].AsBoolean(); 380 bool success = response["Success"].AsBoolean();
381 381
382 if (!success) 382 if (!success)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index bd8069f..684a0db 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -392,7 +392,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
392 { "UserID", client.AgentId.ToString() } 392 { "UserID", client.AgentId.ToString() }
393 }; 393 };
394 394
395 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 395 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
396 string email = response["Email"].AsString(); 396 string email = response["Email"].AsString();
397 397
398 if (!response["Success"].AsBoolean()) 398 if (!response["Success"].AsBoolean())
@@ -443,7 +443,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
443 { key, OSDParser.SerializeJsonString(value) } 443 { key, OSDParser.SerializeJsonString(value) }
444 }; 444 };
445 445
446 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 446 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
447 bool success = response["Success"].AsBoolean(); 447 bool success = response["Success"].AsBoolean();
448 448
449 if (!success) 449 if (!success)
@@ -462,7 +462,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
462 { "UserID", userID.ToString() } 462 { "UserID", userID.ToString() }
463 }; 463 };
464 464
465 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 465 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
466 if (response["Success"].AsBoolean() && response["User"] is OSDMap) 466 if (response["Success"].AsBoolean() && response["User"] is OSDMap)
467 { 467 {
468 return (OSDMap)response["User"]; 468 return (OSDMap)response["User"];
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index fcb5115..fdc8697 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -165,7 +165,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
165 { "NameQuery", query } 165 { "NameQuery", query }
166 }; 166 };
167 167
168 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 168 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
169 if (response["Success"].AsBoolean()) 169 if (response["Success"].AsBoolean())
170 { 170 {
171 OSDArray array = response["Users"] as OSDArray; 171 OSDArray array = response["Users"] as OSDArray;
@@ -209,7 +209,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
209 { "AccessLevel", data.UserLevel.ToString() } 209 { "AccessLevel", data.UserLevel.ToString() }
210 }; 210 };
211 211
212 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 212 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
213 213
214 if (response["Success"].AsBoolean()) 214 if (response["Success"].AsBoolean())
215 { 215 {
@@ -224,7 +224,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
224 { "UserTitle", data.UserTitle } 224 { "UserTitle", data.UserTitle }
225 }; 225 };
226 226
227 response = WebUtil.PostToService(m_serverUrl, requestArgs); 227 response = SimianGrid.PostToService(m_serverUrl, requestArgs);
228 bool success = response["Success"].AsBoolean(); 228 bool success = response["Success"].AsBoolean();
229 229
230 if (success) 230 if (success)
@@ -257,7 +257,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
257 string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)"; 257 string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)";
258// m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue); 258// m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue);
259 259
260 OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); 260 OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
261 if (response["Success"].AsBoolean()) 261 if (response["Success"].AsBoolean())
262 { 262 {
263 OSDMap user = response["User"] as OSDMap; 263 OSDMap user = response["User"] as OSDMap;