Compare commits
127 Commits
master
...
0.8-post-f
Author | SHA1 | Date |
---|---|---|
Justin Clark-Casey | f9ec086565 | |
Kevin Cozens | bd86ae3d67 | |
Kevin Cozens | c9f494c00e | |
Justin Clark-Casey | 3879f9a081 | |
Justin Clark-Casey | 10ed3a5520 | |
Justin Clark-Casey (justincc) | ddda314f14 | |
Melanie Thielker | 8fb0dccffa | |
Justin Clark-Casey | 4a90dd3556 | |
Justin Clark-Casey | f6d02a63eb | |
Oren Hurvitz | 422f718949 | |
Oren Hurvitz | 3176237169 | |
Justin Clark-Casey (justincc) | a4595b18ca | |
Justin Clark-Casey | 4640281e57 | |
Justin Clark-Casey (justincc) | 319bbce517 | |
Justin Clark-Casey (justincc) | a48b3ef97a | |
Justin Clark-Casey (justincc) | 32a9fcd8b3 | |
Robert Adams | eedefdc5ff | |
Justin Clark-Casey (justincc) | 05dfc38f66 | |
Justin Clark-Casey (justincc) | 95f3a9452d | |
Justin Clark-Casey (justincc) | 3410b36d76 | |
Justin Clark-Casey (justincc) | 2f7d950ead | |
Michael Cerquoni | 26916806db | |
Justin Clark-Casey (justincc) | bdfbe4d0e2 | |
Justin Clark-Casey (justincc) | dfaabf4d0d | |
Justin Clark-Casey (justincc) | fdb0c7389e | |
Justin Clark-Casey (justincc) | 92e2478059 | |
Justin Clark-Casey (justincc) | b6e32c000b | |
Justin Clark-Casey (justincc) | ed4a4d6bbd | |
BlueWall | 7e0d0282c4 | |
Oren Hurvitz | 8de1be746f | |
Oren Hurvitz | e7bd4a11aa | |
Oren Hurvitz | f1536de438 | |
Oren Hurvitz | 4514799c8d | |
Oren Hurvitz | 5f0456d91f | |
Oren Hurvitz | 9a2dc6a0d7 | |
Oren Hurvitz | 37fcc827e2 | |
Oren Hurvitz | 5229a3c51c | |
Oren Hurvitz | e16403db80 | |
Oren Hurvitz | c4467353da | |
Oren Hurvitz | d616f75d9a | |
Oren Hurvitz | ae53c6b834 | |
Oren Hurvitz | af344aa532 | |
Oren Hurvitz | 8920c65b9c | |
Oren Hurvitz | e41e52e097 | |
Robert Adams | 01d13b4ad7 | |
Justin Clark-Casey (justincc) | 74848e9cdb | |
Justin Clark-Casey (justincc) | ff88d371d2 | |
Justin Clark-Casey (justincc) | 19bd27071a | |
Justin Clark-Casey (justincc) | ad3ce54aca | |
Robert Adams | db17f98c6f | |
Michael Cerquoni | 66340824e5 | |
Justin Clark-Casey (justincc) | 539ffb7769 | |
Dev Random | d35b5737a8 | |
Justin Clark-Casey (justincc) | 1670d306d7 | |
Justin Clark-Casey (justincc) | 405db6d450 | |
Justin Clark-Casey (justincc) | 743b1efdb4 | |
Justin Clark-Casey (justincc) | b243cde14f | |
Justin Clark-Casey (justincc) | 73ed56f46a | |
Justin Clark-Casey (justincc) | 6b5533dbdb | |
Diva Canto | 3dd5d8508c | |
Justin Clark-Casey (justincc) | 2a15739935 | |
Justin Clark-Casey (justincc) | fabe054608 | |
Diva Canto | fe1ae9db1b | |
Justin Clark-Casey (justincc) | 12ce20a203 | |
Latif Khalifa | 45e280274c | |
Justin Clark-Casey (justincc) | e87a0d9db1 | |
Diva Canto | 62e9cdd72a | |
Diva Canto | 3730163e5d | |
Diva Canto | 4e3a2d3a64 | |
Diva Canto | e9447cc836 | |
Justin Clark-Casey (justincc) | 693a3ea8fa | |
Justin Clark-Casey (justincc) | 7e2927f537 | |
Justin Clark-Casey (justincc) | ba745a524d | |
Justin Clark-Casey (justincc) | cf8b6efaf2 | |
Justin Clark-Casey (justincc) | 40f7062d02 | |
dahlia | 81fe05bb84 | |
Vegaslon | ed6aabb197 | |
dahlia | 8542f34d7d | |
Diva Canto | 025ac85a46 | |
Robert Adams | 5edffc9ecd | |
Aleric Inglewood | 56a3d2f00d | |
Aleric Inglewood | 28babf307e | |
Robert Adams | 03c6d2b0b4 | |
Robert Adams | b293242017 | |
Justin Clark-Casey (justincc) | 924ca8e2e9 | |
Justin Clark-Casey (justincc) | 86630a9010 | |
Justin Clark-Casey (justincc) | 68fcb132d9 | |
AliciaRaven | 6f582aeaff | |
AliciaRaven | fa1f6031ca | |
Justin Clark-Casey | eea3be9b17 | |
Justin Clark-Casey | 698dfe8977 | |
Justin Clark-Casey (justincc) | 25757a6abb | |
Justin Clark-Casey (justincc) | 5a1017241f | |
Justin Clark-Casey (justincc) | 76ee671dc6 | |
Diva Canto | 2cdef143c4 | |
Diva Canto | 34a645efb6 | |
Robert Adams | 02980336a3 | |
Justin Clark-Casey | 8899f2e2bb | |
Justin Clark-Casey (justincc) | 60d4b0999c | |
Diva Canto | a8edc908e0 | |
Robert Adams | 901602411c | |
Michael Cerquoni | d98a19b398 | |
Diva Canto | e8f363ff90 | |
Michael Cerquoni | 5e4cf1b84c | |
Diva Canto | ffe07527fc | |
Diva Canto | 72456f90a4 | |
Diva Canto | 0cf5ea9420 | |
Diva Canto | becb949a33 | |
Diva Canto | 63a6998409 | |
Michael Cerquoni | 15f323295b | |
AliciaRaven | 2c823c9f72 | |
Diva Canto | d541f150d0 | |
Diva Canto | 4da471a5aa | |
Diva Canto | 75d21aa71a | |
Justin Clark-Casey (justincc) | 88e9cd0eee | |
Justin Clark-Casey (justincc) | 26ec918ec8 | |
Justin Clark-Casey (justincc) | 4bc2201453 | |
dahlia | 344db4dc0b | |
Diva Canto | de6e3edfbb | |
Justin Clark-Casey (justincc) | a1e92dead2 | |
Justin Clark-Casey (justincc) | 068cab94e0 | |
BlueWall | 7b66ef44c3 | |
Justin Clark-Casey | dcbe9d1ffb | |
Justin Clark-Casey | 3a477a29d7 | |
Justin Clark-Casey | 3f703ae1cb | |
Justin Clark-Casey | c38736de82 | |
Justin Clark-Casey | 766c94213c |
|
@ -54,6 +54,7 @@ bin/Regions/*
|
|||
bin/UserAssets
|
||||
bin/assetcache
|
||||
bin/maptiles
|
||||
bin/bakes
|
||||
bin/estate_settings.xml
|
||||
bin/config-include/CenomeCache.ini
|
||||
bin/config-include/FlotsamCache.ini
|
||||
|
|
|
@ -19,10 +19,14 @@ Prereqs:
|
|||
|
||||
From the distribution type:
|
||||
* ./runprebuild.sh
|
||||
* nant (or xbuild)
|
||||
* nant (or !* xbuild)
|
||||
* cd bin
|
||||
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
||||
* run mono OpenSim.exe
|
||||
!* xbuild option switches
|
||||
!* clean: xbuild /target:clean
|
||||
!* debug: (default) xbuild /property:Configuration=Debug
|
||||
!* release: xbuild /property:Configuration=Release
|
||||
|
||||
# Using Monodevelop
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ what it is today.
|
|||
* alex_carnell
|
||||
* Alan Webb (IBM)
|
||||
* Aleric
|
||||
* Alicia Raven
|
||||
* Allen Kerensky
|
||||
* BigFootAg
|
||||
* BlueWall Slade
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace OpenSim.Groups
|
|||
if (dict.ContainsKey("ServiceLocation") && dict["ServiceLocation"] != null)
|
||||
grec.ServiceLocation = dict["ServiceLocation"].ToString();
|
||||
else
|
||||
grec.GroupName = string.Empty;
|
||||
grec.ServiceLocation = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("ShownInList") && dict["ShownInList"] != null)
|
||||
grec.ShowInList = bool.Parse(dict["ShownInList"].ToString());
|
||||
|
|
|
@ -325,6 +325,13 @@ namespace OpenSim.Groups
|
|||
im.RegionID = thisClient.Scene.RegionInfo.RegionID.Guid;
|
||||
}
|
||||
|
||||
if ((im.binaryBucket == null) || (im.binaryBucket.Length == 0) || ((im.binaryBucket.Length == 1 && im.binaryBucket[0] == 0)))
|
||||
{
|
||||
ExtendedGroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), groupID, null);
|
||||
if (groupInfo != null)
|
||||
im.binaryBucket = Util.StringToBytes256(groupInfo.GroupName);
|
||||
}
|
||||
|
||||
// Send to self first of all
|
||||
im.toAgentID = im.fromAgentID;
|
||||
im.fromGroup = true;
|
||||
|
|
|
@ -209,11 +209,13 @@ namespace OpenSim.Groups
|
|||
string agentID = request["AgentID"].ToString();
|
||||
string token = request["AccessToken"].ToString();
|
||||
|
||||
m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token);
|
||||
if (!m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token))
|
||||
NullResult(result, "Internal error");
|
||||
else
|
||||
result["RESULT"] = "true";
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||
result["RESULT"] = "true";
|
||||
return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace OpenSim.Groups
|
|||
string method = request["METHOD"].ToString();
|
||||
request.Remove("METHOD");
|
||||
|
||||
m_log.DebugFormat("[Groups.Handler]: {0}", method);
|
||||
// m_log.DebugFormat("[Groups.Handler]: {0}", method);
|
||||
switch (method)
|
||||
{
|
||||
case "PUTGROUP":
|
||||
|
@ -285,11 +285,13 @@ namespace OpenSim.Groups
|
|||
string agentID = request["AgentID"].ToString();
|
||||
string requestingAgentID = request["RequestingAgentID"].ToString();
|
||||
|
||||
m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID);
|
||||
if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID))
|
||||
NullResult(result, string.Format("Insufficient permissions.", agentID));
|
||||
else
|
||||
result["RESULT"] = "true";
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||
result["RESULT"] = "true";
|
||||
return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
|
||||
}
|
||||
|
||||
|
@ -665,7 +667,11 @@ namespace OpenSim.Groups
|
|||
GroupInviteInfo invite = m_GroupsService.GetAgentToGroupInvite(request["RequestingAgentID"].ToString(),
|
||||
new UUID(request["InviteID"].ToString()));
|
||||
|
||||
result["RESULT"] = GroupsDataUtils.GroupInviteInfo(invite);
|
||||
if (invite != null)
|
||||
result["RESULT"] = GroupsDataUtils.GroupInviteInfo(invite);
|
||||
else
|
||||
result["RESULT"] = "NULL";
|
||||
|
||||
return Util.UTF8NoBomEncoding.GetBytes(ServerUtils.BuildXmlResponse(result));
|
||||
}
|
||||
|
||||
|
|
|
@ -393,13 +393,15 @@ namespace OpenSim.Groups
|
|||
return true;
|
||||
}
|
||||
|
||||
public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
|
||||
public bool RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
|
||||
{
|
||||
// check perms
|
||||
if (RequestingAgentID != AgentID && !HasPower(RequestingAgentID, GroupID, GroupPowers.Eject))
|
||||
return;
|
||||
return false;
|
||||
|
||||
_RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AddAgentToGroupInvite(string RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID, string agentID)
|
||||
|
|
|
@ -131,19 +131,27 @@ namespace OpenSim.Groups
|
|||
return true;
|
||||
}
|
||||
|
||||
public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID, string token)
|
||||
public bool RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID, string token)
|
||||
{
|
||||
// check the token
|
||||
MembershipData membership = m_Database.RetrieveMember(GroupID, AgentID);
|
||||
if (membership != null)
|
||||
{
|
||||
if (token != string.Empty && token.Equals(membership.Data["AccessToken"]))
|
||||
RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID);
|
||||
{
|
||||
return RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[Groups.HGGroupsService]: access token {0} did not match stored one {1}", token, membership.Data["AccessToken"]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[Groups.HGGroupsService]: membership not found for {0}", AgentID);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string groupName, string token)
|
||||
|
|
|
@ -215,18 +215,7 @@ namespace OpenSim.OfflineIM
|
|||
|
||||
rootElement.AppendChild(result);
|
||||
|
||||
return DocToBytes(doc);
|
||||
}
|
||||
|
||||
private byte[] DocToBytes(XmlDocument doc)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
||||
xw.Formatting = Formatting.Indented;
|
||||
doc.WriteTo(xw);
|
||||
xw.Flush();
|
||||
|
||||
return ms.ToArray();
|
||||
return Util.DocToBytes(doc);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -32,6 +32,7 @@ using log4net;
|
|||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenSim;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
|
@ -45,6 +46,12 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
|||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Controls whether we load modules from Mono.Addins.
|
||||
/// </summary>
|
||||
/// <remarks>For debug purposes. Defaults to true.</remarks>
|
||||
public bool LoadModulesFromAddins { get; set; }
|
||||
|
||||
// Config access
|
||||
private OpenSimBase m_openSim;
|
||||
|
||||
|
@ -61,6 +68,11 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
|||
private List<ISharedRegionModule> m_sharedInstances =
|
||||
new List<ISharedRegionModule>();
|
||||
|
||||
public RegionModulesControllerPlugin()
|
||||
{
|
||||
LoadModulesFromAddins = true;
|
||||
}
|
||||
|
||||
#region IApplicationPlugin implementation
|
||||
|
||||
public void Initialise (OpenSimBase openSim)
|
||||
|
@ -69,6 +81,9 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
|||
m_openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this);
|
||||
m_log.DebugFormat("[REGIONMODULES]: Initializing...");
|
||||
|
||||
if (!LoadModulesFromAddins)
|
||||
return;
|
||||
|
||||
// Who we are
|
||||
string id = AddinManager.CurrentAddin.Id;
|
||||
|
||||
|
@ -88,40 +103,8 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
|||
Dictionary<RuntimeAddin, IList<int>> loadedModules = new Dictionary<RuntimeAddin, IList<int>>();
|
||||
|
||||
// Scan modules and load all that aren't disabled
|
||||
foreach (TypeExtensionNode node in
|
||||
AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
|
||||
{
|
||||
IList<int> loadedModuleData;
|
||||
|
||||
if (!loadedModules.ContainsKey(node.Addin))
|
||||
loadedModules.Add(node.Addin, new List<int> { 0, 0, 0 });
|
||||
|
||||
loadedModuleData = loadedModules[node.Addin];
|
||||
|
||||
if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
|
||||
{
|
||||
if (CheckModuleEnabled(node, modulesConfig))
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_sharedModules.Add(node);
|
||||
loadedModuleData[0]++;
|
||||
}
|
||||
}
|
||||
else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
|
||||
{
|
||||
if (CheckModuleEnabled(node, modulesConfig))
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_nonSharedModules.Add(node);
|
||||
loadedModuleData[1]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
|
||||
loadedModuleData[2]++;
|
||||
}
|
||||
}
|
||||
foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/RegionModules"))
|
||||
AddNode(node, modulesConfig, loadedModules);
|
||||
|
||||
foreach (KeyValuePair<RuntimeAddin, IList<int>> loadedModuleData in loadedModules)
|
||||
{
|
||||
|
@ -194,6 +177,41 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
|||
|
||||
#region IPlugin implementation
|
||||
|
||||
private void AddNode(
|
||||
TypeExtensionNode node, IConfig modulesConfig, Dictionary<RuntimeAddin, IList<int>> loadedModules)
|
||||
{
|
||||
IList<int> loadedModuleData;
|
||||
|
||||
if (!loadedModules.ContainsKey(node.Addin))
|
||||
loadedModules.Add(node.Addin, new List<int> { 0, 0, 0 });
|
||||
|
||||
loadedModuleData = loadedModules[node.Addin];
|
||||
|
||||
if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
|
||||
{
|
||||
if (CheckModuleEnabled(node, modulesConfig))
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_sharedModules.Add(node);
|
||||
loadedModuleData[0]++;
|
||||
}
|
||||
}
|
||||
else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
|
||||
{
|
||||
if (CheckModuleEnabled(node, modulesConfig))
|
||||
{
|
||||
m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
|
||||
m_nonSharedModules.Add(node);
|
||||
loadedModuleData[1]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
|
||||
loadedModuleData[2]++;
|
||||
}
|
||||
}
|
||||
|
||||
// We don't do that here
|
||||
//
|
||||
public void Initialise ()
|
||||
|
@ -215,6 +233,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
|||
m_sharedInstances[0].Close();
|
||||
m_sharedInstances.RemoveAt(0);
|
||||
}
|
||||
|
||||
m_sharedModules.Clear();
|
||||
m_nonSharedModules.Clear();
|
||||
}
|
||||
|
|
|
@ -162,6 +162,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList);
|
||||
availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload);
|
||||
|
||||
// Land management
|
||||
availableMethods["admin_reset_land"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcResetLand);
|
||||
|
||||
// Either enable full remote functionality or just selected features
|
||||
string enabledMethods = m_config.GetString("enabled_methods", "all");
|
||||
|
||||
|
@ -2063,6 +2066,56 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
responseData["success"] = true;
|
||||
}
|
||||
|
||||
private void XmlRpcResetLand(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
string musicURL = string.Empty;
|
||||
UUID groupID = UUID.Zero;
|
||||
uint flags = 0;
|
||||
bool set_group = false, set_music = false, set_flags = false;
|
||||
|
||||
if (requestData.Contains("group") && requestData["group"] != null)
|
||||
set_group = UUID.TryParse(requestData["group"].ToString(), out groupID);
|
||||
if (requestData.Contains("music") && requestData["music"] != null)
|
||||
{
|
||||
musicURL = requestData["music"].ToString();
|
||||
set_music = true;
|
||||
}
|
||||
if (requestData.Contains("flags") && requestData["flags"] != null)
|
||||
set_flags = UInt32.TryParse(requestData["flags"].ToString(), out flags);
|
||||
|
||||
m_log.InfoFormat("[RADMIN]: Received Reset Land Request group={0} musicURL={1} flags={2}",
|
||||
(set_group ? groupID.ToString() : "unchanged"),
|
||||
(set_music ? musicURL : "unchanged"),
|
||||
(set_flags ? flags.ToString() : "unchanged"));
|
||||
|
||||
m_application.SceneManager.ForEachScene(delegate(Scene s)
|
||||
{
|
||||
List<ILandObject> parcels = s.LandChannel.AllParcels();
|
||||
foreach (ILandObject p in parcels)
|
||||
{
|
||||
if (set_music)
|
||||
p.LandData.MusicURL = musicURL;
|
||||
|
||||
if (set_group)
|
||||
p.LandData.GroupID = groupID;
|
||||
|
||||
if (set_flags)
|
||||
p.LandData.Flags = flags;
|
||||
|
||||
s.LandChannel.UpdateLandObject(p.LandData.LocalID, p.LandData);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
responseData["success"] = true;
|
||||
|
||||
m_log.Info("[RADMIN]: Reset Land Request complete");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parse a float with the given parameter name from a request data hash table.
|
||||
/// </summary>
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
|||
// Overkill - we only really need the asset service, not a whole scene.
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService, "TestGetTexture", null, null);
|
||||
GetTextureHandler handler = new GetTextureHandler("/gettexture", scene.AssetService, "TestGetTexture", null, null);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012");
|
||||
|
|
|
@ -68,7 +68,10 @@ namespace OpenSim.Framework.Capabilities
|
|||
/// <returns></returns>
|
||||
public static object LLSDDeserialize(byte[] b)
|
||||
{
|
||||
return LLSDDeserialize(new MemoryStream(b, false));
|
||||
using (MemoryStream ms = new MemoryStream(b, false))
|
||||
{
|
||||
return LLSDDeserialize(ms);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -78,21 +81,23 @@ namespace OpenSim.Framework.Capabilities
|
|||
/// <returns></returns>
|
||||
public static object LLSDDeserialize(Stream st)
|
||||
{
|
||||
XmlTextReader reader = new XmlTextReader(st);
|
||||
reader.Read();
|
||||
SkipWS(reader);
|
||||
using (XmlTextReader reader = new XmlTextReader(st))
|
||||
{
|
||||
reader.Read();
|
||||
SkipWS(reader);
|
||||
|
||||
if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd")
|
||||
throw new LLSDParseException("Expected <llsd>");
|
||||
if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "llsd")
|
||||
throw new LLSDParseException("Expected <llsd>");
|
||||
|
||||
reader.Read();
|
||||
object ret = LLSDParseOne(reader);
|
||||
SkipWS(reader);
|
||||
reader.Read();
|
||||
object ret = LLSDParseOne(reader);
|
||||
SkipWS(reader);
|
||||
|
||||
if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd")
|
||||
throw new LLSDParseException("Expected </llsd>");
|
||||
if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != "llsd")
|
||||
throw new LLSDParseException("Expected </llsd>");
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -29,7 +29,7 @@ using System.Collections.Generic;
|
|||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
namespace OpenSim.Data
|
||||
{
|
||||
public interface IEstateDataStore
|
||||
{
|
|
@ -52,12 +52,12 @@ namespace OpenSim.Data
|
|||
public int sizeY;
|
||||
|
||||
/// <summary>
|
||||
/// Return the x-coordinate of this region.
|
||||
/// Return the x-coordinate of this region in region units.
|
||||
/// </summary>
|
||||
public int coordX { get { return (int)Util.WorldToRegionLoc((uint)posX); } }
|
||||
|
||||
/// <summary>
|
||||
/// Return the y-coordinate of this region.
|
||||
/// Return the y-coordinate of this region in region units.
|
||||
/// </summary>
|
||||
public int coordY { get { return (int)Util.WorldToRegionLoc((uint)posY); } }
|
||||
|
||||
|
|
|
@ -145,7 +145,11 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.CommandText = sql;
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
return DoLoad(cmd, regionID, create);
|
||||
EstateSettings e = DoLoad(cmd, regionID, create);
|
||||
if (!create && e.EstateID == 0) // Not found
|
||||
return null;
|
||||
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,7 +431,10 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.CommandText = sql;
|
||||
cmd.Parameters.AddWithValue("?EstateID", estateID);
|
||||
|
||||
return DoLoad(cmd, UUID.Zero, false);
|
||||
EstateSettings e = DoLoad(cmd, UUID.Zero, false);
|
||||
if (e.EstateID != estateID)
|
||||
return null;
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ namespace OpenSim.Data.MySQL
|
|||
string query = string.Empty;
|
||||
|
||||
query += "DELETE FROM classifieds WHERE ";
|
||||
query += "classifieduuid = ?ClasifiedId";
|
||||
query += "classifieduuid = ?recordId";
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -260,12 +260,8 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?ClassifiedId", recordId.ToString());
|
||||
|
||||
lock(Lock)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
cmd.Parameters.AddWithValue("?recordId", recordId.ToString());
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ namespace OpenSim.Data.SQLite
|
|||
if (inventoryRow == null)
|
||||
{
|
||||
if (! add)
|
||||
m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.ID);
|
||||
m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existent inventory folder: {0}", folder.ID);
|
||||
|
||||
inventoryRow = inventoryFolderTable.NewRow();
|
||||
fillFolderRow(inventoryRow, folder);
|
||||
|
@ -298,7 +298,7 @@ namespace OpenSim.Data.SQLite
|
|||
if (inventoryRow == null)
|
||||
{
|
||||
if (!add)
|
||||
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.ID);
|
||||
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existent inventory item: {0}", item.ID);
|
||||
|
||||
inventoryRow = inventoryItemTable.NewRow();
|
||||
fillItemRow(inventoryRow, item);
|
||||
|
|
|
@ -520,6 +520,12 @@ namespace OpenSim.Framework
|
|||
if (!m_attachments.ContainsKey(attach.AttachPoint))
|
||||
m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
|
||||
|
||||
foreach (AvatarAttachment prev in m_attachments[attach.AttachPoint])
|
||||
{
|
||||
if (prev.ItemID == attach.ItemID)
|
||||
return;
|
||||
}
|
||||
|
||||
m_attachments[attach.AttachPoint].Add(attach);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace OpenSim.Framework
|
|||
public int assetThrottle;
|
||||
public int textureThrottle;
|
||||
public int totalThrottle;
|
||||
public int maxThrottle;
|
||||
|
||||
public Dictionary<string, int> SyncRequests = new Dictionary<string,int>();
|
||||
public Dictionary<string, int> AsyncRequests = new Dictionary<string,int>();
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace OpenSim.Framework.Communications
|
|||
/// other threads to execute, while it waits for a response from the web-service. RestClient itself can be
|
||||
/// invoked by the caller in either synchronous mode or asynchronous modes.
|
||||
/// </remarks>
|
||||
public class RestClient
|
||||
public class RestClient : IDisposable
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
@ -148,6 +148,33 @@ namespace OpenSim.Framework.Communications
|
|||
|
||||
#endregion constructors
|
||||
|
||||
|
||||
#region Dispose
|
||||
|
||||
private bool disposed = false;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
_resource.Dispose();
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
#endregion Dispose
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add a path element to the query, e.g. assets
|
||||
/// </summary>
|
||||
|
@ -296,6 +323,14 @@ namespace OpenSim.Framework.Communications
|
|||
|
||||
#endregion Async communications with server
|
||||
|
||||
/// <summary>
|
||||
/// Perform a synchronous request
|
||||
/// </summary>
|
||||
public Stream Request()
|
||||
{
|
||||
return Request(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform a synchronous request
|
||||
/// </summary>
|
||||
|
@ -312,6 +347,10 @@ namespace OpenSim.Framework.Communications
|
|||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
if (WebUtil.DebugLevel >= 3)
|
||||
m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
|
||||
|
||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||
try
|
||||
{
|
||||
|
@ -358,6 +397,9 @@ namespace OpenSim.Framework.Communications
|
|||
_resource.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
if (WebUtil.DebugLevel >= 5)
|
||||
WebUtil.LogResponseDetail(reqnum, _resource);
|
||||
|
||||
return _resource;
|
||||
}
|
||||
}
|
||||
|
@ -374,16 +416,18 @@ namespace OpenSim.Framework.Communications
|
|||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
|
||||
m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength);
|
||||
m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri());
|
||||
src.Seek(0, SeekOrigin.Begin);
|
||||
m_log.Info("[REST]: Seek is ok");
|
||||
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
if (WebUtil.DebugLevel >= 3)
|
||||
m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
|
||||
if (WebUtil.DebugLevel >= 5)
|
||||
WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src);
|
||||
|
||||
Stream dst = _request.GetRequestStream();
|
||||
m_log.Info("[REST]: GetRequestStream is ok");
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int length = src.Read(buf, 0, 1024);
|
||||
m_log.Info("[REST]: First Read is ok");
|
||||
while (length > 0)
|
||||
{
|
||||
dst.Write(buf, 0, length);
|
||||
|
@ -398,14 +442,29 @@ namespace OpenSim.Framework.Communications
|
|||
{
|
||||
m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}",
|
||||
RequestMethod, _request.RequestUri, e.Status, e.Message);
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[REST]: Request {0} {1} failed with exception {2} {3}",
|
||||
RequestMethod, _request.RequestUri, e.Message, e.StackTrace);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (WebUtil.DebugLevel >= 5)
|
||||
{
|
||||
using (Stream responseStream = _response.GetResponseStream())
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(responseStream))
|
||||
{
|
||||
string responseStr = reader.ReadToEnd();
|
||||
WebUtil.LogResponseDetail(reqnum, responseStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_response.Close();
|
||||
|
||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
|
@ -411,5 +412,23 @@ namespace OpenSim.Framework
|
|||
{
|
||||
return l_EstateGroups.Contains(groupID);
|
||||
}
|
||||
|
||||
public Dictionary<string, object> ToMap()
|
||||
{
|
||||
Dictionary<string, object> map = new Dictionary<string, object>();
|
||||
PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (PropertyInfo p in properties)
|
||||
map[p.Name] = p.GetValue(this, null);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public EstateSettings(Dictionary<string, object> map)
|
||||
{
|
||||
PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (PropertyInfo p in properties)
|
||||
p.SetValue(this, map[p.Name], null);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,19 +141,19 @@ namespace OpenSim.Framework.Monitoring
|
|||
processorPercentPerfCounter = new PerfCounterControl(tempPC);
|
||||
// A long time bug in mono is that CPU percent is reported as CPU percent idle. Windows reports CPU percent busy.
|
||||
tempStat = new Stat(tempName, tempName, "", "percent", CategoryServer, ContainerProcessor,
|
||||
StatType.Pull, (s) => { GetNextValue(s, processorPercentPerfCounter, Util.IsWindows() ? 1 : -1); },
|
||||
StatType.Pull, (s) => { GetNextValue(s, processorPercentPerfCounter); },
|
||||
StatVerbosity.Info);
|
||||
StatsManager.RegisterStat(tempStat);
|
||||
RegisteredStats.Add(tempName, tempStat);
|
||||
|
||||
MakeStat("TotalProcessorTime", null, "sec", ContainerProcessor,
|
||||
(s) => { s.Value = Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds; });
|
||||
(s) => { s.Value = Math.Round(Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds, 3); });
|
||||
|
||||
MakeStat("UserProcessorTime", null, "sec", ContainerProcessor,
|
||||
(s) => { s.Value = Process.GetCurrentProcess().UserProcessorTime.TotalSeconds; });
|
||||
(s) => { s.Value = Math.Round(Process.GetCurrentProcess().UserProcessorTime.TotalSeconds, 3); });
|
||||
|
||||
MakeStat("PrivilegedProcessorTime", null, "sec", ContainerProcessor,
|
||||
(s) => { s.Value = Process.GetCurrentProcess().PrivilegedProcessorTime.TotalSeconds; });
|
||||
(s) => { s.Value = Math.Round(Process.GetCurrentProcess().PrivilegedProcessorTime.TotalSeconds, 3); });
|
||||
|
||||
MakeStat("Threads", null, "threads", ContainerProcessor,
|
||||
(s) => { s.Value = Process.GetCurrentProcess().Threads.Count; });
|
||||
|
@ -253,11 +253,8 @@ namespace OpenSim.Framework.Monitoring
|
|||
// "How to get the CPU Usage in C#": http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c
|
||||
// "Mono Performance Counters": http://www.mono-project.com/Mono_Performance_Counters
|
||||
private delegate double PerfCounterNextValue();
|
||||
|
||||
private void GetNextValue(Stat stat, PerfCounterControl perfControl)
|
||||
{
|
||||
GetNextValue(stat, perfControl, 1.0);
|
||||
}
|
||||
private void GetNextValue(Stat stat, PerfCounterControl perfControl, double factor)
|
||||
{
|
||||
if (Util.EnvironmentTickCountSubtract(perfControl.lastFetch) > performanceCounterSampleInterval)
|
||||
{
|
||||
|
@ -265,16 +262,13 @@ namespace OpenSim.Framework.Monitoring
|
|||
{
|
||||
try
|
||||
{
|
||||
// Kludge for factor to run double duty. If -1, subtract the value from one
|
||||
if (factor == -1)
|
||||
stat.Value = 1 - perfControl.perfCounter.NextValue();
|
||||
else
|
||||
stat.Value = perfControl.perfCounter.NextValue() / factor;
|
||||
stat.Value = Math.Round(perfControl.perfCounter.NextValue(), 3);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("{0} Exception on NextValue fetching {1}: {2}", LogHeader, stat.Name, e);
|
||||
}
|
||||
|
||||
perfControl.lastFetch = Util.EnvironmentTickCount();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,18 +70,18 @@ namespace OpenSim.Framework.Monitoring
|
|||
{
|
||||
ICommandConsole con = MainConsole.Instance;
|
||||
|
||||
if (cmd.Length != 4)
|
||||
if (cmd.Length != 3)
|
||||
{
|
||||
con.Output("Usage: debug stats record start|stop");
|
||||
con.Output("Usage: stats record start|stop");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd[3] == "start")
|
||||
if (cmd[2] == "start")
|
||||
{
|
||||
Start();
|
||||
con.OutputFormat("Now recording all stats to file every {0}ms", m_statsLogIntervalMs);
|
||||
}
|
||||
else if (cmd[3] == "stop")
|
||||
else if (cmd[2] == "stop")
|
||||
{
|
||||
Stop();
|
||||
con.Output("Stopped recording stats to file.");
|
||||
|
|
|
@ -101,7 +101,6 @@ namespace OpenSim.Framework
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly string LogHeader = "[REGION INFO]";
|
||||
|
||||
public bool commFailTF = false;
|
||||
public string RegionFile = String.Empty;
|
||||
public bool isSandbox = false;
|
||||
public bool Persistent = true;
|
||||
|
@ -147,8 +146,29 @@ namespace OpenSim.Framework
|
|||
public uint WorldLocX = 0;
|
||||
public uint WorldLocY = 0;
|
||||
public uint WorldLocZ = 0;
|
||||
|
||||
/// <summary>
|
||||
/// X dimension of the region.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If this is a varregion then the default size set here will be replaced when we load the region config.
|
||||
/// </remarks>
|
||||
public uint RegionSizeX = Constants.RegionSize;
|
||||
|
||||
/// <summary>
|
||||
/// X dimension of the region.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If this is a varregion then the default size set here will be replaced when we load the region config.
|
||||
/// </remarks>
|
||||
public uint RegionSizeY = Constants.RegionSize;
|
||||
|
||||
/// <summary>
|
||||
/// Z dimension of the region.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// XXX: Unknown if this accounts for regions with negative Z.
|
||||
/// </remarks>
|
||||
public uint RegionSizeZ = Constants.RegionHeight;
|
||||
|
||||
private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>();
|
||||
|
@ -860,11 +880,6 @@ namespace OpenSim.Framework
|
|||
config.Set("MaptileStaticFile", MaptileStaticFile);
|
||||
}
|
||||
|
||||
public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SaveRegionToFile(string description, string filename)
|
||||
{
|
||||
if (filename.ToLower().EndsWith(".ini"))
|
||||
|
|
|
@ -45,6 +45,7 @@ using OpenSim.Framework.Monitoring;
|
|||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using Timer=System.Timers.Timer;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Framework.Servers
|
||||
{
|
||||
|
@ -55,10 +56,16 @@ namespace OpenSim.Framework.Servers
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Used by tests to suppress Environment.Exit(0) so that post-run operations are possible.
|
||||
/// </summary>
|
||||
public bool SuppressExit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This will control a periodic log printout of the current 'show stats' (if they are active) for this
|
||||
/// server.
|
||||
/// </summary>
|
||||
private int m_periodDiagnosticTimerMS = 60 * 60 * 1000;
|
||||
private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
|
||||
|
||||
/// <summary>
|
||||
|
@ -77,8 +84,6 @@ namespace OpenSim.Framework.Servers
|
|||
// Random uuid for private data
|
||||
m_osSecret = UUID.Random().ToString();
|
||||
|
||||
m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
|
||||
m_periodicDiagnosticsTimer.Enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -89,6 +94,16 @@ namespace OpenSim.Framework.Servers
|
|||
StatsManager.SimExtraStats = new SimExtraStatsCollector();
|
||||
RegisterCommonCommands();
|
||||
RegisterCommonComponents(Config);
|
||||
|
||||
IConfig startupConfig = Config.Configs["Startup"];
|
||||
int logShowStatsSeconds = startupConfig.GetInt("LogShowStatsSeconds", m_periodDiagnosticTimerMS / 1000);
|
||||
m_periodDiagnosticTimerMS = logShowStatsSeconds * 1000;
|
||||
m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
|
||||
if (m_periodDiagnosticTimerMS != 0)
|
||||
{
|
||||
m_periodicDiagnosticsTimer.Interval = m_periodDiagnosticTimerMS;
|
||||
m_periodicDiagnosticsTimer.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ShutdownSpecific()
|
||||
|
@ -99,7 +114,8 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
base.ShutdownSpecific();
|
||||
|
||||
Environment.Exit(0);
|
||||
if (!SuppressExit)
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -832,28 +832,40 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
return; // never log these; they're just binary data
|
||||
|
||||
Stream inputStream = Util.Copy(request.InputStream);
|
||||
|
||||
if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
|
||||
inputStream = new GZipStream(inputStream, System.IO.Compression.CompressionMode.Decompress);
|
||||
|
||||
using (StreamReader reader = new StreamReader(inputStream, Encoding.UTF8))
|
||||
Stream innerStream = null;
|
||||
try
|
||||
{
|
||||
string output;
|
||||
|
||||
if (DebugLevel == 5)
|
||||
if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
|
||||
{
|
||||
char[] chars = new char[WebUtil.MaxRequestDiagLength + 1]; // +1 so we know to add "..." only if needed
|
||||
int len = reader.Read(chars, 0, WebUtil.MaxRequestDiagLength + 1);
|
||||
output = new string(chars, 0, Math.Min(len, WebUtil.MaxRequestDiagLength));
|
||||
if (len > WebUtil.MaxRequestDiagLength)
|
||||
output += "...";
|
||||
}
|
||||
else
|
||||
{
|
||||
output = reader.ReadToEnd();
|
||||
innerStream = inputStream;
|
||||
inputStream = new GZipStream(innerStream, System.IO.Compression.CompressionMode.Decompress);
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[LOGHTTP] {0}", Util.BinaryToASCII(output));
|
||||
using (StreamReader reader = new StreamReader(inputStream, Encoding.UTF8))
|
||||
{
|
||||
string output;
|
||||
|
||||
if (DebugLevel == 5)
|
||||
{
|
||||
char[] chars = new char[WebUtil.MaxRequestDiagLength + 1]; // +1 so we know to add "..." only if needed
|
||||
int len = reader.Read(chars, 0, WebUtil.MaxRequestDiagLength + 1);
|
||||
output = new string(chars, 0, Math.Min(len, WebUtil.MaxRequestDiagLength));
|
||||
if (len > WebUtil.MaxRequestDiagLength)
|
||||
output += "...";
|
||||
}
|
||||
else
|
||||
{
|
||||
output = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[LOGHTTP] {0}", Util.BinaryToASCII(output));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (innerStream != null)
|
||||
innerStream.Dispose();
|
||||
inputStream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -981,19 +993,33 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// <param name="response"></param>
|
||||
private byte[] HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
|
||||
{
|
||||
String requestBody;
|
||||
|
||||
Stream requestStream = request.InputStream;
|
||||
Stream innerStream = null;
|
||||
try
|
||||
{
|
||||
if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
|
||||
{
|
||||
innerStream = requestStream;
|
||||
requestStream = new GZipStream(innerStream, System.IO.Compression.CompressionMode.Decompress);
|
||||
}
|
||||
|
||||
if ((request.Headers["Content-Encoding"] == "gzip") || (request.Headers["X-Content-Encoding"] == "gzip"))
|
||||
requestStream = new GZipStream(requestStream, System.IO.Compression.CompressionMode.Decompress);
|
||||
using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8))
|
||||
{
|
||||
requestBody = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (innerStream != null)
|
||||
innerStream.Dispose();
|
||||
requestStream.Dispose();
|
||||
}
|
||||
|
||||
Encoding encoding = Encoding.UTF8;
|
||||
StreamReader reader = new StreamReader(requestStream, encoding);
|
||||
|
||||
string requestBody = reader.ReadToEnd();
|
||||
reader.Close();
|
||||
requestStream.Close();
|
||||
//m_log.Debug(requestBody);
|
||||
requestBody = requestBody.Replace("<base64></base64>", "");
|
||||
|
||||
string responseString = String.Empty;
|
||||
XmlRpcRequest xmlRprcRequest = null;
|
||||
|
||||
|
@ -1089,18 +1115,16 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
response.ContentType = "text/xml";
|
||||
using (MemoryStream outs = new MemoryStream())
|
||||
using (XmlTextWriter writer = new XmlTextWriter(outs, Encoding.UTF8))
|
||||
{
|
||||
using (XmlTextWriter writer = new XmlTextWriter(outs, Encoding.UTF8))
|
||||
writer.Formatting = Formatting.None;
|
||||
XmlRpcResponseSerializer.Singleton.Serialize(writer, xmlRpcResponse);
|
||||
writer.Flush();
|
||||
outs.Flush();
|
||||
outs.Position = 0;
|
||||
using (StreamReader sr = new StreamReader(outs))
|
||||
{
|
||||
writer.Formatting = Formatting.None;
|
||||
XmlRpcResponseSerializer.Singleton.Serialize(writer, xmlRpcResponse);
|
||||
writer.Flush();
|
||||
outs.Flush();
|
||||
outs.Position = 0;
|
||||
using (StreamReader sr = new StreamReader(outs))
|
||||
{
|
||||
responseString = sr.ReadToEnd();
|
||||
}
|
||||
responseString = sr.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
|
@ -61,6 +62,24 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
Description = description;
|
||||
m_httpMethod = httpMethod;
|
||||
m_path = path;
|
||||
|
||||
// FIXME: A very temporary measure to stop the simulator stats being overwhelmed with user CAPS info.
|
||||
// Needs to be fixed properly in stats display
|
||||
if (!path.StartsWith("/CAPS/"))
|
||||
{
|
||||
StatsManager.RegisterStat(
|
||||
new Stat(
|
||||
"requests",
|
||||
"requests",
|
||||
"Number of requests received by this service endpoint",
|
||||
"requests",
|
||||
"service",
|
||||
string.Format("{0}:{1}", httpMethod, path),
|
||||
StatType.Pull,
|
||||
MeasuresOfInterest.AverageChangeOverTime,
|
||||
s => s.Value = RequestsReceived,
|
||||
StatVerbosity.Debug));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string Path
|
||||
|
|
|
@ -52,23 +52,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
request.Method = verb;
|
||||
request.ContentType = "text/xml";
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
serializer.Serialize(writer, obj);
|
||||
writer.Flush();
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
serializer.Serialize(writer, obj);
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
int length = (int)buffer.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
}
|
||||
|
||||
int length = (int) buffer.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
Stream requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
// IAsyncResult result = request.BeginGetResponse(AsyncCallback, request);
|
||||
request.BeginGetResponse(AsyncCallback, request);
|
||||
}
|
||||
|
|
|
@ -60,24 +60,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
request.ContentType = "text/xml";
|
||||
request.Timeout = 10000;
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
serializer.Serialize(writer, obj);
|
||||
writer.Flush();
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
serializer.Serialize(writer, obj);
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
int length = (int)buffer.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
}
|
||||
|
||||
int length = (int) buffer.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
Stream requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
requestStream.Close();
|
||||
// IAsyncResult result = request.BeginGetResponse(AsyncCallback, request);
|
||||
request.BeginGetResponse(AsyncCallback, request);
|
||||
}
|
||||
|
|
|
@ -77,26 +77,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
request.ContentType = "text/xml";
|
||||
request.Timeout = 20000;
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
serializer.Serialize(writer, sobj);
|
||||
writer.Flush();
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
serializer.Serialize(writer, sobj);
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
int length = (int)buffer.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
}
|
||||
|
||||
int length = (int)buffer.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
Stream requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
buffer.Close();
|
||||
requestStream.Close();
|
||||
|
||||
TResponse deserial = default(TResponse);
|
||||
using (WebResponse resp = request.GetResponse())
|
||||
{
|
||||
|
@ -133,25 +132,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
request.ContentType = "text/xml";
|
||||
request.Timeout = 10000;
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
serializer.Serialize(writer, sobj);
|
||||
writer.Flush();
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(type);
|
||||
serializer.Serialize(writer, sobj);
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
int length = (int)buffer.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
}
|
||||
buffer.Close();
|
||||
|
||||
int length = (int)buffer.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
Stream requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
requestStream.Close();
|
||||
// IAsyncResult result = request.BeginGetResponse(AsyncCallback, request);
|
||||
request.BeginGetResponse(AsyncCallback, request);
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ namespace OpenSim
|
|||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.8.0";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
private const string VERSION_NUMBER = "0.8.0.2";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Post_Fixes;
|
||||
|
||||
public enum Flavour
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ namespace OpenSim
|
|||
Dev,
|
||||
RC1,
|
||||
RC2,
|
||||
RC3,
|
||||
Release,
|
||||
Post_Fixes,
|
||||
Extended
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// A thread-safe Random since the .NET version is not.
|
||||
/// See http://msdn.microsoft.com/en-us/library/system.random%28v=vs.100%29.aspx
|
||||
/// </summary>
|
||||
public class ThreadSafeRandom : Random
|
||||
{
|
||||
public ThreadSafeRandom() : base() {}
|
||||
|
||||
public ThreadSafeRandom(int seed): base (seed) {}
|
||||
|
||||
public override int Next()
|
||||
{
|
||||
lock (this)
|
||||
return base.Next();
|
||||
}
|
||||
|
||||
public override int Next(int maxValue)
|
||||
{
|
||||
lock (this)
|
||||
return base.Next(maxValue);
|
||||
}
|
||||
|
||||
public override int Next(int minValue, int maxValue)
|
||||
{
|
||||
lock (this)
|
||||
return base.Next(minValue, maxValue);
|
||||
}
|
||||
|
||||
public override void NextBytes(byte[] buffer)
|
||||
{
|
||||
lock (this)
|
||||
base.NextBytes(buffer);
|
||||
}
|
||||
|
||||
public override double NextDouble()
|
||||
{
|
||||
lock (this)
|
||||
return base.NextDouble();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -138,7 +138,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private static uint nextXferID = 5000;
|
||||
private static Random randomClass = new Random();
|
||||
private static Random randomClass = new ThreadSafeRandom();
|
||||
|
||||
// Get a list of invalid file characters (OS dependent)
|
||||
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
|
||||
|
@ -509,6 +509,19 @@ namespace OpenSim.Framework
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static byte[] DocToBytes(XmlDocument doc)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
using (XmlTextWriter xw = new XmlTextWriter(ms, null))
|
||||
{
|
||||
xw.Formatting = Formatting.Indented;
|
||||
doc.WriteTo(xw);
|
||||
xw.Flush();
|
||||
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is the platform Windows?
|
||||
/// </summary>
|
||||
|
@ -1307,46 +1320,6 @@ namespace OpenSim.Framework
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static string Compress(string text)
|
||||
{
|
||||
byte[] buffer = Util.UTF8.GetBytes(text);
|
||||
MemoryStream memory = new MemoryStream();
|
||||
using (GZipStream compressor = new GZipStream(memory, CompressionMode.Compress, true))
|
||||
{
|
||||
compressor.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
memory.Position = 0;
|
||||
|
||||
byte[] compressed = new byte[memory.Length];
|
||||
memory.Read(compressed, 0, compressed.Length);
|
||||
|
||||
byte[] compressedBuffer = new byte[compressed.Length + 4];
|
||||
Buffer.BlockCopy(compressed, 0, compressedBuffer, 4, compressed.Length);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(buffer.Length), 0, compressedBuffer, 0, 4);
|
||||
return Convert.ToBase64String(compressedBuffer);
|
||||
}
|
||||
|
||||
public static string Decompress(string compressedText)
|
||||
{
|
||||
byte[] compressedBuffer = Convert.FromBase64String(compressedText);
|
||||
using (MemoryStream memory = new MemoryStream())
|
||||
{
|
||||
int msgLength = BitConverter.ToInt32(compressedBuffer, 0);
|
||||
memory.Write(compressedBuffer, 4, compressedBuffer.Length - 4);
|
||||
|
||||
byte[] buffer = new byte[msgLength];
|
||||
|
||||
memory.Position = 0;
|
||||
using (GZipStream decompressor = new GZipStream(memory, CompressionMode.Decompress))
|
||||
{
|
||||
decompressor.Read(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
return Util.UTF8.GetString(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy data from one stream to another, leaving the read position of both streams at the beginning.
|
||||
/// </summary>
|
||||
|
@ -1964,10 +1937,15 @@ namespace OpenSim.Framework
|
|||
{
|
||||
if (maxThreads < 2)
|
||||
throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2");
|
||||
|
||||
if (minThreads > maxThreads || minThreads < 2)
|
||||
throw new ArgumentOutOfRangeException("minThreads", "minThreads must be greater than 2 and less than or equal to maxThreads");
|
||||
|
||||
if (m_ThreadPool != null)
|
||||
throw new InvalidOperationException("SmartThreadPool is already initialized");
|
||||
{
|
||||
m_log.Warn("SmartThreadPool is already initialized. Ignoring request.");
|
||||
return;
|
||||
}
|
||||
|
||||
STPStartInfo startInfo = new STPStartInfo();
|
||||
startInfo.ThreadPoolName = "Util";
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace OpenSim.Framework
|
|||
/// <summary>
|
||||
/// Request number for diagnostic purposes.
|
||||
/// </summary>
|
||||
public static int RequestNumber { get; internal set; }
|
||||
public static int RequestNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Control where OSD requests should be serialized per endpoint.
|
||||
|
@ -176,7 +176,8 @@ namespace OpenSim.Framework
|
|||
|
||||
public static void LogOutgoingDetail(string context, Stream outputStream)
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(Util.Copy(outputStream), Encoding.UTF8))
|
||||
using (Stream stream = Util.Copy(outputStream))
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
string output;
|
||||
|
||||
|
@ -262,12 +263,12 @@ namespace OpenSim.Framework
|
|||
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress))
|
||||
using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress, true))
|
||||
{
|
||||
comp.Write(buffer, 0, buffer.Length);
|
||||
// We need to close the gzip stream before we write it anywhere
|
||||
// because apparently something important related to gzip compression
|
||||
// gets written on the strteam upon Dispose()
|
||||
// gets written on the stream upon Dispose()
|
||||
}
|
||||
byte[] buf = ms.ToArray();
|
||||
request.ContentLength = buf.Length; //Count bytes to send
|
||||
|
|
|
@ -921,7 +921,7 @@ namespace OpenSim
|
|||
|
||||
foreach (IRegionModuleBase module in scene.RegionModules.Values)
|
||||
{
|
||||
if (module.GetType().GetInterface("ISharedRegionModule") != null)
|
||||
if (module.GetType().GetInterface("ISharedRegionModule") == null)
|
||||
nonSharedModules.Add(module);
|
||||
else
|
||||
sharedModules.Add(module);
|
||||
|
@ -943,6 +943,7 @@ namespace OpenSim
|
|||
cdt.AddColumn("Name", ConsoleDisplayUtil.RegionNameSize);
|
||||
cdt.AddColumn("ID", ConsoleDisplayUtil.UuidSize);
|
||||
cdt.AddColumn("Position", ConsoleDisplayUtil.CoordTupleSize);
|
||||
cdt.AddColumn("Size", 11);
|
||||
cdt.AddColumn("Port", ConsoleDisplayUtil.PortSize);
|
||||
cdt.AddColumn("Ready?", 6);
|
||||
cdt.AddColumn("Estate", ConsoleDisplayUtil.EstateNameSize);
|
||||
|
@ -951,8 +952,13 @@ namespace OpenSim
|
|||
{
|
||||
RegionInfo ri = scene.RegionInfo;
|
||||
cdt.AddRow(
|
||||
ri.RegionName, ri.RegionID, string.Format("{0},{1}", ri.RegionLocX, ri.RegionLocY),
|
||||
ri.InternalEndPoint.Port, scene.Ready ? "Yes" : "No", ri.EstateSettings.EstateName);
|
||||
ri.RegionName,
|
||||
ri.RegionID,
|
||||
string.Format("{0},{1}", ri.RegionLocX, ri.RegionLocY),
|
||||
string.Format("{0}x{1}", ri.RegionSizeX, ri.RegionSizeY),
|
||||
ri.InternalEndPoint.Port,
|
||||
scene.Ready ? "Yes" : "No",
|
||||
ri.EstateSettings.EstateName);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -71,6 +71,20 @@ namespace OpenSim
|
|||
// OpenSim.ini Section name for ESTATES Settings
|
||||
public const string ESTATE_SECTION_NAME = "Estates";
|
||||
|
||||
/// <summary>
|
||||
/// Allow all plugin loading to be disabled for tests/debug.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// true by default
|
||||
/// </remarks>
|
||||
public bool EnableInitialPluginLoad { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Control whether we attempt to load an estate data service.
|
||||
/// </summary>
|
||||
/// <remarks>For tests/debugging</remarks>
|
||||
public bool LoadEstateDataService { get; set; }
|
||||
|
||||
protected string proxyUrl;
|
||||
protected int proxyOffset = 0;
|
||||
|
||||
|
@ -96,7 +110,7 @@ namespace OpenSim
|
|||
|
||||
public ConsoleCommand CreateAccount = null;
|
||||
|
||||
protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
|
||||
public List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
|
||||
|
||||
/// <value>
|
||||
/// The config information passed into the OpenSimulator region server.
|
||||
|
@ -135,6 +149,8 @@ namespace OpenSim
|
|||
/// <param name="configSource"></param>
|
||||
public OpenSimBase(IConfigSource configSource) : base()
|
||||
{
|
||||
EnableInitialPluginLoad = true;
|
||||
LoadEstateDataService = true;
|
||||
LoadConfigSettings(configSource);
|
||||
}
|
||||
|
||||
|
@ -240,20 +256,25 @@ namespace OpenSim
|
|||
if (String.IsNullOrEmpty(module))
|
||||
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
|
||||
|
||||
m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { Config });
|
||||
if (m_estateDataService == null)
|
||||
throw new Exception(
|
||||
string.Format(
|
||||
"Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.",
|
||||
module));
|
||||
if (LoadEstateDataService)
|
||||
{
|
||||
m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { Config });
|
||||
if (m_estateDataService == null)
|
||||
throw new Exception(
|
||||
string.Format(
|
||||
"Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.",
|
||||
module));
|
||||
}
|
||||
|
||||
base.StartupSpecific();
|
||||
|
||||
LoadPlugins();
|
||||
if (EnableInitialPluginLoad)
|
||||
LoadPlugins();
|
||||
|
||||
// We still want to post initalize any plugins even if loading has been disabled since a test may have
|
||||
// inserted them manually.
|
||||
foreach (IApplicationPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.PostInitialise();
|
||||
}
|
||||
|
||||
if (m_console != null)
|
||||
AddPluginCommands(m_console);
|
||||
|
@ -878,6 +899,9 @@ namespace OpenSim
|
|||
try
|
||||
{
|
||||
SceneManager.Close();
|
||||
|
||||
foreach (IApplicationPlugin plugin in m_plugins)
|
||||
plugin.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -44,6 +44,7 @@ using OpenSim.Region.Framework.Scenes;
|
|||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.Client;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
@ -536,6 +537,42 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
OSDArray texture_list = (OSDArray)request["texture_list"];
|
||||
SceneObjectGroup grp = null;
|
||||
|
||||
InventoryFolderBase textureUploadFolder = null;
|
||||
|
||||
List<InventoryFolderBase> foldersToUpdate = new List<InventoryFolderBase>();
|
||||
List<InventoryItemBase> itemsToUpdate = new List<InventoryItemBase>();
|
||||
IClientInventory clientInv = null;
|
||||
|
||||
if (texture_list.Count > 0)
|
||||
{
|
||||
ScenePresence avatar = null;
|
||||
IClientAPI client = null;
|
||||
m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar);
|
||||
|
||||
if (avatar != null)
|
||||
{
|
||||
IClientCore core = (IClientCore)avatar.ControllingClient;
|
||||
|
||||
if (core.TryGet<IClientInventory>(out clientInv))
|
||||
{
|
||||
var systemTextureFolder = m_Scene.InventoryService.GetFolderForType(m_HostCapsObj.AgentID, AssetType.Texture);
|
||||
textureUploadFolder = new InventoryFolderBase(UUID.Random(), assetName, m_HostCapsObj.AgentID, (short)AssetType.Unknown, systemTextureFolder.ID, 1);
|
||||
if (m_Scene.InventoryService.AddFolder(textureUploadFolder))
|
||||
{
|
||||
foldersToUpdate.Add(textureUploadFolder);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[BUNCH OF CAPS]: Created new folder '{0}' ({1}) for textures uploaded with mesh object {2}",
|
||||
textureUploadFolder.Name, textureUploadFolder.ID, assetName);
|
||||
}
|
||||
else
|
||||
{
|
||||
textureUploadFolder = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<UUID> textures = new List<UUID>();
|
||||
for (int i = 0; i < texture_list.Count; i++)
|
||||
{
|
||||
|
@ -543,6 +580,38 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
textureAsset.Data = texture_list[i].AsBinary();
|
||||
m_assetService.Store(textureAsset);
|
||||
textures.Add(textureAsset.FullID);
|
||||
|
||||
if (textureUploadFolder != null)
|
||||
{
|
||||
InventoryItemBase textureItem = new InventoryItemBase();
|
||||
textureItem.Owner = m_HostCapsObj.AgentID;
|
||||
textureItem.CreatorId = m_HostCapsObj.AgentID.ToString();
|
||||
textureItem.CreatorData = String.Empty;
|
||||
textureItem.ID = UUID.Random();
|
||||
textureItem.AssetID = textureAsset.FullID;
|
||||
textureItem.Description = assetDescription;
|
||||
textureItem.Name = assetName + " - Texture " + (i + 1).ToString();
|
||||
textureItem.AssetType = (int)AssetType.Texture;
|
||||
textureItem.InvType = (int)InventoryType.Texture;
|
||||
textureItem.Folder = textureUploadFolder.ID;
|
||||
textureItem.CurrentPermissions
|
||||
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
|
||||
textureItem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
|
||||
textureItem.EveryOnePermissions = 0;
|
||||
textureItem.NextPermissions = (uint)PermissionMask.All;
|
||||
textureItem.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
m_Scene.InventoryService.AddItem(textureItem);
|
||||
itemsToUpdate.Add(textureItem);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[BUNCH OF CAPS]: Created new inventory item '{0}' ({1}) for texture uploaded with mesh object {2}",
|
||||
textureItem.Name, textureItem.ID, assetName);
|
||||
}
|
||||
}
|
||||
|
||||
if (clientInv != null && (foldersToUpdate.Count > 0 || itemsToUpdate.Count > 0))
|
||||
{
|
||||
clientInv.SendBulkUpdateInventory(foldersToUpdate.ToArray(), itemsToUpdate.ToArray());
|
||||
}
|
||||
|
||||
for (int i = 0; i < mesh_list.Count; i++)
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
"debug eq [0|1|2]",
|
||||
"Turn on event queue debugging\n"
|
||||
+ " <= 0 - turns off all event queue logging\n"
|
||||
+ " >= 1 - turns on outgoing event logging\n"
|
||||
+ " >= 1 - turns on event queue setup and outgoing event logging\n"
|
||||
+ " >= 2 - turns on poll notification",
|
||||
HandleDebugEq);
|
||||
|
||||
|
@ -188,9 +188,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
{
|
||||
if (!queues.ContainsKey(agentId))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
|
||||
agentId, m_scene.RegionInfo.RegionName);
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat(
|
||||
"[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
|
||||
agentId, m_scene.RegionInfo.RegionName);
|
||||
|
||||
queues[agentId] = new Queue<OSD>();
|
||||
}
|
||||
|
||||
|
@ -302,9 +304,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
{
|
||||
// Register an event queue for the client
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
|
||||
agentID, caps, m_scene.RegionInfo.RegionName);
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat(
|
||||
"[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
|
||||
agentID, caps, m_scene.RegionInfo.RegionName);
|
||||
|
||||
// Let's instantiate a Queue for this agent right now
|
||||
TryGetQueue(agentID);
|
||||
|
@ -720,8 +723,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>",
|
||||
LogHeader, handle, avatarID, regionSizeX, regionSizeY);
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}",
|
||||
LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY);
|
||||
|
||||
OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY);
|
||||
Enqueue(item, avatarID);
|
||||
|
@ -730,8 +734,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath,
|
||||
ulong regionHandle, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>",
|
||||
LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY);
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, endPoint={2}, avatarID={3}",
|
||||
LogHeader, regionHandle, endPoint, avatarID, regionSizeX, regionSizeY);
|
||||
|
||||
OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY);
|
||||
Enqueue(item, avatarID);
|
||||
}
|
||||
|
@ -741,8 +747,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
uint locationID, uint flags, string capsURL,
|
||||
UUID avatarID, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize=<{3},{4}>",
|
||||
LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY);
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, endPoint={2}, avatarID={3}",
|
||||
LogHeader, regionHandle, regionExternalEndPoint, avatarID, regionSizeX, regionSizeY);
|
||||
|
||||
OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint,
|
||||
locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY);
|
||||
|
@ -753,8 +760,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
IPEndPoint newRegionExternalEndPoint,
|
||||
string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
|
||||
LogHeader, handle, avatarID, regionSizeX, regionSizeY);
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
|
||||
LogHeader, handle, avatarID, regionSizeX, regionSizeY);
|
||||
|
||||
OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint,
|
||||
capsURL, avatarID, sessionID, regionSizeX, regionSizeY);
|
||||
|
@ -819,4 +827,4 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
Enqueue(item, avatarID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -63,8 +63,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
public List<UUID> folders;
|
||||
}
|
||||
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Control whether requests will be processed asynchronously.
|
||||
|
@ -438,7 +437,18 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
|
||||
if (poolreq != null && poolreq.thepoll != null)
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
{
|
||||
try
|
||||
{
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[INVENTORY]: Failed to process queued inventory request {0} for {1} in {2}. Exception {3}",
|
||||
poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", Scene.Name, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1467,10 +1467,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
mapReply.Data[i].Access = mapBlocks2[i].Access;
|
||||
mapReply.Data[i].Agents = mapBlocks2[i].Agents;
|
||||
|
||||
// TODO: hookup varregion sim size here
|
||||
mapReply.Size[i] = new MapBlockReplyPacket.SizeBlock();
|
||||
mapReply.Size[i].SizeX = 256;
|
||||
mapReply.Size[i].SizeY = 256;
|
||||
mapReply.Size[i].SizeX = mapBlocks2[i].SizeX;
|
||||
mapReply.Size[i].SizeY = mapBlocks2[i].SizeY;
|
||||
}
|
||||
OutPacket(mapReply, ThrottleOutPacketType.Land);
|
||||
}
|
||||
|
@ -11773,7 +11772,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <returns></returns>
|
||||
protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
|
||||
{
|
||||
//m_log.Debug("texture cached: " + packet.ToString());
|
||||
AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
|
||||
AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
|
||||
|
||||
|
@ -11789,24 +11787,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
cachedresp.WearableData =
|
||||
new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
|
||||
|
||||
//IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>();
|
||||
// var item = fac.GetBakedTextureFaces(AgentId);
|
||||
//WearableCacheItem[] items = fac.GetCachedItems(AgentId);
|
||||
|
||||
IAssetService cache = m_scene.AssetService;
|
||||
IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||
//bakedTextureModule = null;
|
||||
int maxWearablesLoop = cachedtex.WearableData.Length;
|
||||
if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
|
||||
maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
|
||||
|
||||
// Find the cached baked textures for this user, if they're available
|
||||
|
||||
IAssetService cache = m_scene.AssetService;
|
||||
IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||
|
||||
WearableCacheItem[] cacheItems = null;
|
||||
|
||||
if (bakedTextureModule != null && cache != null)
|
||||
{
|
||||
// We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid
|
||||
|
||||
WearableCacheItem[] cacheItems = null;
|
||||
ScenePresence p = m_scene.GetScenePresence(AgentId);
|
||||
if (p.Appearance != null)
|
||||
{
|
||||
if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty)
|
||||
{
|
||||
try
|
||||
|
@ -11815,22 +11811,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
p.Appearance.WearableCacheItems = cacheItems;
|
||||
p.Appearance.WearableCacheItemsDirty = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception!
|
||||
*
|
||||
catch (System.Net.Sockets.SocketException)
|
||||
{
|
||||
cacheItems = null;
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
cacheItems = null;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
cacheItems = null;
|
||||
} */
|
||||
catch (Exception)
|
||||
{
|
||||
cacheItems = null;
|
||||
|
@ -11841,87 +11821,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
cacheItems = p.Appearance.WearableCacheItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cache != null && cacheItems != null)
|
||||
if (cacheItems != null)
|
||||
{
|
||||
// We need to make sure the asset stored in the bake is available on this server also by its assetid before we map it to a Cacheid.
|
||||
// Copy the baked textures to the sim's assets cache (local only).
|
||||
foreach (WearableCacheItem item in cacheItems)
|
||||
{
|
||||
foreach (WearableCacheItem item in cacheItems)
|
||||
if (cache.GetCached(item.TextureID.ToString()) == null)
|
||||
{
|
||||
|
||||
if (cache.GetCached(item.TextureID.ToString()) == null)
|
||||
{
|
||||
item.TextureAsset.Temporary = true;
|
||||
cache.Store(item.TextureAsset);
|
||||
}
|
||||
|
||||
|
||||
item.TextureAsset.Temporary = true;
|
||||
item.TextureAsset.Local = true;
|
||||
cache.Store(item.TextureAsset);
|
||||
}
|
||||
}
|
||||
if (cacheItems != null)
|
||||
|
||||
// Return the cached textures
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
{
|
||||
WearableCacheItem item =
|
||||
WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex, cacheItems);
|
||||
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
|
||||
{
|
||||
WearableCacheItem item =
|
||||
WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems);
|
||||
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex;
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
|
||||
{
|
||||
|
||||
cachedresp.WearableData[i].TextureID = item.TextureID;
|
||||
}
|
||||
else
|
||||
{
|
||||
cachedresp.WearableData[i].TextureID = UUID.Zero;
|
||||
}
|
||||
cachedresp.WearableData[i].TextureID = item.TextureID;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
else
|
||||
{
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
|
||||
cachedresp.WearableData[i].TextureID = UUID.Zero;
|
||||
//UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cache == null)
|
||||
// Cached textures not available
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
{
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
{
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
|
||||
cachedresp.WearableData[i].TextureID = UUID.Zero;
|
||||
//UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
{
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
|
||||
|
||||
|
||||
|
||||
if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null)
|
||||
cachedresp.WearableData[i].TextureID = UUID.Zero;
|
||||
//UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
|
||||
else
|
||||
cachedresp.WearableData[i].TextureID = UUID.Zero;
|
||||
// UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
}
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
|
||||
cachedresp.WearableData[i].TextureID = UUID.Zero;
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
cachedresp.Header.Zerocoded = true;
|
||||
OutPacket(cachedresp, ThrottleOutPacketType.Task);
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
// Create a token bucket throttle for this client that has the scene token bucket as a parent
|
||||
m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled);
|
||||
// Create a token bucket throttle for the total categary with the client bucket as a throttle
|
||||
// Create a token bucket throttle for the total category with the client bucket as a throttle
|
||||
m_throttleCategory = new TokenBucket(m_throttleClient, 0);
|
||||
// Create an array of token buckets for this clients different throttle categories
|
||||
m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];
|
||||
|
@ -262,6 +262,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate;
|
||||
m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate;
|
||||
m_info.totalThrottle = (int)m_throttleCategory.DripRate;
|
||||
m_info.maxThrottle = (int)m_throttleClient.MaxDripRate;
|
||||
|
||||
return m_info;
|
||||
}
|
||||
|
|
|
@ -674,7 +674,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Debug", false, "debug lludp packet",
|
||||
"debug lludp packet [--default] <level> [<avatar-first-name> <avatar-last-name>]",
|
||||
"debug lludp packet [--default | --all] <level> [<avatar-first-name> <avatar-last-name>]",
|
||||
"Turn on packet debugging",
|
||||
"If level > 255 then all incoming and outgoing packets are logged.\n"
|
||||
+ "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
|
||||
|
@ -683,7 +683,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
+ "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n"
|
||||
+ "If level <= 0 then no packets are logged.\n"
|
||||
+ "If --default is specified then the level becomes the default logging level for all subsequent agents.\n"
|
||||
+ "In this case, you cannot also specify an avatar name.\n"
|
||||
+ "If --all is specified then the level becomes the default logging level for all current and subsequent agents.\n"
|
||||
+ "In these cases, you cannot also specify an avatar name.\n"
|
||||
+ "If an avatar name is given then only packets from that avatar are logged.",
|
||||
HandlePacketCommand);
|
||||
|
||||
|
@ -742,20 +743,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
return;
|
||||
|
||||
bool setAsDefaultLevel = false;
|
||||
OptionSet optionSet = new OptionSet().Add("default", o => setAsDefaultLevel = o != null);
|
||||
bool setAll = false;
|
||||
OptionSet optionSet = new OptionSet()
|
||||
.Add("default", o => setAsDefaultLevel = (o != null))
|
||||
.Add("all", o => setAll = (o != null));
|
||||
List<string> filteredArgs = optionSet.Parse(args);
|
||||
|
||||
string name = null;
|
||||
|
||||
if (filteredArgs.Count == 6)
|
||||
{
|
||||
if (!setAsDefaultLevel)
|
||||
if (!(setAsDefaultLevel || setAll))
|
||||
{
|
||||
name = string.Format("{0} {1}", filteredArgs[4], filteredArgs[5]);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default logging level");
|
||||
MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default/all logging level");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -765,11 +769,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
int newDebug;
|
||||
if (int.TryParse(filteredArgs[3], out newDebug))
|
||||
{
|
||||
if (setAsDefaultLevel)
|
||||
if (setAsDefaultLevel || setAll)
|
||||
{
|
||||
DefaultClientPacketDebugLevel = newDebug;
|
||||
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"Debug packet debug for new clients set to {0} in {1}", DefaultClientPacketDebugLevel, m_scene.Name);
|
||||
"Packet debug for {0} clients set to {1} in {2}",
|
||||
(setAll ? "all" : "future"), DefaultClientPacketDebugLevel, m_scene.Name);
|
||||
|
||||
if (setAll)
|
||||
{
|
||||
m_scene.ForEachScenePresence(sp =>
|
||||
{
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"Packet debug for {0} ({1}) set to {2} in {3}",
|
||||
sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_scene.Name);
|
||||
|
||||
sp.ControllingClient.DebugPacketLevel = newDebug;
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -788,7 +806,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug lludp packet [--default] 0..255 [<first-name> <last-name>]");
|
||||
MainConsole.Instance.Output("Usage: debug lludp packet [--default | --all] 0..255 [<first-name> <last-name>]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -973,7 +991,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
for (int i = 0; i < packetCount; i++)
|
||||
{
|
||||
byte[] data = datas[i];
|
||||
|
||||
if (!SendPacketData(udpClient, data, packet.Type, category, method))
|
||||
packetQueued = true;
|
||||
}
|
||||
|
@ -981,7 +998,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
else
|
||||
{
|
||||
byte[] data = packet.ToBytes();
|
||||
packetQueued = SendPacketData(udpClient, data, packet.Type, category, method);
|
||||
if (!SendPacketData(udpClient, data, packet.Type, category, method))
|
||||
packetQueued = true;
|
||||
}
|
||||
|
||||
PacketPool.Instance.ReturnPacket(packet);
|
||||
|
@ -1065,8 +1083,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will
|
||||
// continue to display the deleted object until relog. Therefore, we need to always queue a kill object
|
||||
// packet so that it isn't sent before a queued update packet.
|
||||
bool requestQueue = type == PacketType.KillObject;
|
||||
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue))
|
||||
bool forceQueue = (type == PacketType.KillObject);
|
||||
|
||||
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, forceQueue))
|
||||
{
|
||||
SendPacketFinal(outgoingPacket);
|
||||
return true;
|
||||
|
@ -2305,4 +2324,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
|||
// testLLUDPServer.RemoveClientCircuit(myCircuitCode);
|
||||
// Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode));
|
||||
//
|
||||
// // Check that removing a non-existant circuit doesn't have any bad effects
|
||||
// // Check that removing a non-existent circuit doesn't have any bad effects
|
||||
// testLLUDPServer.RemoveClientCircuit(101);
|
||||
// Assert.IsFalse(testLLUDPServer.HasCircuit(101));
|
||||
// }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -335,13 +335,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// greater than this.
|
||||
// </summary>
|
||||
protected Int64 m_maxDripRate = 0;
|
||||
protected Int64 MaxDripRate
|
||||
public Int64 MaxDripRate
|
||||
{
|
||||
get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); }
|
||||
set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); }
|
||||
protected set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); }
|
||||
}
|
||||
|
||||
private bool m_enabled = false;
|
||||
|
||||
public bool Enabled { get; private set; }
|
||||
|
||||
// <summary>
|
||||
//
|
||||
|
@ -362,9 +362,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// </summary>
|
||||
public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate, bool enabled) : base(parent,maxDripRate)
|
||||
{
|
||||
m_enabled = enabled;
|
||||
Enabled = enabled;
|
||||
|
||||
if (m_enabled)
|
||||
if (Enabled)
|
||||
{
|
||||
// m_log.DebugFormat("[TOKENBUCKET] Adaptive throttle enabled");
|
||||
MaxDripRate = maxDripRate;
|
||||
|
@ -378,7 +378,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public void ExpirePackets(Int32 count)
|
||||
{
|
||||
// m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count);
|
||||
if (m_enabled)
|
||||
if (Enabled)
|
||||
AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count));
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// </summary>
|
||||
public void AcknowledgePackets(Int32 count)
|
||||
{
|
||||
if (m_enabled)
|
||||
if (Enabled)
|
||||
AdjustedDripRate = AdjustedDripRate + count;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ using OpenSim.Region.Framework;
|
|||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.ClientStack
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.Reflection;
|
|||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using PermissionMask = OpenSim.Framework.PermissionMask;
|
||||
|
@ -376,6 +377,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
m_Scene.AssetService.Store(m_asset);
|
||||
|
||||
m_transactions.RemoveXferUploader(m_transactionID);
|
||||
|
||||
m_Scene.EventManager.TriggerOnNewInventoryItemUploadComplete(ourClient.AgentId, (AssetType)type, m_asset.FullID, m_asset.Name, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -422,5 +425,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
|
||||
m_transactions.RemoveXferUploader(m_transactionID);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -231,7 +231,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
|||
{
|
||||
try
|
||||
{
|
||||
List<int> layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(new MemoryStream(j2kData));
|
||||
List<int> layerStarts;
|
||||
using (MemoryStream ms = new MemoryStream(j2kData))
|
||||
{
|
||||
layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(ms);
|
||||
}
|
||||
|
||||
if (layerStarts != null && layerStarts.Count > 0)
|
||||
{
|
||||
|
|
|
@ -316,9 +316,12 @@ namespace OpenSim.Region.CoreModules.Asset
|
|||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
m_enabled = false;
|
||||
m_cache.Clear();
|
||||
m_cache = null;
|
||||
if (m_enabled)
|
||||
{
|
||||
m_enabled = false;
|
||||
m_cache.Clear();
|
||||
m_cache = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
|||
|
||||
sr.ReadEndElement();
|
||||
}
|
||||
m_log.DebugFormat("[XBakes]: Ended reading");
|
||||
m_log.DebugFormat("[XBakes]: read {0} textures for user {1}", ret.Count, id);
|
||||
sr.Close();
|
||||
s.Close();
|
||||
|
||||
|
@ -186,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
|||
delegate
|
||||
{
|
||||
rc.Request(reqStream, m_Auth);
|
||||
m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", data.Length, agentId);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -289,18 +289,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
|
||||
rootElement.AppendChild(result);
|
||||
|
||||
return DocToBytes(doc);
|
||||
}
|
||||
|
||||
private byte[] DocToBytes(XmlDocument doc)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
||||
xw.Formatting = Formatting.Indented;
|
||||
doc.WriteTo(xw);
|
||||
xw.Flush();
|
||||
|
||||
return ms.ToArray();
|
||||
return Util.DocToBytes(doc);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -1152,16 +1152,24 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
}
|
||||
|
||||
parameters = (OSDMap)Params;
|
||||
|
||||
OSDArray list = (OSDArray)parameters["result"];
|
||||
|
||||
foreach(OSD asset in list)
|
||||
{
|
||||
OSDString assetId = (OSDString)asset;
|
||||
|
||||
Scene.AssetService.Get(string.Format("{0}/{1}",assetServerURI, assetId.AsString()));
|
||||
if (parameters.ContainsKey("result"))
|
||||
{
|
||||
OSDArray list = (OSDArray)parameters["result"];
|
||||
|
||||
foreach (OSD asset in list)
|
||||
{
|
||||
OSDString assetId = (OSDString)asset;
|
||||
|
||||
Scene.AssetService.Get(string.Format("{0}/{1}", assetServerURI, assetId.AsString()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[PROFILES]: Problematic response for image_assets_request from {0}", profileServerURI);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
protected virtual void InitialiseCommon(IConfigSource source)
|
||||
{
|
||||
string transferVersionName = "SIMULATION";
|
||||
float maxTransferVersion = 0.2f;
|
||||
float maxTransferVersion = 0.3f;
|
||||
|
||||
IConfig hypergridConfig = source.Configs["Hypergrid"];
|
||||
if (hypergridConfig != null)
|
||||
|
@ -760,8 +760,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
string reason;
|
||||
string version;
|
||||
string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
|
||||
if (!Scene.SimulationService.QueryAccess(
|
||||
finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, out version, out reason))
|
||||
finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(reason);
|
||||
|
||||
|
@ -820,7 +821,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
agentCircuit.Id0 = currentAgentCircuit.Id0;
|
||||
}
|
||||
|
||||
if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
// if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance,
|
||||
(float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY));
|
||||
if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
{
|
||||
// brand new agent, let's create a new caps seed
|
||||
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
|
||||
|
@ -833,7 +837,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
if (versionComponents.Length >= 2)
|
||||
float.TryParse(versionComponents[1], out versionNumber);
|
||||
|
||||
if (versionNumber == 0.2f && MaxOutgoingTransferVersion >= versionNumber)
|
||||
if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber)
|
||||
TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
|
||||
else
|
||||
TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
|
||||
|
@ -894,7 +898,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
IClientIPEndpoint ipepClient;
|
||||
string capsPath = String.Empty;
|
||||
if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance,
|
||||
(float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY));
|
||||
if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for incoming agent {3} from {4}",
|
||||
|
@ -1140,7 +1146,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
IClientIPEndpoint ipepClient;
|
||||
string capsPath = String.Empty;
|
||||
if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance,
|
||||
(float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY));
|
||||
if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}",
|
||||
|
@ -1509,8 +1517,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
|
||||
// Check to see if we have access to the target region.
|
||||
string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
|
||||
if (neighbourRegion != null
|
||||
&& !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, out version, out failureReason))
|
||||
&& !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, out version, out failureReason))
|
||||
{
|
||||
// remember banned
|
||||
m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
|
||||
|
@ -1520,7 +1529,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
else
|
||||
{
|
||||
// The destination region just doesn't exist
|
||||
failureReason = "Cannot cross into non-existant region";
|
||||
failureReason = "Cannot cross into non-existent region";
|
||||
}
|
||||
|
||||
if (neighbourRegion == null)
|
||||
|
@ -1864,7 +1873,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
//foreach (ulong h in agent.ChildrenCapSeeds.Keys)
|
||||
// m_log.DebugFormat("[XXX] --> {0}", h);
|
||||
//m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle);
|
||||
agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath);
|
||||
if (agent.ChildrenCapSeeds.ContainsKey(region.RegionHandle))
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER]: Overwriting caps seed {0} with {1} for region {2} (handle {3}) for {4} in {5}",
|
||||
agent.ChildrenCapSeeds[region.RegionHandle], agent.CapsPath,
|
||||
region.RegionName, region.RegionHandle, sp.Name, Scene.Name);
|
||||
}
|
||||
|
||||
agent.ChildrenCapSeeds[region.RegionHandle] = agent.CapsPath;
|
||||
|
||||
if (sp.Scene.CapsModule != null)
|
||||
{
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
base.AddRegion(scene);
|
||||
m_assMapper = new HGAssetMapper(scene, m_HomeURI);
|
||||
scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem;
|
||||
scene.EventManager.OnNewInventoryItemUploadComplete += PostInventoryAsset;
|
||||
scene.EventManager.OnTeleportStart += TeleportStart;
|
||||
scene.EventManager.OnTeleportFail += TeleportFail;
|
||||
|
||||
|
@ -209,7 +209,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
}
|
||||
}
|
||||
|
||||
public void UploadInventoryItem(UUID avatarID, AssetType type, UUID assetID, string name, int userlevel)
|
||||
public void PostInventoryAsset(UUID avatarID, AssetType type, UUID assetID, string name, int userlevel)
|
||||
{
|
||||
if (type == AssetType.Link)
|
||||
return;
|
||||
|
@ -248,7 +248,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
{
|
||||
UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data);
|
||||
|
||||
UploadInventoryItem(remoteClient.AgentId, AssetType.Unknown, newAssetID, "", 0);
|
||||
PostInventoryAsset(remoteClient.AgentId, AssetType.Unknown, newAssetID, "", 0);
|
||||
|
||||
return newAssetID;
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
{
|
||||
if (base.UpdateInventoryItemAsset(ownerID, item, asset))
|
||||
{
|
||||
UploadInventoryItem(ownerID, (AssetType)asset.Type, asset.FullID, asset.Name, 0);
|
||||
PostInventoryAsset(ownerID, (AssetType)asset.Type, asset.FullID, asset.Name, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
protected override void ExportAsset(UUID agentID, UUID assetID)
|
||||
{
|
||||
if (!assetID.Equals(UUID.Zero))
|
||||
UploadInventoryItem(agentID, AssetType.Unknown, assetID, "", 0);
|
||||
PostInventoryAsset(agentID, AssetType.Unknown, assetID, "", 0);
|
||||
else
|
||||
m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -151,7 +151,7 @@ namespace OpenSim.Region.CoreModules.Framework.Statistics.Logging
|
|||
string path = (m_logDirectory.Length > 0 ? m_logDirectory
|
||||
+ System.IO.Path.DirectorySeparatorChar.ToString() : "")
|
||||
+ String.Format("{0}{1}.log", LogFileHeader, now.ToString("yyyyMMddHHmmss"));
|
||||
m_logFile = new StreamWriter(File.Open(path, FileMode.Append, FileAccess.Write));
|
||||
m_logFile = new StreamWriter(File.Open(path, FileMode.Append, FileAccess.Write, FileShare.ReadWrite));
|
||||
}
|
||||
if (m_logFile != null)
|
||||
{
|
||||
|
|
|
@ -244,7 +244,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (inventoryURL != null && inventoryURL != string.Empty)
|
||||
{
|
||||
inventoryURL = inventoryURL.Trim(new char[] { '/' });
|
||||
m_InventoryURLs.Add(userID, inventoryURL);
|
||||
m_InventoryURLs[userID] = inventoryURL;
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
/// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2"
|
||||
/// </remarks>
|
||||
public string ServiceVersion { get; set; }
|
||||
private float m_VersionNumber = 0.3f;
|
||||
|
||||
/// <summary>
|
||||
/// Map region ID to scene.
|
||||
|
@ -84,15 +85,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
|
||||
public void InitialiseService(IConfigSource configSource)
|
||||
{
|
||||
ServiceVersion = "SIMULATION/0.2";
|
||||
ServiceVersion = "SIMULATION/0.3";
|
||||
IConfig config = configSource.Configs["SimulationService"];
|
||||
if (config != null)
|
||||
{
|
||||
ServiceVersion = config.GetString("ConnectorProtocolVersion", ServiceVersion);
|
||||
|
||||
if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2")
|
||||
if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2" && ServiceVersion != "SIMULATION/0.3")
|
||||
throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion));
|
||||
|
||||
string[] versionComponents = ServiceVersion.Split(new char[] { '/' });
|
||||
if (versionComponents.Length >= 2)
|
||||
float.TryParse(versionComponents[1], out m_VersionNumber);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion);
|
||||
}
|
||||
|
@ -264,7 +269,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason)
|
||||
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason)
|
||||
{
|
||||
reason = "Communications failure";
|
||||
version = ServiceVersion;
|
||||
|
@ -276,6 +281,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
// m_log.DebugFormat(
|
||||
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||
uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX;
|
||||
|
||||
float theirVersionNumber = 0f;
|
||||
string[] versionComponents = theirversion.Split(new char[] { '/' });
|
||||
if (versionComponents.Length >= 2)
|
||||
float.TryParse(versionComponents[1], out theirVersionNumber);
|
||||
|
||||
// Var regions here, and the requesting simulator is in an older version.
|
||||
// We will forbide this, because it crashes the viewers
|
||||
if (theirVersionNumber < 0.3f && size > 256)
|
||||
{
|
||||
reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading.";
|
||||
m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, out reason);
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return m_remoteConnector.UpdateAgent(destination, cAgentData);
|
||||
}
|
||||
|
||||
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason)
|
||||
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason)
|
||||
{
|
||||
reason = "Communications failure";
|
||||
version = "Unknown";
|
||||
|
@ -216,12 +216,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return false;
|
||||
|
||||
// Try local first
|
||||
if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason))
|
||||
if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason))
|
||||
return true;
|
||||
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(destination.RegionID))
|
||||
return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason);
|
||||
return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -91,13 +91,17 @@ namespace OpenSim.Region.CoreModules.World
|
|||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_SceneList.Contains(scene))
|
||||
m_SceneList.Add(scene);
|
||||
lock (m_SceneList)
|
||||
{
|
||||
if (!m_SceneList.Contains(scene))
|
||||
m_SceneList.Add(scene);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
m_SceneList.Remove(scene);
|
||||
lock (m_SceneList)
|
||||
m_SceneList.Remove(scene);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
|
|
|
@ -918,17 +918,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
{
|
||||
ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
|
||||
|
||||
MemoryStream ms = new MemoryStream(data);
|
||||
if (m_displacement != Vector3.Zero || m_rotation != 0f)
|
||||
using (MemoryStream ms = new MemoryStream(data))
|
||||
{
|
||||
Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y);
|
||||
terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms);
|
||||
if (m_displacement != Vector3.Zero || m_rotation != 0f)
|
||||
{
|
||||
Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y);
|
||||
terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms);
|
||||
}
|
||||
else
|
||||
{
|
||||
terrainModule.LoadFromStream(terrainPath, ms);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
terrainModule.LoadFromStream(terrainPath, ms);
|
||||
}
|
||||
ms.Close();
|
||||
|
||||
m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath);
|
||||
|
||||
|
|
|
@ -569,10 +569,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
string terrainPath = String.Format("{0}{1}{2}.r32",
|
||||
regionDir, ArchiveConstants.TERRAINS_PATH, scene.RegionInfo.RegionName);
|
||||
|
||||
MemoryStream ms = new MemoryStream();
|
||||
scene.RequestModuleInterface<ITerrainModule>().SaveToStream(terrainPath, ms);
|
||||
m_archiveWriter.WriteFile(terrainPath, ms.ToArray());
|
||||
ms.Close();
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
scene.RequestModuleInterface<ITerrainModule>().SaveToStream(terrainPath, ms);
|
||||
m_archiveWriter.WriteFile(terrainPath, ms.ToArray());
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive.");
|
||||
|
||||
|
|
|
@ -1116,9 +1116,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
{
|
||||
try
|
||||
{
|
||||
MemoryStream terrainStream = new MemoryStream(terrainData);
|
||||
terr.LoadFromStream(filename, terrainStream);
|
||||
terrainStream.Close();
|
||||
using (MemoryStream terrainStream = new MemoryStream(terrainData))
|
||||
terr.LoadFromStream(filename, terrainStream);
|
||||
|
||||
FileInfo x = new FileInfo(filename);
|
||||
remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear.");
|
||||
|
|
|
@ -281,18 +281,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
|
||||
rootElement.AppendChild(result);
|
||||
|
||||
return DocToBytes(doc);
|
||||
return Util.DocToBytes(doc);
|
||||
}
|
||||
|
||||
private byte[] DocToBytes(XmlDocument doc)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
||||
xw.Formatting = Formatting.Indented;
|
||||
doc.WriteTo(xw);
|
||||
xw.Flush();
|
||||
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -858,7 +858,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
return null;
|
||||
else
|
||||
throw new Exception(
|
||||
String.Format("{0} GetLandObject for non-existant position. Region={1}, pos=<{2},{3}",
|
||||
String.Format("{0} GetLandObject for non-existent position. Region={1}, pos=<{2},{3}",
|
||||
LogHeader, m_scene.RegionInfo.RegionName, x, y)
|
||||
);
|
||||
}
|
||||
|
@ -1985,15 +1985,17 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
|
||||
|
||||
// Can the user set home here?
|
||||
if (// (a) gods and land managers can set home
|
||||
m_scene.Permissions.IsAdministrator(remoteClient.AgentId) ||
|
||||
m_scene.Permissions.IsGod(remoteClient.AgentId) ||
|
||||
// (b) land owners can set home
|
||||
remoteClient.AgentId == land.LandData.OwnerID ||
|
||||
// (c) members of the land-associated group in roles that can set home
|
||||
((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) ||
|
||||
// (d) parcels with telehubs can be the home of anyone
|
||||
(telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y)))
|
||||
if (// Required: local user; foreign users cannot set home
|
||||
m_scene.UserManagementModule.IsLocalGridUser(remoteClient.AgentId) &&
|
||||
(// (a) gods and land managers can set home
|
||||
m_scene.Permissions.IsAdministrator(remoteClient.AgentId) ||
|
||||
m_scene.Permissions.IsGod(remoteClient.AgentId) ||
|
||||
// (b) land owners can set home
|
||||
remoteClient.AgentId == land.LandData.OwnerID ||
|
||||
// (c) members of the land-associated group in roles that can set home
|
||||
((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) ||
|
||||
// (d) parcels with telehubs can be the home of anyone
|
||||
(telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y))))
|
||||
{
|
||||
if (m_scene.GridUserService.SetHome(remoteClient.AgentId.ToString(), land.RegionUUID, position, lookAt))
|
||||
// FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
|
||||
|
|
|
@ -54,13 +54,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
|
|||
{
|
||||
string xmlstream = GetObjectXml(scene);
|
||||
|
||||
MemoryStream stream = ReformatXmlString(xmlstream);
|
||||
using (MemoryStream stream = ReformatXmlString(xmlstream))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
CreateXmlFile(stream, fileName);
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
CreateXmlFile(stream, fileName);
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
CreateCompressedXmlFile(stream, fileName);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
CreateCompressedXmlFile(stream, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
private static MemoryStream ReformatXmlString(string xmlstream)
|
||||
|
@ -112,13 +113,16 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
|
|||
{
|
||||
#region GZip Compressed Version
|
||||
|
||||
FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create);
|
||||
MemoryStream gzipMSStream = new MemoryStream();
|
||||
GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress);
|
||||
xmlStream.WriteTo(gzipStream);
|
||||
gzipMSStream.WriteTo(objectsFileCompressed);
|
||||
objectsFileCompressed.Flush();
|
||||
objectsFileCompressed.Close();
|
||||
using (FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create))
|
||||
using (MemoryStream gzipMSStream = new MemoryStream())
|
||||
{
|
||||
using (GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress, true))
|
||||
{
|
||||
xmlStream.WriteTo(gzipStream);
|
||||
}
|
||||
|
||||
gzipMSStream.WriteTo(objectsFileCompressed);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -1029,7 +1029,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
block.X = (ushort)minX;
|
||||
block.Y = (ushort)minY;
|
||||
block.Access = (byte)SimAccess.Down; // means 'simulator is offline'
|
||||
// block.Access = (byte)SimAccess.NonExistant;
|
||||
// block.Access = (byte)SimAccess.NonExistent;
|
||||
response.Add(block);
|
||||
}
|
||||
// The lower 16 bits are an unsigned int16
|
||||
|
@ -1121,32 +1121,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
block.SizeX = (ushort)r.RegionSizeX;
|
||||
block.SizeY = (ushort)r.RegionSizeY;
|
||||
blocks.Add(block);
|
||||
// If these are larger than legacy regions, create fake map entries for the covered
|
||||
// regions. The map system only does legacy sized regions so we have to fake map
|
||||
// entries for all the covered regions.
|
||||
if (r.RegionSizeX > Constants.RegionSize || r.RegionSizeY > Constants.RegionSize)
|
||||
{
|
||||
for (int x = 0; x < r.RegionSizeX / Constants.RegionSize; x++)
|
||||
{
|
||||
for (int y = 0; y < r.RegionSizeY / Constants.RegionSize; y++)
|
||||
{
|
||||
if (x == 0 && y == 0)
|
||||
continue;
|
||||
block = new MapBlockData
|
||||
{
|
||||
Access = r.Access,
|
||||
MapImageId = r.TerrainImage,
|
||||
Name = r.RegionName,
|
||||
X = (ushort)((r.RegionLocX / Constants.RegionSize) + x),
|
||||
Y = (ushort)((r.RegionLocY / Constants.RegionSize) + y),
|
||||
SizeX = (ushort)r.RegionSizeX,
|
||||
SizeY = (ushort)r.RegionSizeY
|
||||
};
|
||||
//Child piece, so ignore it
|
||||
blocks.Add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
@ -1171,7 +1145,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
if (myMapImageJPEG.Length == 0)
|
||||
{
|
||||
MemoryStream imgstream = new MemoryStream();
|
||||
MemoryStream imgstream = null;
|
||||
Bitmap mapTexture = new Bitmap(1,1);
|
||||
ManagedImage managedImage;
|
||||
Image image = (Image)mapTexture;
|
||||
|
@ -1218,10 +1192,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
image.Dispose();
|
||||
|
||||
if (imgstream != null)
|
||||
{
|
||||
imgstream.Close();
|
||||
imgstream.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1467,7 +1438,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
public void GenerateMaptile()
|
||||
{
|
||||
// Cannot create a map for a nonexistant heightmap
|
||||
// Cannot create a map for a nonexistent heightmap
|
||||
if (m_scene.Heightmap == null)
|
||||
return;
|
||||
|
||||
|
@ -1578,12 +1549,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
private Byte[] GenerateOverlay()
|
||||
{
|
||||
using (Bitmap overlay = new Bitmap(256, 256))
|
||||
// These need to be ints for bitmap generation
|
||||
int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX;
|
||||
int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY;
|
||||
|
||||
int landTileSize = LandManagementModule.LandUnit;
|
||||
int regionLandTilesX = regionSizeX / landTileSize;
|
||||
int regionLandTilesY = regionSizeY / landTileSize;
|
||||
|
||||
using (Bitmap overlay = new Bitmap(regionSizeX, regionSizeY))
|
||||
{
|
||||
bool[,] saleBitmap = new bool[64, 64];
|
||||
for (int x = 0 ; x < 64 ; x++)
|
||||
bool[,] saleBitmap = new bool[regionLandTilesX, regionLandTilesY];
|
||||
for (int x = 0; x < regionLandTilesX; x++)
|
||||
{
|
||||
for (int y = 0 ; y < 64 ; y++)
|
||||
for (int y = 0; y < regionLandTilesY; y++)
|
||||
saleBitmap[x, y] = false;
|
||||
}
|
||||
|
||||
|
@ -1596,8 +1575,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
using (Graphics g = Graphics.FromImage(overlay))
|
||||
{
|
||||
using (SolidBrush transparent = new SolidBrush(background))
|
||||
g.FillRectangle(transparent, 0, 0, 256, 256);
|
||||
|
||||
g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY);
|
||||
|
||||
foreach (ILandObject land in parcels)
|
||||
{
|
||||
|
@ -1620,12 +1598,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
|
||||
using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9)))
|
||||
{
|
||||
for (int x = 0 ; x < 64 ; x++)
|
||||
for (int x = 0 ; x < regionLandTilesX ; x++)
|
||||
{
|
||||
for (int y = 0 ; y < 64 ; y++)
|
||||
for (int y = 0 ; y < regionLandTilesY ; y++)
|
||||
{
|
||||
if (saleBitmap[x, y])
|
||||
g.FillRectangle(yellow, x * 4, 252 - (y * 4), 4, 4);
|
||||
g.FillRectangle(
|
||||
yellow, x * landTileSize,
|
||||
regionSizeX - landTileSize - (y * landTileSize),
|
||||
landTileSize,
|
||||
landTileSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -373,38 +373,41 @@ namespace OpenSim.Region.DataSnapshot
|
|||
for (int i = 0; i < services.Length; i++)
|
||||
{
|
||||
string url = services[i].Trim();
|
||||
RestClient cli = new RestClient(url);
|
||||
cli.AddQueryParameter("service", serviceName);
|
||||
cli.AddQueryParameter("host", m_hostname);
|
||||
cli.AddQueryParameter("port", m_listener_port);
|
||||
cli.AddQueryParameter("secret", m_Secret.ToString());
|
||||
cli.RequestMethod = "GET";
|
||||
try
|
||||
using (RestClient cli = new RestClient(url))
|
||||
{
|
||||
reply = cli.Request(null);
|
||||
cli.AddQueryParameter("service", serviceName);
|
||||
cli.AddQueryParameter("host", m_hostname);
|
||||
cli.AddQueryParameter("port", m_listener_port);
|
||||
cli.AddQueryParameter("secret", m_Secret.ToString());
|
||||
cli.RequestMethod = "GET";
|
||||
try
|
||||
{
|
||||
reply = cli.Request(null);
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
m_log.Warn("[DATASNAPSHOT]: Unable to notify " + url);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString());
|
||||
}
|
||||
|
||||
byte[] response = new byte[1024];
|
||||
// int n = 0;
|
||||
try
|
||||
{
|
||||
// n = reply.Read(response, 0, 1024);
|
||||
reply.Read(response, 0, 1024);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[DATASNAPSHOT]: Unable to decode reply from data service. Ignoring. {0}", e.StackTrace);
|
||||
}
|
||||
// This is not quite working, so...
|
||||
// string responseStr = Util.UTF8.GetString(response);
|
||||
m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret);
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
m_log.Warn("[DATASNAPSHOT]: Unable to notify " + url);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString());
|
||||
}
|
||||
byte[] response = new byte[1024];
|
||||
// int n = 0;
|
||||
try
|
||||
{
|
||||
// n = reply.Read(response, 0, 1024);
|
||||
reply.Read(response, 0, 1024);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[DATASNAPSHOT]: Unable to decode reply from data service. Ignoring. {0}", e.StackTrace);
|
||||
}
|
||||
// This is not quite working, so...
|
||||
// string responseStr = Util.UTF8.GetString(response);
|
||||
m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -113,31 +113,34 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
|
||||
public byte[] ToBytes()
|
||||
{
|
||||
byte[] outputbytes = new byte[0];
|
||||
byte[] outputbytes;
|
||||
|
||||
BinaryWriter iostream = new BinaryWriter(new MemoryStream());
|
||||
iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown0)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown1)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Priority)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(Length)));
|
||||
iostream.Write(BinBVHUtil.WriteNullTerminatedString(ExpressionName));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(InPoint)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(OutPoint)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Loop ? 1 : 0)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseInTime)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseOutTime)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes(HandPose)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes((uint)(Joints.Length))));
|
||||
|
||||
for (int i = 0; i < Joints.Length; i++)
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
using (BinaryWriter iostream = new BinaryWriter(ms))
|
||||
{
|
||||
Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint);
|
||||
iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown0)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown1)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Priority)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(Length)));
|
||||
iostream.Write(BinBVHUtil.WriteNullTerminatedString(ExpressionName));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(InPoint)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(OutPoint)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Loop ? 1 : 0)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseInTime)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseOutTime)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes(HandPose)));
|
||||
iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes((uint)(Joints.Length))));
|
||||
|
||||
for (int i = 0; i < Joints.Length; i++)
|
||||
{
|
||||
Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint);
|
||||
}
|
||||
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0)));
|
||||
|
||||
using (MemoryStream ms2 = (MemoryStream)iostream.BaseStream)
|
||||
outputbytes = ms2.ToArray();
|
||||
}
|
||||
iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0)));
|
||||
MemoryStream ms = (MemoryStream)iostream.BaseStream;
|
||||
outputbytes = ms.ToArray();
|
||||
ms.Close();
|
||||
iostream.Close();
|
||||
|
||||
return outputbytes;
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (!m_selected)
|
||||
{
|
||||
StopTimer();
|
||||
m_serializedPosition = m_group.AbsolutePosition;
|
||||
m_serializedPosition = m_group.AbsolutePosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,10 +308,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
try
|
||||
{
|
||||
MemoryStream ms = new MemoryStream(data);
|
||||
BinaryFormatter fmt = new BinaryFormatter();
|
||||
|
||||
newMotion = (KeyframeMotion)fmt.Deserialize(ms);
|
||||
using (MemoryStream ms = new MemoryStream(data))
|
||||
{
|
||||
BinaryFormatter fmt = new BinaryFormatter();
|
||||
newMotion = (KeyframeMotion)fmt.Deserialize(ms);
|
||||
}
|
||||
|
||||
newMotion.m_group = grp;
|
||||
|
||||
|
@ -345,26 +346,26 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
|
||||
m_group = grp;
|
||||
m_scene = grp.Scene;
|
||||
m_scene = grp.Scene;
|
||||
|
||||
Vector3 grppos = grp.AbsolutePosition;
|
||||
Vector3 offset = grppos - m_serializedPosition;
|
||||
Vector3 offset = grppos - m_serializedPosition;
|
||||
// avoid doing it more than once
|
||||
// current this will happen dragging a prim to other region
|
||||
m_serializedPosition = grppos;
|
||||
|
||||
m_basePosition += offset;
|
||||
m_nextPosition += offset;
|
||||
|
||||
|
||||
m_currentFrame.StartPosition += offset;
|
||||
m_currentFrame.Position += offset;
|
||||
m_currentFrame.Position += offset;
|
||||
|
||||
for (int i = 0; i < m_frames.Count; i++)
|
||||
{
|
||||
Keyframe k = m_frames[i];
|
||||
k.StartPosition += offset;
|
||||
k.Position += offset;
|
||||
m_frames[i]=k;
|
||||
m_frames[i]=k;
|
||||
}
|
||||
|
||||
if (m_running)
|
||||
|
@ -527,7 +528,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
k.Position = pos;
|
||||
// k.Velocity = Vector3.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
k.StartRotation = rot;
|
||||
if (k.Rotation.HasValue)
|
||||
|
@ -764,19 +765,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public Byte[] Serialize()
|
||||
{
|
||||
StopTimer();
|
||||
MemoryStream ms = new MemoryStream();
|
||||
|
||||
BinaryFormatter fmt = new BinaryFormatter();
|
||||
SceneObjectGroup tmp = m_group;
|
||||
m_group = null;
|
||||
if (!m_selected && tmp != null)
|
||||
m_serializedPosition = tmp.AbsolutePosition;
|
||||
fmt.Serialize(ms, this);
|
||||
m_group = tmp;
|
||||
if (m_running && !m_waitingCrossing)
|
||||
StartTimer();
|
||||
m_group = null;
|
||||
if (!m_selected && tmp != null)
|
||||
m_serializedPosition = tmp.AbsolutePosition;
|
||||
|
||||
return ms.ToArray();
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
BinaryFormatter fmt = new BinaryFormatter();
|
||||
fmt.Serialize(ms, this);
|
||||
m_group = tmp;
|
||||
if (m_running && !m_waitingCrossing)
|
||||
StartTimer();
|
||||
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartCrossingCheck()
|
||||
|
|
|
@ -1226,16 +1226,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
if (taskItem.InvType == (int)InventoryType.Object)
|
||||
{
|
||||
uint perms = taskItem.CurrentPermissions;
|
||||
// Bake the new base permissions from folded permissions
|
||||
// The folded perms are in the lowest 3 bits of the current perms
|
||||
// We use base permissions here to avoid baking the "Locked" status
|
||||
// into the item as it is passed.
|
||||
uint perms = taskItem.BasePermissions & taskItem.NextPermissions;
|
||||
PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
|
||||
// Avoid the "lock trap" - move must always be enabled but the above may remove it
|
||||
// Add it back here.
|
||||
agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions;
|
||||
}
|
||||
else
|
||||
{
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
|
||||
// Newly given items cannot be "locked" on rez. Make sure by
|
||||
// setting current equal to base.
|
||||
}
|
||||
|
||||
agentItem.CurrentPermissions = agentItem.BasePermissions;
|
||||
|
||||
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||
agentItem.NextPermissions = taskItem.NextPermissions;
|
||||
agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
||||
|
@ -1934,8 +1939,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// Rez a script into a prim's inventory from another prim
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="itemID"> </param>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="srcPart"> </param>
|
||||
/// <param name="destId"> </param>
|
||||
/// <param name="pin"></param>
|
||||
/// <param name="running"></param>
|
||||
/// <param name="start_param"></param>
|
||||
public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param)
|
||||
{
|
||||
TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId);
|
||||
|
@ -1955,12 +1963,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (destPart == null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Could not find script for ID {0}",
|
||||
destId);
|
||||
"[PRIM INVENTORY]: Could not find part {0} to insert script item {1} from {2} {3} in {4}",
|
||||
destId, srcId, srcPart.Name, srcPart.UUID, Name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Must own the object, and have modify rights
|
||||
if (srcPart.OwnerID != destPart.OwnerID)
|
||||
{
|
||||
|
@ -1968,12 +1975,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if ((destPart.GroupID == UUID.Zero) || (destPart.GroupID != srcPart.GroupID) ||
|
||||
((destPart.GroupMask & (uint)PermissionMask.Modify) == 0))
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (destPart.ScriptAccessPin != pin)
|
||||
if (destPart.ScriptAccessPin == 0 || destPart.ScriptAccessPin != pin)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
|
|
|
@ -192,7 +192,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <summary>
|
||||
/// Maximum value of the size of a physical prim in each axis
|
||||
/// </summary>
|
||||
public float m_maxPhys = 10;
|
||||
public float m_maxPhys = 64;
|
||||
|
||||
/// <summary>
|
||||
/// Max prims an object will hold
|
||||
|
@ -201,7 +201,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public bool m_clampPrimSize;
|
||||
public bool m_trustBinaries;
|
||||
public bool m_allowScriptCrossings;
|
||||
public bool m_allowScriptCrossings = true;
|
||||
public bool m_useFlySlow;
|
||||
public bool m_useTrashOnDelete = true;
|
||||
|
||||
|
@ -1069,18 +1069,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns>True after all operations complete, throws exceptions otherwise.</returns>
|
||||
public override void OtherRegionUp(GridRegion otherRegion)
|
||||
{
|
||||
uint xcell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocX);
|
||||
uint ycell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocY);
|
||||
|
||||
//m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
|
||||
// RegionInfo.RegionName, otherRegion.RegionName, xcell, ycell);
|
||||
|
||||
if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
|
||||
{
|
||||
// If these are cast to INT because long + negative values + abs returns invalid data
|
||||
int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
|
||||
int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
|
||||
if (resultX <= 1 && resultY <= 1)
|
||||
//// If these are cast to INT because long + negative values + abs returns invalid data
|
||||
//int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
|
||||
//int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
|
||||
//if (resultX <= 1 && resultY <= 1)
|
||||
float dist = (float)Math.Max(DefaultDrawDistance,
|
||||
(float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY));
|
||||
uint newRegionX, newRegionY, thisRegionX, thisRegionY;
|
||||
Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY);
|
||||
Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY);
|
||||
|
||||
//m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
|
||||
// RegionInfo.RegionName, otherRegion.RegionName, newRegionX, newRegionY);
|
||||
|
||||
if (!Util.IsOutsideView(dist, thisRegionX, newRegionX, thisRegionY, newRegionY))
|
||||
{
|
||||
// Let the grid service module know, so this can be cached
|
||||
m_eventManager.TriggerOnRegionUp(otherRegion);
|
||||
|
@ -1894,6 +1898,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
RegionInfo.RegionID,
|
||||
RegionInfo.RegionLocX, RegionInfo.RegionLocY,
|
||||
RegionInfo.RegionSizeX, RegionInfo.RegionSizeY);
|
||||
|
||||
if (error != String.Empty)
|
||||
throw new Exception(error);
|
||||
}
|
||||
|
@ -3214,10 +3219,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_authenticateHandler.RemoveCircuit(agentID);
|
||||
}
|
||||
|
||||
// TODO: Can we now remove this lock?
|
||||
lock (acd)
|
||||
|
@ -3233,7 +3234,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
m_log.ErrorFormat(
|
||||
"[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID);
|
||||
|
||||
m_authenticateHandler.RemoveCircuit(agentID);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3310,6 +3312,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Always clean these structures up so that any failure above doesn't cause them to remain in the
|
||||
// scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
|
||||
// the same cleanup exception continually.
|
||||
m_authenticateHandler.RemoveCircuit(agentID);
|
||||
m_sceneGraph.RemoveScenePresence(agentID);
|
||||
m_clientManager.Remove(agentID);
|
||||
|
||||
|
@ -3462,7 +3465,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
foreach (string viewer in m_AllowedViewers)
|
||||
{
|
||||
if (viewer == curViewer.Substring(0, viewer.Length).Trim().ToLower())
|
||||
if (viewer == curViewer.Substring(0, Math.Min(viewer.Length, curViewer.Length)).Trim().ToLower())
|
||||
{
|
||||
ViewerDenied = false;
|
||||
break;
|
||||
|
@ -3479,7 +3482,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
foreach (string viewer in m_BannedViewers)
|
||||
{
|
||||
if (viewer == curViewer.Substring(0, viewer.Length).Trim().ToLower())
|
||||
if (viewer == curViewer.Substring(0, Math.Min(viewer.Length, curViewer.Length)).Trim().ToLower())
|
||||
{
|
||||
ViewerDenied = true;
|
||||
break;
|
||||
|
|
|
@ -1906,7 +1906,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (original == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[SCENEGRAPH]: Attempt to duplicate nonexistant prim id {0} by {1}", originalPrimID, AgentID);
|
||||
"[SCENEGRAPH]: Attempt to duplicate nonexistent prim id {0} by {1}", originalPrimID, AgentID);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -568,7 +568,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val);
|
||||
m_log.DebugFormat("[SCENE OBJECT]: Not crossing avatar {0} to {1} because it's already in transit", av.Name, val);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -870,8 +870,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
int type = m_items[itemID].InvType;
|
||||
if (type == 10) // Script
|
||||
{
|
||||
m_part.RemoveScriptEvents(itemID);
|
||||
m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
|
||||
// route it through here, to handle script cleanup tasks
|
||||
RemoveScriptInstance(itemID, false);
|
||||
}
|
||||
m_items.Remove(itemID);
|
||||
m_inventorySerial++;
|
||||
|
|
|
@ -1192,19 +1192,17 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// and it has already rezzed the attachments and started their scripts.
|
||||
// We do the following only for non-login agents, because their scripts
|
||||
// haven't started yet.
|
||||
if (PresenceType == PresenceType.Npc || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
|
||||
if (PresenceType == PresenceType.Npc || IsRealLogin(m_teleportFlags))
|
||||
{
|
||||
// Viewers which have a current outfit folder will actually rez their own attachments. However,
|
||||
// viewers without (e.g. v1 viewers) will not, so we still need to make this call.
|
||||
if (Scene.AttachmentsModule != null)
|
||||
Util.FireAndForget(
|
||||
o =>
|
||||
{
|
||||
// if (PresenceType != PresenceType.Npc && Util.FireAndForgetMethod != FireAndForgetMethod.None)
|
||||
// System.Threading.Thread.Sleep(7000);
|
||||
|
||||
Scene.AttachmentsModule.RezAttachments(this);
|
||||
});
|
||||
{
|
||||
Util.FireAndForget(o =>
|
||||
{
|
||||
Scene.AttachmentsModule.RezAttachments(this);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1266,6 +1264,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
private static bool IsRealLogin(TeleportFlags teleportFlags)
|
||||
{
|
||||
return ((teleportFlags & TeleportFlags.ViaLogin) != 0) && ((teleportFlags & TeleportFlags.ViaHGLogin) == 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Force viewers to show the avatar's current name.
|
||||
/// </summary>
|
||||
|
@ -1691,109 +1694,122 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
"[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
|
||||
client.Name, Scene.Name, AbsolutePosition);
|
||||
|
||||
// Make sure it's not a login agent. We don't want to wait for updates during login
|
||||
if (PresenceType != PresenceType.Npc && (m_teleportFlags & TeleportFlags.ViaLogin) == 0)
|
||||
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); // Get this ahead of time because IsInTransit modifies 'm_AgentControlFlags'
|
||||
|
||||
IsInTransit = true;
|
||||
try
|
||||
{
|
||||
// Let's wait until UpdateAgent (called by departing region) is done
|
||||
if (!WaitForUpdateAgent(client))
|
||||
// The sending region never sent the UpdateAgent data, we have to refuse
|
||||
// Make sure it's not a login agent. We don't want to wait for updates during login
|
||||
if (!(PresenceType == PresenceType.Npc || IsRealLogin(m_teleportFlags)))
|
||||
{
|
||||
// Let's wait until UpdateAgent (called by departing region) is done
|
||||
if (!WaitForUpdateAgent(client))
|
||||
// The sending region never sent the UpdateAgent data, we have to refuse
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 look = Velocity;
|
||||
|
||||
// if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
|
||||
if ((Math.Abs(look.X) < 0.1) && (Math.Abs(look.Y) < 0.1) && (Math.Abs(look.Z) < 0.1))
|
||||
{
|
||||
look = new Vector3(0.99f, 0.042f, 0);
|
||||
}
|
||||
|
||||
// Prevent teleporting to an underground location
|
||||
// (may crash client otherwise)
|
||||
//
|
||||
Vector3 pos = AbsolutePosition;
|
||||
float ground = m_scene.GetGroundHeight(pos.X, pos.Y);
|
||||
if (pos.Z < ground + 1.5f)
|
||||
{
|
||||
pos.Z = ground + 1.5f;
|
||||
AbsolutePosition = pos;
|
||||
}
|
||||
|
||||
if (!MakeRootAgent(AbsolutePosition, flying))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root",
|
||||
Name, Scene.Name);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Tell the client that we're totally ready
|
||||
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
|
||||
|
||||
// Remember in HandleUseCircuitCode, we delayed this to here
|
||||
if (m_teleportFlags > 0)
|
||||
SendInitialDataToMe();
|
||||
|
||||
// m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
|
||||
|
||||
if (!string.IsNullOrEmpty(m_callbackURI))
|
||||
{
|
||||
// We cannot sleep here since this would hold up the inbound packet processing thread, as
|
||||
// CompleteMovement() is executed synchronously. However, it might be better to delay the release
|
||||
// here until we know for sure that the agent is active in this region. Sending AgentMovementComplete
|
||||
// is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this
|
||||
// region as the current region, meaning that a close sent before then will fail the teleport.
|
||||
// System.Threading.Thread.Sleep(2000);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}",
|
||||
client.Name, client.AgentId, m_callbackURI);
|
||||
|
||||
UUID originID;
|
||||
|
||||
lock (m_originRegionIDAccessLock)
|
||||
originID = m_originRegionID;
|
||||
|
||||
Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI);
|
||||
m_callbackURI = null;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}",
|
||||
// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
|
||||
// }
|
||||
|
||||
ValidateAndSendAppearanceAndAgentData();
|
||||
|
||||
// Create child agents in neighbouring regions
|
||||
if (openChildAgents && !IsChildAgent)
|
||||
{
|
||||
IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
|
||||
if (m_agentTransfer != null)
|
||||
{
|
||||
// Note: this call can take a while, because it notifies each of the simulator's neighbours.
|
||||
// It's important that we don't allow the avatar to cross regions meanwhile, as that will
|
||||
// cause serious errors. We've prevented that from happening by setting IsInTransit=true.
|
||||
m_agentTransfer.EnableChildAgents(this);
|
||||
}
|
||||
|
||||
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||
if (friendsModule != null)
|
||||
friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
|
||||
|
||||
}
|
||||
|
||||
// XXX: If we force an update here, then multiple attachments do appear correctly on a destination region
|
||||
// If we do it a little bit earlier (e.g. when converting the child to a root agent) then this does not work.
|
||||
// This may be due to viewer code or it may be something we're not doing properly simulator side.
|
||||
lock (m_attachments)
|
||||
{
|
||||
foreach (SceneObjectGroup sog in m_attachments)
|
||||
sog.ScheduleGroupForFullUpdate();
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
|
||||
// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
|
||||
}
|
||||
|
||||
Vector3 look = Velocity;
|
||||
|
||||
// if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
|
||||
if ((Math.Abs(look.X) < 0.1) && (Math.Abs(look.Y) < 0.1) && (Math.Abs(look.Z) < 0.1))
|
||||
finally
|
||||
{
|
||||
look = new Vector3(0.99f, 0.042f, 0);
|
||||
IsInTransit = false;
|
||||
}
|
||||
|
||||
// Prevent teleporting to an underground location
|
||||
// (may crash client otherwise)
|
||||
//
|
||||
Vector3 pos = AbsolutePosition;
|
||||
float ground = m_scene.GetGroundHeight(pos.X, pos.Y);
|
||||
if (pos.Z < ground + 1.5f)
|
||||
{
|
||||
pos.Z = ground + 1.5f;
|
||||
AbsolutePosition = pos;
|
||||
}
|
||||
|
||||
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||
if (!MakeRootAgent(AbsolutePosition, flying))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root",
|
||||
Name, Scene.Name);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Tell the client that we're totally ready
|
||||
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
|
||||
|
||||
// Remember in HandleUseCircuitCode, we delayed this to here
|
||||
if (m_teleportFlags > 0)
|
||||
SendInitialDataToMe();
|
||||
|
||||
// m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
|
||||
|
||||
if (!string.IsNullOrEmpty(m_callbackURI))
|
||||
{
|
||||
// We cannot sleep here since this would hold up the inbound packet processing thread, as
|
||||
// CompleteMovement() is executed synchronously. However, it might be better to delay the release
|
||||
// here until we know for sure that the agent is active in this region. Sending AgentMovementComplete
|
||||
// is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this
|
||||
// region as the current region, meaning that a close sent before then will fail the teleport.
|
||||
// System.Threading.Thread.Sleep(2000);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}",
|
||||
client.Name, client.AgentId, m_callbackURI);
|
||||
|
||||
UUID originID;
|
||||
|
||||
lock (m_originRegionIDAccessLock)
|
||||
originID = m_originRegionID;
|
||||
|
||||
Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI);
|
||||
m_callbackURI = null;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}",
|
||||
// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
|
||||
// }
|
||||
|
||||
ValidateAndSendAppearanceAndAgentData();
|
||||
|
||||
// Create child agents in neighbouring regions
|
||||
if (openChildAgents && !IsChildAgent)
|
||||
{
|
||||
IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
|
||||
if (m_agentTransfer != null)
|
||||
m_agentTransfer.EnableChildAgents(this);
|
||||
|
||||
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||
if (friendsModule != null)
|
||||
friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
|
||||
|
||||
}
|
||||
|
||||
// XXX: If we force an update here, then multiple attachments do appear correctly on a destination region
|
||||
// If we do it a little bit earlier (e.g. when converting the child to a root agent) then this does not work.
|
||||
// This may be due to viewer code or it may be something we're not doing properly simulator side.
|
||||
lock (m_attachments)
|
||||
{
|
||||
foreach (SceneObjectGroup sog in m_attachments)
|
||||
sog.ScheduleGroupForFullUpdate();
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
|
||||
// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -3257,7 +3273,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
float distanceError = Vector3.Distance(OffsetPosition, expectedPosition);
|
||||
|
||||
float speed = Velocity.Length();
|
||||
float velocidyDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity);
|
||||
float velocityDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Delta-v {0}, lastVelocity {1}, Velocity {2} for {3} in {4}",
|
||||
// velocidyDiff, lastVelocitySentToAllClients, Velocity, Name, Scene.Name);
|
||||
|
||||
// assuming 5 ms. worst case precision for timer, use 2x that
|
||||
// for distance error threshold
|
||||
|
@ -3265,8 +3285,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (speed < 0.01f // allow rotation updates if avatar position is unchanged
|
||||
|| Math.Abs(distanceError) > distanceErrorThreshold
|
||||
|| velocidyDiff > 0.01f) // did velocity change from last update?
|
||||
|| velocityDiff > 0.01f) // did velocity change from last update?
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Update triggered with speed {0}, distanceError {1}, distanceThreshold {2}, delta-v {3} for {4} in {5}",
|
||||
// speed, distanceError, distanceErrorThreshold, velocidyDiff, Name, Scene.Name);
|
||||
|
||||
lastVelocitySentToAllClients = Velocity;
|
||||
lastTerseUpdateToAllClientsTick = currentTick;
|
||||
lastPositionSentToAllClients = OffsetPosition;
|
||||
|
@ -3579,65 +3603,50 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero)
|
||||
return;
|
||||
|
||||
if (!IsInTransit)
|
||||
if (IsInTransit)
|
||||
return;
|
||||
|
||||
Vector3 pos2 = AbsolutePosition;
|
||||
Vector3 origPosition = pos2;
|
||||
Vector3 vel = Velocity;
|
||||
|
||||
// Compute the avatar position in the next physics tick.
|
||||
// If the avatar will be crossing, we force the crossing to happen now
|
||||
// in the hope that this will make the avatar movement smoother when crossing.
|
||||
float timeStep = 0.1f;
|
||||
pos2.X = pos2.X + (vel.X * timeStep);
|
||||
pos2.Y = pos2.Y + (vel.Y * timeStep);
|
||||
pos2.Z = pos2.Z + (vel.Z * timeStep);
|
||||
|
||||
if (m_scene.PositionIsInCurrentRegion(pos2))
|
||||
return;
|
||||
|
||||
m_log.DebugFormat("{0} CheckForBorderCrossing: position outside region. {1} in {2} at pos {3}",
|
||||
LogHeader, Name, Scene.Name, pos2);
|
||||
|
||||
// Disconnect from the current region
|
||||
bool isFlying = Flying;
|
||||
RemoveFromPhysicalScene();
|
||||
// pos2 is the forcasted position so make that the 'current' position so the crossing
|
||||
// code will move us into the newly addressed region.
|
||||
m_pos = pos2;
|
||||
if (CrossToNewRegion())
|
||||
{
|
||||
Vector3 pos2 = AbsolutePosition;
|
||||
Vector3 origPosition = pos2;
|
||||
Vector3 vel = Velocity;
|
||||
|
||||
// Compute the avatar position in the next physics tick.
|
||||
// If the avatar will be crossing, we force the crossing to happen now
|
||||
// in the hope that this will make the avatar movement smoother when crossing.
|
||||
float timeStep = 0.1f;
|
||||
pos2.X = pos2.X + (vel.X * timeStep);
|
||||
pos2.Y = pos2.Y + (vel.Y * timeStep);
|
||||
pos2.Z = pos2.Z + (vel.Z * timeStep);
|
||||
|
||||
if (!IsInTransit)
|
||||
AddToPhysicalScene(isFlying);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Tried to make crossing happen but it failed.
|
||||
if (m_requestedSitTargetUUID == UUID.Zero)
|
||||
{
|
||||
if (!m_scene.PositionIsInCurrentRegion(pos2))
|
||||
{
|
||||
m_log.DebugFormat("{0} CheckForBorderCrossing: position outside region. {1} in {2} at pos {3}",
|
||||
LogHeader, Name, Scene.Name, pos2);
|
||||
m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader);
|
||||
|
||||
// Disconnect from the current region
|
||||
bool isFlying = Flying;
|
||||
RemoveFromPhysicalScene();
|
||||
// pos2 is the forcasted position so make that the 'current' position so the crossing
|
||||
// code will move us into the newly addressed region.
|
||||
m_pos = pos2;
|
||||
if (CrossToNewRegion())
|
||||
{
|
||||
AddToPhysicalScene(isFlying);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Tried to make crossing happen but it failed.
|
||||
if (m_requestedSitTargetUUID == UUID.Zero)
|
||||
{
|
||||
m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader);
|
||||
Velocity = Vector3.Zero;
|
||||
AbsolutePosition = EnforceSanityOnPosition(origPosition);
|
||||
|
||||
Velocity = Vector3.Zero;
|
||||
AbsolutePosition = EnforceSanityOnPosition(origPosition);
|
||||
|
||||
AddToPhysicalScene(isFlying);
|
||||
}
|
||||
}
|
||||
}
|
||||
AddToPhysicalScene(isFlying);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This constant has been inferred from experimentation
|
||||
// I'm not sure what this value should be, so I tried a few values.
|
||||
timeStep = 0.04f;
|
||||
pos2 = AbsolutePosition;
|
||||
pos2.X = pos2.X + (vel.X * timeStep);
|
||||
pos2.Y = pos2.Y + (vel.Y * timeStep);
|
||||
// Don't touch the Z
|
||||
m_pos = pos2;
|
||||
m_log.DebugFormat("[SCENE PRESENCE]: In transit m_pos={0}", m_pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Given a position, make sure it is within the current region.
|
||||
|
@ -3725,7 +3734,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
|
||||
// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
|
||||
if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY))
|
||||
float dist = (float)Math.Max(Scene.DefaultDrawDistance,
|
||||
(float)Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY));
|
||||
if (Util.IsOutsideView(dist, x, newRegionX, y, newRegionY))
|
||||
{
|
||||
byebyeRegions.Add(handle);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,249 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim;
|
||||
using OpenSim.ApplicationPlugins.RegionModulesController;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
public class SharedRegionModuleTests : OpenSimTestCase
|
||||
{
|
||||
// [Test]
|
||||
public void TestLifecycle()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
TestHelpers.EnableLogging();
|
||||
|
||||
UUID estateOwnerId = TestHelpers.ParseTail(0x1);
|
||||
UUID regionId = TestHelpers.ParseTail(0x10);
|
||||
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
configSource.AddConfig("Startup");
|
||||
configSource.AddConfig("Modules");
|
||||
|
||||
// // We use this to skip estate questions
|
||||
// Turns out not to be needed is estate owner id is pre-set in region information.
|
||||
// IConfig estateConfig = configSource.AddConfig(OpenSimBase.ESTATE_SECTION_NAME);
|
||||
// estateConfig.Set("DefaultEstateOwnerName", "Zaphod Beeblebrox");
|
||||
// estateConfig.Set("DefaultEstateOwnerUUID", estateOwnerId);
|
||||
// estateConfig.Set("DefaultEstateOwnerEMail", "zaphod@galaxy.com");
|
||||
// estateConfig.Set("DefaultEstateOwnerPassword", "two heads");
|
||||
|
||||
// For grid servic
|
||||
configSource.AddConfig("GridService");
|
||||
configSource.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
|
||||
configSource.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
|
||||
configSource.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
|
||||
configSource.Configs["GridService"].Set("ConnectionString", "!static");
|
||||
|
||||
LocalGridServicesConnector gridService = new LocalGridServicesConnector();
|
||||
//
|
||||
OpenSim sim = new OpenSim(configSource);
|
||||
|
||||
sim.SuppressExit = true;
|
||||
sim.EnableInitialPluginLoad = false;
|
||||
sim.LoadEstateDataService = false;
|
||||
sim.NetServersInfo.HttpListenerPort = 0;
|
||||
|
||||
IRegistryCore reg = sim.ApplicationRegistry;
|
||||
|
||||
RegionInfo ri = new RegionInfo();
|
||||
ri.RegionID = regionId;
|
||||
ri.EstateSettings.EstateOwner = estateOwnerId;
|
||||
ri.InternalEndPoint = new IPEndPoint(0, 0);
|
||||
|
||||
MockRegionModulesControllerPlugin rmcp = new MockRegionModulesControllerPlugin();
|
||||
sim.m_plugins = new List<IApplicationPlugin>() { rmcp };
|
||||
reg.RegisterInterface<IRegionModulesController>(rmcp);
|
||||
|
||||
// XXX: Have to initialize directly for now
|
||||
rmcp.Initialise(sim);
|
||||
|
||||
rmcp.AddNode(gridService);
|
||||
|
||||
TestSharedRegion tsr = new TestSharedRegion();
|
||||
rmcp.AddNode(tsr);
|
||||
|
||||
// FIXME: Want to use the real one eventually but this is currently directly tied into Mono.Addins
|
||||
// which has been written in such a way that makes it impossible to use for regression tests.
|
||||
// RegionModulesControllerPlugin rmcp = new RegionModulesControllerPlugin();
|
||||
// rmcp.LoadModulesFromAddins = false;
|
||||
//// reg.RegisterInterface<IRegionModulesController>(rmcp);
|
||||
// rmcp.Initialise(sim);
|
||||
// rmcp.PostInitialise();
|
||||
// TypeExtensionNode node = new TypeExtensionNode();
|
||||
// node.
|
||||
// rmcp.AddNode(node, configSource.Configs["Modules"], new Dictionary<RuntimeAddin, IList<int>>());
|
||||
|
||||
sim.Startup();
|
||||
IScene scene;
|
||||
sim.CreateRegion(ri, out scene);
|
||||
|
||||
sim.Shutdown();
|
||||
|
||||
List<string> co = tsr.CallOrder;
|
||||
int expectedEventCount = 6;
|
||||
|
||||
Assert.AreEqual(
|
||||
expectedEventCount,
|
||||
co.Count,
|
||||
"Expected {0} events but only got {1} ({2})",
|
||||
expectedEventCount, co.Count, string.Join(",", co));
|
||||
Assert.AreEqual("Initialise", co[0]);
|
||||
Assert.AreEqual("PostInitialise", co[1]);
|
||||
Assert.AreEqual("AddRegion", co[2]);
|
||||
Assert.AreEqual("RegionLoaded", co[3]);
|
||||
Assert.AreEqual("RemoveRegion", co[4]);
|
||||
Assert.AreEqual("Close", co[5]);
|
||||
}
|
||||
}
|
||||
|
||||
class TestSharedRegion : ISharedRegionModule
|
||||
{
|
||||
// FIXME: Should really use MethodInfo
|
||||
public List<string> CallOrder = new List<string>();
|
||||
|
||||
public string Name { get { return "TestSharedRegion"; } }
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
CallOrder.Add("PostInitialise");
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
CallOrder.Add("Initialise");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
CallOrder.Add("Close");
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
CallOrder.Add("AddRegion");
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
CallOrder.Add("RemoveRegion");
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
CallOrder.Add("RegionLoaded");
|
||||
}
|
||||
}
|
||||
|
||||
class MockRegionModulesControllerPlugin : IRegionModulesController, IApplicationPlugin
|
||||
{
|
||||
// List of shared module instances, for adding to Scenes
|
||||
private List<ISharedRegionModule> m_sharedInstances = new List<ISharedRegionModule>();
|
||||
|
||||
// Config access
|
||||
private OpenSimBase m_openSim;
|
||||
|
||||
public string Version { get { return "0"; } }
|
||||
public string Name { get { return "MockRegionModulesControllerPlugin"; } }
|
||||
|
||||
public void Initialise() {}
|
||||
|
||||
public void Initialise(OpenSimBase sim)
|
||||
{
|
||||
m_openSim = sim;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the application loading is completed
|
||||
/// </summary>
|
||||
public void PostInitialise()
|
||||
{
|
||||
foreach (ISharedRegionModule module in m_sharedInstances)
|
||||
module.PostInitialise();
|
||||
}
|
||||
|
||||
public void AddRegionToModules(Scene scene)
|
||||
{
|
||||
List<ISharedRegionModule> sharedlist = new List<ISharedRegionModule>();
|
||||
|
||||
foreach (ISharedRegionModule module in m_sharedInstances)
|
||||
{
|
||||
module.AddRegion(scene);
|
||||
scene.AddRegionModule(module.Name, module);
|
||||
|
||||
sharedlist.Add(module);
|
||||
}
|
||||
|
||||
foreach (ISharedRegionModule module in sharedlist)
|
||||
{
|
||||
module.RegionLoaded(scene);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionFromModules(Scene scene)
|
||||
{
|
||||
foreach (IRegionModuleBase module in scene.RegionModules.Values)
|
||||
{
|
||||
// m_log.DebugFormat("[REGIONMODULE]: Removing scene {0} from module {1}",
|
||||
// scene.RegionInfo.RegionName, module.Name);
|
||||
module.RemoveRegion(scene);
|
||||
}
|
||||
|
||||
scene.RegionModules.Clear();
|
||||
}
|
||||
|
||||
public void AddNode(ISharedRegionModule module)
|
||||
{
|
||||
m_sharedInstances.Add(module);
|
||||
module.Initialise(m_openSim.ConfigSource.Source);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// We expect that all regions have been removed already
|
||||
while (m_sharedInstances.Count > 0)
|
||||
{
|
||||
m_sharedInstances[0].Close();
|
||||
m_sharedInstances.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -458,35 +458,36 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (null == assetBase)
|
||||
return;
|
||||
|
||||
MemoryStream ms = new MemoryStream(assetBase.Data);
|
||||
StreamReader sr = new StreamReader(ms);
|
||||
|
||||
sr.ReadLine(); // Unknown (Version?)
|
||||
sr.ReadLine(); // Unknown
|
||||
sr.ReadLine(); // Unknown
|
||||
sr.ReadLine(); // Name
|
||||
sr.ReadLine(); // Comment ?
|
||||
int count = Convert.ToInt32(sr.ReadLine()); // Item count
|
||||
|
||||
for (int i = 0 ; i < count ; i++)
|
||||
using (MemoryStream ms = new MemoryStream(assetBase.Data))
|
||||
using (StreamReader sr = new StreamReader(ms))
|
||||
{
|
||||
string type = sr.ReadLine();
|
||||
if (type == null)
|
||||
break;
|
||||
string name = sr.ReadLine();
|
||||
if (name == null)
|
||||
break;
|
||||
string id = sr.ReadLine();
|
||||
if (id == null)
|
||||
break;
|
||||
string unknown = sr.ReadLine();
|
||||
if (unknown == null)
|
||||
break;
|
||||
sr.ReadLine(); // Unknown (Version?)
|
||||
sr.ReadLine(); // Unknown
|
||||
sr.ReadLine(); // Unknown
|
||||
sr.ReadLine(); // Name
|
||||
sr.ReadLine(); // Comment ?
|
||||
int count = Convert.ToInt32(sr.ReadLine()); // Item count
|
||||
|
||||
// If it can be parsed as a UUID, it is an asset ID
|
||||
UUID uuid;
|
||||
if (UUID.TryParse(id, out uuid))
|
||||
assetUuids[uuid] = (sbyte)AssetType.Animation;
|
||||
for (int i = 0 ; i < count ; i++)
|
||||
{
|
||||
string type = sr.ReadLine();
|
||||
if (type == null)
|
||||
break;
|
||||
string name = sr.ReadLine();
|
||||
if (name == null)
|
||||
break;
|
||||
string id = sr.ReadLine();
|
||||
if (id == null)
|
||||
break;
|
||||
string unknown = sr.ReadLine();
|
||||
if (unknown == null)
|
||||
break;
|
||||
|
||||
// If it can be parsed as a UUID, it is an asset ID
|
||||
UUID uuid;
|
||||
if (UUID.TryParse(id, out uuid))
|
||||
assetUuids[uuid] = (sbyte)AssetType.Animation; // the asset is either an Animation or a Sound, but this distinction isn't important
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -487,7 +487,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
|
|||
report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding));
|
||||
|
||||
report.AppendFormat(
|
||||
"{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n",
|
||||
"{0,8} {1,7} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7}\n",
|
||||
"Max",
|
||||
"Total",
|
||||
"Resend",
|
||||
"Land",
|
||||
|
@ -499,7 +500,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
|
|||
|
||||
report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", "");
|
||||
report.AppendFormat(
|
||||
"{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
|
||||
"{0,8} {1,7} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7}\n",
|
||||
"kb/s",
|
||||
"kb/s",
|
||||
"kb/s",
|
||||
"kb/s",
|
||||
|
@ -548,7 +550,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
|
|||
report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding));
|
||||
|
||||
report.AppendFormat(
|
||||
"{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
|
||||
"{0,8} {1,7} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7}",
|
||||
(ci.maxThrottle * 8) / 1000,
|
||||
(ci.totalThrottle * 8) / 1000,
|
||||
(ci.resendThrottle * 8) / 1000,
|
||||
(ci.landThrottle * 8) / 1000,
|
||||
|
@ -584,7 +587,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
|
|||
|
||||
ThrottleRates throttleRates = udpServer.ThrottleRates;
|
||||
report.AppendFormat(
|
||||
"{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
|
||||
"{0,8} {1,7} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7}",
|
||||
"-",
|
||||
(throttleRates.Total * 8) / 1000,
|
||||
(throttleRates.Resend * 8) / 1000,
|
||||
(throttleRates.Land * 8) / 1000,
|
||||
|
|
|
@ -216,7 +216,12 @@ namespace OpenSim.Region.OptionalModules.Materials
|
|||
|
||||
GetLegacyStoredMaterialsInPart(part);
|
||||
|
||||
GetStoredMaterialInFace(part, te.DefaultTexture);
|
||||
if (te.DefaultTexture != null)
|
||||
GetStoredMaterialInFace(part, te.DefaultTexture);
|
||||
else
|
||||
m_log.WarnFormat(
|
||||
"[Materials]: Default texture for part {0} (part of object {1)) in {2} unexpectedly null. Ignoring.",
|
||||
part.Name, part.ParentGroup.Name, m_scene.Name);
|
||||
|
||||
foreach (Primitive.TextureEntryFace face in te.FaceTextures)
|
||||
{
|
||||
|
|
|
@ -465,13 +465,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
|||
Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE));
|
||||
}
|
||||
|
||||
// Test for non-existant path
|
||||
// Test for non-existent path
|
||||
{
|
||||
int result = (int)InvokeOp("JsonGetNodeType", storeId, "foo");
|
||||
Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF));
|
||||
}
|
||||
|
||||
// Test for non-existant store
|
||||
// Test for non-existent store
|
||||
{
|
||||
UUID fakeStoreId = TestHelpers.ParseTail(0x500);
|
||||
int result = (int)InvokeOp("JsonGetNodeType", fakeStoreId, ".");
|
||||
|
@ -898,4 +898,4 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
|||
|
||||
public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
/// AutoBackupBusyCheck: True/False. Default: True.
|
||||
/// If True, we will only take an auto-backup if a set of conditions are met.
|
||||
/// These conditions are heuristics to try and avoid taking a backup when the sim is busy.
|
||||
/// AutoBackupSkipAssets
|
||||
/// If true, assets are not saved to the oar file. Considerably reduces impact on simulator when backing up. Intended for when assets db is backed up separately
|
||||
/// AutoBackupScript: String. Default: not specified (disabled).
|
||||
/// File path to an executable script or binary to run when an automatic backup is taken.
|
||||
/// The file should really be (Windows) an .exe or .bat, or (Linux/Mac) a shell script or binary.
|
||||
|
@ -258,6 +260,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
AutoBackupModuleState abms = this.ParseConfig(scene, false);
|
||||
m_log.Debug("[AUTO BACKUP]: Config for " + scene.RegionInfo.RegionName);
|
||||
m_log.Debug((abms == null ? "DEFAULT" : abms.ToString()));
|
||||
|
||||
m_states.Add(scene, abms);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -334,7 +338,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
double interval =
|
||||
this.ResolveDouble("AutoBackupInterval", this.m_defaultState.IntervalMinutes,
|
||||
config, regionConfig) * 60000.0;
|
||||
if (state == null && interval != this.m_defaultState.IntervalMinutes*60000.0)
|
||||
if (state == null && interval != this.m_defaultState.IntervalMinutes * 60000.0)
|
||||
{
|
||||
state = new AutoBackupModuleState();
|
||||
}
|
||||
|
@ -412,6 +416,19 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
state.BusyCheck = tmpBusyCheck;
|
||||
}
|
||||
|
||||
// Included Option To Skip Assets
|
||||
bool tmpSkipAssets = ResolveBoolean("AutoBackupSkipAssets",
|
||||
this.m_defaultState.SkipAssets, config, regionConfig);
|
||||
if (state == null && tmpSkipAssets != this.m_defaultState.SkipAssets)
|
||||
{
|
||||
state = new AutoBackupModuleState();
|
||||
}
|
||||
|
||||
if (state != null)
|
||||
{
|
||||
state.SkipAssets = tmpSkipAssets;
|
||||
}
|
||||
|
||||
// Set file naming algorithm
|
||||
string stmpNamingType = ResolveString("AutoBackupNaming",
|
||||
this.m_defaultState.NamingType.ToString(), config, regionConfig);
|
||||
|
@ -488,6 +505,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
}
|
||||
}
|
||||
|
||||
if(state == null)
|
||||
return m_defaultState;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -640,7 +660,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
/// <param name="scene"></param>
|
||||
private void DoRegionBackup(IScene scene)
|
||||
{
|
||||
if (scene.RegionStatus != RegionStatus.Up)
|
||||
if (!scene.Ready)
|
||||
{
|
||||
// We won't backup a region that isn't operating normally.
|
||||
m_log.Warn("[AUTO BACKUP]: Not backing up region " + scene.RegionInfo.RegionName +
|
||||
|
@ -662,7 +682,16 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
m_pendingSaves.Add(guid, scene);
|
||||
state.LiveRequests.Add(guid, savePath);
|
||||
((Scene) scene).EventManager.OnOarFileSaved += new EventManager.OarFileSaved(EventManager_OnOarFileSaved);
|
||||
iram.ArchiveRegion(savePath, guid, null);
|
||||
|
||||
m_log.Info("[AUTO BACKUP]: Backing up region " + scene.RegionInfo.RegionName);
|
||||
|
||||
// Must pass options, even if dictionary is empty!
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
|
||||
if (state.SkipAssets)
|
||||
options["noassets"] = true;
|
||||
|
||||
iram.ArchiveRegion(savePath, guid, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
this.Enabled = false;
|
||||
this.BackupDir = ".";
|
||||
this.BusyCheck = true;
|
||||
this.SkipAssets = false;
|
||||
this.Timer = null;
|
||||
this.NamingType = NamingType.Time;
|
||||
this.Script = null;
|
||||
|
@ -91,6 +92,12 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
|||
set;
|
||||
}
|
||||
|
||||
public bool SkipAssets
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string Script
|
||||
{
|
||||
get;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -205,6 +205,17 @@ public class BSActorAvatarMove : BSActor
|
|||
// Flying and not colliding and velocity nearly zero.
|
||||
m_controllingPrim.ZeroMotion(true /* inTaintTime */);
|
||||
}
|
||||
else
|
||||
{
|
||||
//We are falling but are not touching any keys make sure not falling too fast
|
||||
if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity)
|
||||
{
|
||||
|
||||
OMV.Vector3 slowingForce = new OMV.Vector3(0f, 0f, BSParam.AvatarTerminalVelocity - m_controllingPrim.RawVelocity.Z) * m_controllingPrim.Mass;
|
||||
m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, slowingForce);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2}",
|
||||
|
@ -227,7 +238,6 @@ public class BSActorAvatarMove : BSActor
|
|||
stepVelocity.Z = m_controllingPrim.RawVelocity.Z;
|
||||
}
|
||||
|
||||
|
||||
// Colliding and not flying with an upward force. The avatar must be trying to jump.
|
||||
if (!m_controllingPrim.Flying && m_controllingPrim.IsColliding && stepVelocity.Z > 0)
|
||||
{
|
||||
|
@ -253,12 +263,34 @@ public class BSActorAvatarMove : BSActor
|
|||
}
|
||||
else
|
||||
{
|
||||
// Since we're not affected by anything, whatever vertical motion the avatar has, continue that.
|
||||
stepVelocity.Z = m_controllingPrim.RawVelocity.Z;
|
||||
|
||||
// Since we're not affected by anything, the avatar must be falling and we do not want that to be too fast.
|
||||
if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity)
|
||||
{
|
||||
|
||||
stepVelocity.Z = BSParam.AvatarTerminalVelocity;
|
||||
}
|
||||
else
|
||||
{
|
||||
stepVelocity.Z = m_controllingPrim.RawVelocity.Z;
|
||||
}
|
||||
}
|
||||
// DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
|
||||
}
|
||||
|
||||
//Alicia: Maintain minimum height when flying.
|
||||
// SL has a flying effect that keeps the avatar flying above the ground by some margin
|
||||
if (m_controllingPrim.Flying)
|
||||
{
|
||||
float hover_height = m_physicsScene.TerrainManager.GetTerrainHeightAtXYZ(m_controllingPrim.RawPosition)
|
||||
+ BSParam.AvatarFlyingGroundMargin;
|
||||
|
||||
if( m_controllingPrim.Position.Z < hover_height)
|
||||
{
|
||||
stepVelocity.Z += BSParam.AvatarFlyingGroundUpForce;
|
||||
}
|
||||
}
|
||||
|
||||
// 'stepVelocity' is now the speed we'd like the avatar to move in. Turn that into an instantanous force.
|
||||
OMV.Vector3 moveForce = (stepVelocity - m_controllingPrim.RawVelocity) * m_controllingPrim.Mass;
|
||||
|
||||
|
|
|
@ -744,7 +744,18 @@ public sealed class BSCharacter : BSPhysObject
|
|||
// and will send agent updates to the clients if velocity changes by more than
|
||||
// 0.001m/s. Bullet introduces a lot of jitter in the velocity which causes many
|
||||
// extra updates.
|
||||
if (!entprop.Velocity.ApproxEquals(RawVelocity, 0.1f))
|
||||
//
|
||||
// XXX: Contrary to the above comment, setting an update threshold here above 0.4 actually introduces jitter to
|
||||
// avatar movement rather than removes it. The larger the threshold, the bigger the jitter.
|
||||
// This is most noticeable in level flight and can be seen with
|
||||
// the "show updates" option in a viewer. With an update threshold, the RawVelocity cycles between a lower
|
||||
// bound and an upper bound, where the difference between the two is enough to trigger a large delta v update
|
||||
// and subsequently trigger an update in ScenePresence.SendTerseUpdateToAllClients(). The cause of this cycle (feedback?)
|
||||
// has not yet been identified.
|
||||
//
|
||||
// If there is a threshold below 0.4 or no threshold check at all (as in ODE), then RawVelocity stays constant and extra
|
||||
// updates are not triggered in ScenePresence.SendTerseUpdateToAllClients().
|
||||
// if (!entprop.Velocity.ApproxEquals(RawVelocity, 0.1f))
|
||||
RawVelocity = entprop.Velocity;
|
||||
|
||||
_acceleration = entprop.Acceleration;
|
||||
|
|
|
@ -305,6 +305,10 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
// Note that this works for rebuilding just the root after a linkset is taken apart.
|
||||
// Called at taint time!!
|
||||
private bool UseBulletSimRootOffsetHack = false; // Attempt to have Bullet track the coords of root compound shape
|
||||
// Number of times to perform rebuilds on broken linkset children. This should only happen when
|
||||
// a linkset is initially being created and should happen only one or two times at the most.
|
||||
// This exists to cause a looping problem to be reported while not rebuilding a linkset forever.
|
||||
private static int LinksetRebuildFailureLoopPrevention = 10;
|
||||
private void RecomputeLinksetCompound()
|
||||
{
|
||||
try
|
||||
|
@ -376,18 +380,42 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
OMV.Quaternion offsetRot = OMV.Quaternion.Normalize(cPrim.RawOrientation) * invRootOrientation;
|
||||
|
||||
// Add the child shape to the compound shape being built
|
||||
m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot);
|
||||
DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}",
|
||||
LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot);
|
||||
|
||||
// Since we are borrowing the shape of the child, disable the origional child body
|
||||
if (!IsRoot(cPrim))
|
||||
if (childShape.physShapeInfo.HasPhysicalShape)
|
||||
{
|
||||
m_physicsScene.PE.AddToCollisionFlags(cPrim.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
|
||||
m_physicsScene.PE.ForceActivationState(cPrim.PhysBody, ActivationState.DISABLE_SIMULATION);
|
||||
// We don't want collisions from the old linkset children.
|
||||
m_physicsScene.PE.RemoveFromCollisionFlags(cPrim.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
|
||||
cPrim.PhysBody.collisionType = CollisionType.LinksetChild;
|
||||
m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot);
|
||||
DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}",
|
||||
LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot);
|
||||
|
||||
// Since we are borrowing the shape of the child, disable the origional child body
|
||||
if (!IsRoot(cPrim))
|
||||
{
|
||||
m_physicsScene.PE.AddToCollisionFlags(cPrim.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
|
||||
m_physicsScene.PE.ForceActivationState(cPrim.PhysBody, ActivationState.DISABLE_SIMULATION);
|
||||
// We don't want collisions from the old linkset children.
|
||||
m_physicsScene.PE.RemoveFromCollisionFlags(cPrim.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
|
||||
cPrim.PhysBody.collisionType = CollisionType.LinksetChild;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The linkset must be in an intermediate state where all the children have not yet
|
||||
// been constructed. This sometimes happens on startup when everything is getting
|
||||
// built and some shapes have to wait for assets to be read in.
|
||||
// Just skip this linkset for the moment and cause the shape to be rebuilt next tick.
|
||||
// One problem might be that the shape is broken somehow and it never becomes completely
|
||||
// available. This might cause the rebuild to happen over and over.
|
||||
LinksetRoot.ForceBodyShapeRebuild(false);
|
||||
DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChildWithNoShape,indx={1},cShape={2},offPos={3},offRot={4}",
|
||||
LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot);
|
||||
// Output an annoying warning. It should only happen once but if it keeps coming out,
|
||||
// the user knows there is something wrong and will report it.
|
||||
m_physicsScene.Logger.WarnFormat("{0} Linkset rebuild warning. If this happens more than one or two times, please report in Mantis 7191", LogHeader);
|
||||
m_physicsScene.Logger.WarnFormat("{0} pName={1}, childIdx={2}, shape={3}",
|
||||
LogHeader, LinksetRoot.Name, cPrim.LinksetChildIndex, childShape);
|
||||
|
||||
// This causes the loop to bail on building the rest of this linkset.
|
||||
// The rebuild operation should fix it up or declare the object unbuildable.
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; // 'false' says to move onto the next child in the list
|
||||
|
|
|
@ -136,6 +136,9 @@ public static class BSParam
|
|||
public static float AvatarHeightLowFudge { get; private set; }
|
||||
public static float AvatarHeightMidFudge { get; private set; }
|
||||
public static float AvatarHeightHighFudge { get; private set; }
|
||||
public static float AvatarFlyingGroundMargin { get; private set; }
|
||||
public static float AvatarFlyingGroundUpForce { get; private set; }
|
||||
public static float AvatarTerminalVelocity { get; private set; }
|
||||
public static float AvatarContactProcessingThreshold { get; private set; }
|
||||
public static float AvatarStopZeroThreshold { get; private set; }
|
||||
public static int AvatarJumpFrames { get; private set; }
|
||||
|
@ -583,6 +586,12 @@ public static class BSParam
|
|||
0f ),
|
||||
new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground",
|
||||
0f ),
|
||||
new ParameterDefn<float>("AvatarFlyingGroundMargin", "Meters avatar is kept above the ground when flying",
|
||||
5f ),
|
||||
new ParameterDefn<float>("AvatarFlyingGroundUpForce", "Upward force applied to the avatar to keep it at flying ground margin",
|
||||
2.0f ),
|
||||
new ParameterDefn<float>("AvatarTerminalVelocity", "Terminal Velocity of falling avatar",
|
||||
-54.0f ),
|
||||
new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
|
||||
0.1f ),
|
||||
new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped",
|
||||
|
|
|
@ -159,6 +159,11 @@ public abstract class BSPhysObject : PhysicsActor
|
|||
Unknown, Waiting, FailedAssetFetch, FailedMeshing, Fetched
|
||||
}
|
||||
public PrimAssetCondition PrimAssetState { get; set; }
|
||||
public virtual bool AssetFailed()
|
||||
{
|
||||
return ( (this.PrimAssetState == PrimAssetCondition.FailedAssetFetch)
|
||||
|| (this.PrimAssetState == PrimAssetCondition.FailedMeshing) );
|
||||
}
|
||||
|
||||
// The objects base shape information. Null if not a prim type shape.
|
||||
public PrimitiveBaseShape BaseShape { get; protected set; }
|
||||
|
@ -462,7 +467,10 @@ public abstract class BSPhysObject : PhysicsActor
|
|||
|
||||
// If someone has subscribed for collision events log the collision so it will be reported up
|
||||
if (SubscribedEvents()) {
|
||||
CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
|
||||
lock (PhysScene.CollisionLock)
|
||||
{
|
||||
CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
|
||||
}
|
||||
DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}",
|
||||
LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving);
|
||||
|
||||
|
@ -474,12 +482,14 @@ public abstract class BSPhysObject : PhysicsActor
|
|||
// Send the collected collisions into the simulator.
|
||||
// Called at taint time from within the Step() function thus no locking problems
|
||||
// with CollisionCollection and ObjectsWithNoMoreCollisions.
|
||||
// Called with BSScene.CollisionLock locked to protect the collision lists.
|
||||
// Return 'true' if there were some actual collisions passed up
|
||||
public virtual bool SendCollisions()
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
// If the 'no collision' call, force it to happen right now so quick collision_end
|
||||
// If no collisions this call but there were collisions last call, force the collision
|
||||
// event to be happen right now so quick collision_end.
|
||||
bool force = (CollisionCollection.Count == 0 && CollisionsLastReported.Count != 0);
|
||||
|
||||
// throttle the collisions to the number of milliseconds specified in the subscription
|
||||
|
|
|
@ -705,7 +705,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
// this is is under UpdateLock.
|
||||
public void PostUpdate(BSPhysObject updatee)
|
||||
{
|
||||
ObjectsWithUpdates.Add(updatee);
|
||||
lock (UpdateLock)
|
||||
{
|
||||
ObjectsWithUpdates.Add(updatee);
|
||||
}
|
||||
}
|
||||
|
||||
// The simulator thinks it is physics time so return all the collisions and position
|
||||
|
@ -803,7 +806,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration))
|
||||
{
|
||||
// If a collision was 'good', remember to send it to the simulator
|
||||
ObjectsWithCollisions.Add(collider);
|
||||
lock (CollisionLock)
|
||||
{
|
||||
ObjectsWithCollisions.Add(collider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,8 +177,7 @@ public abstract class BSShape
|
|||
{
|
||||
// If this mesh has an underlying asset and we have not failed getting it before, fetch the asset
|
||||
if (prim.BaseShape.SculptEntry
|
||||
&& prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedAssetFetch
|
||||
&& prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedMeshing
|
||||
&& !prim.AssetFailed()
|
||||
&& prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting
|
||||
&& prim.BaseShape.SculptTexture != OMV.UUID.Zero
|
||||
)
|
||||
|
@ -189,50 +188,46 @@ public abstract class BSShape
|
|||
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting;
|
||||
|
||||
BSPhysObject xprim = prim;
|
||||
Util.FireAndForget(delegate
|
||||
RequestAssetDelegate assetProvider = physicsScene.RequestAssetMethod;
|
||||
if (assetProvider != null)
|
||||
{
|
||||
BSPhysObject yprim = xprim; // probably not necessary, but, just in case.
|
||||
assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset)
|
||||
{
|
||||
// physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,inFireAndForget", xprim.LocalID);
|
||||
RequestAssetDelegate assetProvider = physicsScene.RequestAssetMethod;
|
||||
if (assetProvider != null)
|
||||
// physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,assetProviderCallback", xprim.LocalID);
|
||||
bool assetFound = false;
|
||||
string mismatchIDs = String.Empty; // DEBUG DEBUG
|
||||
if (asset != null && yprim.BaseShape.SculptEntry)
|
||||
{
|
||||
BSPhysObject yprim = xprim; // probably not necessary, but, just in case.
|
||||
assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset)
|
||||
if (yprim.BaseShape.SculptTexture.ToString() == asset.ID)
|
||||
{
|
||||
// physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,assetProviderCallback", xprim.LocalID);
|
||||
bool assetFound = false;
|
||||
string mismatchIDs = String.Empty; // DEBUG DEBUG
|
||||
if (asset != null && yprim.BaseShape.SculptEntry)
|
||||
{
|
||||
if (yprim.BaseShape.SculptTexture.ToString() == asset.ID)
|
||||
{
|
||||
yprim.BaseShape.SculptData = asset.Data;
|
||||
// This will cause the prim to see that the filler shape is not the right
|
||||
// one and try again to build the object.
|
||||
// No race condition with the normal shape setting since the rebuild is at taint time.
|
||||
yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched;
|
||||
yprim.ForceBodyShapeRebuild(false /* inTaintTime */);
|
||||
assetFound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID;
|
||||
}
|
||||
}
|
||||
if (!assetFound)
|
||||
{
|
||||
yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
|
||||
}
|
||||
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAssetCallback,found={1},isSculpt={2},ids={3}",
|
||||
yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs );
|
||||
});
|
||||
yprim.BaseShape.SculptData = asset.Data;
|
||||
// This will cause the prim to see that the filler shape is not the right
|
||||
// one and try again to build the object.
|
||||
// No race condition with the normal shape setting since the rebuild is at taint time.
|
||||
yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched;
|
||||
yprim.ForceBodyShapeRebuild(false /* inTaintTime */);
|
||||
assetFound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!assetFound)
|
||||
{
|
||||
xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
|
||||
physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
|
||||
LogHeader, physicsScene.Name);
|
||||
yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
|
||||
}
|
||||
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAssetCallback,found={1},isSculpt={2},ids={3}",
|
||||
yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs );
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
|
||||
physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
|
||||
LogHeader, physicsScene.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -395,9 +390,7 @@ public class BSShapeMesh : BSShape
|
|||
|
||||
// Check to see if mesh was created (might require an asset).
|
||||
newShape = VerifyMeshCreated(physicsScene, newShape, prim);
|
||||
if (!newShape.isNativeShape
|
||||
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
|
||||
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
|
||||
if (!newShape.isNativeShape || prim.AssetFailed() )
|
||||
{
|
||||
// If a mesh was what was created, remember the built shape for later sharing.
|
||||
// Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh.
|
||||
|
@ -584,9 +577,7 @@ public class BSShapeHull : BSShape
|
|||
|
||||
// Check to see if hull was created (might require an asset).
|
||||
newShape = VerifyMeshCreated(physicsScene, newShape, prim);
|
||||
if (!newShape.isNativeShape
|
||||
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
|
||||
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
|
||||
if (!newShape.isNativeShape || prim.AssetFailed())
|
||||
{
|
||||
// If a mesh was what was created, remember the built shape for later sharing.
|
||||
Hulls.Add(newHullKey, retHull);
|
||||
|
@ -994,6 +985,11 @@ public class BSShapeCompound : BSShape
|
|||
BSShapeNative nativeShape = new BSShapeNative(pShape);
|
||||
nativeShape.Dereference(physicsScene);
|
||||
}
|
||||
else
|
||||
{
|
||||
physicsScene.Logger.WarnFormat("{0} DereferenceAnonCollisionShape. Did not find shape. {1}",
|
||||
LogHeader, pShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1137,9 +1133,7 @@ public class BSShapeGImpact : BSShape
|
|||
// Check to see if mesh was created (might require an asset).
|
||||
newShape = VerifyMeshCreated(physicsScene, newShape, prim);
|
||||
newShape.shapeKey = newMeshKey;
|
||||
if (!newShape.isNativeShape
|
||||
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
|
||||
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
|
||||
if (!newShape.isNativeShape || prim.AssetFailed())
|
||||
{
|
||||
// If a mesh was what was created, remember the built shape for later sharing.
|
||||
// Also note that if meshing failed we put it in the mesh list as there is nothing
|
||||
|
|
|
@ -890,42 +890,30 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
// vec, _target_velocity, movementdivisor, vel);
|
||||
}
|
||||
|
||||
if (m_iscolliding && !flying && _target_velocity.Z > 0.0f)
|
||||
{
|
||||
// We're colliding with something and we're not flying but we're moving
|
||||
// This means we're walking or running.
|
||||
d.Vector3 pos = d.BodyGetPosition(Body);
|
||||
vec.Z = (_target_velocity.Z - vel.Z)*PID_D + (_zeroPosition.Z - pos.Z)*PID_P;
|
||||
if (_target_velocity.X > 0)
|
||||
{
|
||||
vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
|
||||
}
|
||||
if (_target_velocity.Y > 0)
|
||||
{
|
||||
vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
|
||||
}
|
||||
}
|
||||
else if (!m_iscolliding && !flying)
|
||||
{
|
||||
// we're not colliding and we're not flying so that means we're falling!
|
||||
// m_iscolliding includes collisions with the ground.
|
||||
|
||||
// d.Vector3 pos = d.BodyGetPosition(Body);
|
||||
if (_target_velocity.X > 0)
|
||||
{
|
||||
vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
|
||||
}
|
||||
if (_target_velocity.Y > 0)
|
||||
{
|
||||
vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
|
||||
}
|
||||
}
|
||||
|
||||
if (flying)
|
||||
{
|
||||
// This also acts as anti-gravity so that we hover when flying rather than fall.
|
||||
vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_iscolliding && _target_velocity.Z > 0.0f)
|
||||
{
|
||||
// We're colliding with something and we're not flying but we're moving
|
||||
// This means we're walking or running.
|
||||
d.Vector3 pos = d.BodyGetPosition(Body);
|
||||
vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P;
|
||||
vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
|
||||
vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
|
||||
}
|
||||
else if (!m_iscolliding)
|
||||
{
|
||||
// we're not colliding and we're not flying so that means we're falling!
|
||||
// m_iscolliding includes collisions with the ground.
|
||||
vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
|
||||
vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flying)
|
||||
|
|
|
@ -120,6 +120,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
protected IUrlModule m_UrlModule = null;
|
||||
protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>();
|
||||
protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
|
||||
protected string m_internalObjectHost = "lsl.opensim.local";
|
||||
protected bool m_restrictEmail = false;
|
||||
protected ISoundModule m_SoundModule = null;
|
||||
|
||||
//An array of HTTP/1.1 headers that are not allowed to be used
|
||||
|
@ -193,11 +195,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
if (seConfigSource != null)
|
||||
{
|
||||
IConfig lslConfig = seConfigSource.Configs["LL-Functions"];
|
||||
if (lslConfig != null)
|
||||
{
|
||||
m_restrictEmail = lslConfig.GetBoolean("RestrictEmail", m_restrictEmail);
|
||||
}
|
||||
|
||||
IConfig smtpConfig = seConfigSource.Configs["SMTP"];
|
||||
if (smtpConfig != null)
|
||||
{
|
||||
// there's an smtp config, so load in the snooze time.
|
||||
EMAIL_PAUSE_TIME = smtpConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
|
||||
|
||||
m_internalObjectHost = smtpConfig.GetString("internal_object_host", m_internalObjectHost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -544,10 +554,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public LSL_Float llFrand(double mag)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
lock (Util.RandomClass)
|
||||
{
|
||||
return Util.RandomClass.NextDouble() * mag;
|
||||
}
|
||||
|
||||
return Util.RandomClass.NextDouble() * mag;
|
||||
}
|
||||
|
||||
public LSL_Integer llFloor(double f)
|
||||
|
@ -3389,6 +3397,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return;
|
||||
}
|
||||
|
||||
//Restrict email destination to the avatars registered email address?
|
||||
//The restriction only applies if the destination address is not local.
|
||||
if (m_restrictEmail == true && address.Contains(m_internalObjectHost) == false)
|
||||
{
|
||||
UserAccount account =
|
||||
World.UserAccountService.GetUserAccount(
|
||||
World.RegionInfo.ScopeID,
|
||||
m_host.OwnerID);
|
||||
|
||||
if (account == null)
|
||||
{
|
||||
Error("llEmail", "Can't find user account for '" + m_host.OwnerID.ToString() + "'");
|
||||
return;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(account.Email))
|
||||
{
|
||||
Error("llEmail", "User account has not registered an email address.");
|
||||
return;
|
||||
}
|
||||
|
||||
address = account.Email;
|
||||
}
|
||||
|
||||
emailModule.SendEmail(m_host.UUID, address, subject, message);
|
||||
ScriptSleep(EMAIL_PAUSE_TIME * 1000);
|
||||
}
|
||||
|
@ -4106,6 +4138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (item == null)
|
||||
{
|
||||
Error("llGiveInventory", "Can't find inventory object '" + inventory + "'");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID objId = item.ItemID;
|
||||
|
|
|
@ -410,6 +410,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
public const int PRIM_POS_LOCAL = 33;
|
||||
public const int PRIM_LINK_TARGET = 34;
|
||||
public const int PRIM_SLICE = 35;
|
||||
public const int PRIM_SPECULAR = 36;
|
||||
public const int PRIM_NORMAL = 37;
|
||||
public const int PRIM_ALPHA_MODE = 38;
|
||||
public const int PRIM_TEXGEN_DEFAULT = 0;
|
||||
public const int PRIM_TEXGEN_PLANAR = 1;
|
||||
|
||||
|
|
|
@ -626,11 +626,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
|||
string labelStatement;
|
||||
|
||||
if (m_insertCoopTerminationChecks)
|
||||
labelStatement = m_coopTerminationCheck + "\n";
|
||||
labelStatement = m_coopTerminationCheck;
|
||||
else
|
||||
labelStatement = "NoOp();\n";
|
||||
labelStatement = "NoOp();";
|
||||
|
||||
return Generate(String.Format("{0}: ", CheckName(jl.LabelName)), jl) + labelStatement;
|
||||
return GenerateLine(String.Format("{0}: {1}", CheckName(jl.LabelName), labelStatement), jl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
|||
if (in_startup)
|
||||
{
|
||||
in_startup = false;
|
||||
CreateScriptsDirectory();
|
||||
CheckOrCreateScriptsDirectory();
|
||||
|
||||
// First time we start? Delete old files
|
||||
if (DeleteScriptsOnStartup)
|
||||
|
@ -189,13 +189,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
|||
}
|
||||
|
||||
// We now have an allow-list, a mapping list, and a default language
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the directory where compiled scripts are stored.
|
||||
/// Create the directory where compiled scripts are stored if it does not already exist.
|
||||
/// </summary>
|
||||
private void CreateScriptsDirectory()
|
||||
private void CheckOrCreateScriptsDirectory()
|
||||
{
|
||||
if (!Directory.Exists(ScriptEnginesPath))
|
||||
{
|
||||
|
@ -302,28 +301,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
|||
|
||||
assembly = GetCompilerOutput(asset);
|
||||
|
||||
if (!Directory.Exists(ScriptEnginesPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(ScriptEnginesPath);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (!Directory.Exists(Path.Combine(ScriptEnginesPath,
|
||||
m_scriptEngine.World.RegionInfo.RegionID.ToString())))
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(ScriptEnginesPath);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
CheckOrCreateScriptsDirectory();
|
||||
|
||||
// Don't recompile if we already have it
|
||||
// Performing 3 file exists tests for every script can still be slow
|
||||
|
@ -724,12 +702,13 @@ namespace SecondLife
|
|||
return assembly;
|
||||
}
|
||||
|
||||
private class kvpSorter : IComparer<KeyValuePair<int, int>>
|
||||
private class kvpSorter : IComparer<KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>>>
|
||||
{
|
||||
public int Compare(KeyValuePair<int, int> a,
|
||||
KeyValuePair<int, int> b)
|
||||
public int Compare(KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> a,
|
||||
KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> b)
|
||||
{
|
||||
return a.Key.CompareTo(b.Key);
|
||||
int kc = a.Key.Key.CompareTo(b.Key.Key);
|
||||
return (kc != 0) ? kc : a.Key.Value.CompareTo(b.Key.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -746,30 +725,46 @@ namespace SecondLife
|
|||
out ret))
|
||||
return ret;
|
||||
|
||||
List<KeyValuePair<int, int>> sorted =
|
||||
new List<KeyValuePair<int, int>>(positionMap.Keys);
|
||||
var sorted = new List<KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>>>(positionMap);
|
||||
|
||||
sorted.Sort(new kvpSorter());
|
||||
|
||||
int l = 1;
|
||||
int c = 1;
|
||||
int pl = 1;
|
||||
|
||||
foreach (KeyValuePair<int, int> cspos in sorted)
|
||||
foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> posmap in sorted)
|
||||
{
|
||||
if (cspos.Key >= line)
|
||||
//m_log.DebugFormat("[Compiler]: Scanning line map {0},{1} --> {2},{3}", posmap.Key.Key, posmap.Key.Value, posmap.Value.Key, posmap.Value.Value);
|
||||
int nl = posmap.Value.Key + line - posmap.Key.Key; // New, translated LSL line and column.
|
||||
int nc = posmap.Value.Value + col - posmap.Key.Value;
|
||||
// Keep going until we find the first point passed line,col.
|
||||
if (posmap.Key.Key > line)
|
||||
{
|
||||
if (cspos.Key > line)
|
||||
return new KeyValuePair<int, int>(l, c);
|
||||
if (cspos.Value > col)
|
||||
return new KeyValuePair<int, int>(l, c);
|
||||
c = cspos.Value;
|
||||
if (c == 0)
|
||||
c++;
|
||||
//m_log.DebugFormat("[Compiler]: Line is larger than requested {0},{1}, returning {2},{3}", line, col, l, c);
|
||||
if (pl < line)
|
||||
{
|
||||
//m_log.DebugFormat("[Compiler]: Previous line ({0}) is less than requested line ({1}), setting column to 1.", pl, line);
|
||||
c = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
if (posmap.Key.Key == line && posmap.Key.Value > col)
|
||||
{
|
||||
l = cspos.Key;
|
||||
// Never move l,c backwards.
|
||||
if (nl > l || (nl == l && nc > c))
|
||||
{
|
||||
//m_log.DebugFormat("[Compiler]: Using offset relative to this: {0} + {1} - {2}, {3} + {4} - {5} = {6}, {7}",
|
||||
// posmap.Value.Key, line, posmap.Key.Key, posmap.Value.Value, col, posmap.Key.Value, nl, nc);
|
||||
l = nl;
|
||||
c = nc;
|
||||
}
|
||||
//m_log.DebugFormat("[Compiler]: Column is larger than requested {0},{1}, returning {2},{3}", line, col, l, c);
|
||||
break;
|
||||
}
|
||||
pl = posmap.Key.Key;
|
||||
l = posmap.Value.Key;
|
||||
c = posmap.Value.Value;
|
||||
}
|
||||
return new KeyValuePair<int, int>(l, c);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
// Create the temporary directory for housing build artifacts.
|
||||
Directory.CreateDirectory(m_testDir);
|
||||
}
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
// Create a CSCodeProvider and CompilerParameters.
|
||||
m_CSCodeProvider = new CSharpCodeProvider();
|
||||
m_compilerParameters = new CompilerParameters();
|
||||
|
@ -85,7 +89,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
/// Removes the temporary build directory and any build artifacts
|
||||
/// inside it.
|
||||
/// </summary>
|
||||
[TestFixtureTearDown]
|
||||
[TearDown]
|
||||
public void CleanUp()
|
||||
{
|
||||
System.AppDomain.CurrentDomain.AssemblyResolve -= m_resolveEventHandler;
|
||||
|
@ -97,6 +101,62 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
}
|
||||
}
|
||||
|
||||
private CompilerResults CompileScript(
|
||||
string input, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap)
|
||||
{
|
||||
m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
|
||||
|
||||
CSCodeGenerator cg = new CSCodeGenerator();
|
||||
string output = cg.Convert(input);
|
||||
|
||||
output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
|
||||
// System.Console.WriteLine(output);
|
||||
|
||||
positionMap = cg.PositionMap;
|
||||
|
||||
CompilerResults compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
|
||||
|
||||
// foreach (KeyValuePair<int, int> key in positionMap.Keys)
|
||||
// {
|
||||
// KeyValuePair<int, int> val = positionMap[key];
|
||||
//
|
||||
// System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value);
|
||||
// }
|
||||
//
|
||||
// foreach (CompilerError compErr in m_compilerResults.Errors)
|
||||
// {
|
||||
// System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr);
|
||||
// }
|
||||
|
||||
return compilerResults;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that line number errors are resolved as expected when preceding code contains a jump.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestJumpAndSyntaxError()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap;
|
||||
|
||||
CompilerResults compilerResults = CompileScript(
|
||||
@"default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
jump l;
|
||||
@l;
|
||||
i = 1;
|
||||
}
|
||||
}", out positionMap);
|
||||
|
||||
Assert.AreEqual(
|
||||
new KeyValuePair<int, int>(7, 9),
|
||||
positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test the C# compiler error message can be mapped to the correct
|
||||
/// line/column in the LSL source when an undeclared variable is used.
|
||||
|
@ -106,41 +166,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
|
||||
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap;
|
||||
|
||||
string input = @"default
|
||||
CompilerResults compilerResults = CompileScript(
|
||||
@"default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
integer y = x + 3;
|
||||
}
|
||||
}";
|
||||
|
||||
CSCodeGenerator cg = new CSCodeGenerator();
|
||||
string output = cg.Convert(input);
|
||||
|
||||
output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
|
||||
// System.Console.WriteLine(output);
|
||||
|
||||
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap;
|
||||
|
||||
m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
|
||||
//
|
||||
// foreach (KeyValuePair<int, int> key in positionMap.Keys)
|
||||
// {
|
||||
// KeyValuePair<int, int> val = positionMap[key];
|
||||
//
|
||||
// System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value);
|
||||
// }
|
||||
//
|
||||
// foreach (CompilerError compErr in m_compilerResults.Errors)
|
||||
// {
|
||||
// System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr);
|
||||
// }
|
||||
}", out positionMap);
|
||||
|
||||
Assert.AreEqual(
|
||||
new KeyValuePair<int, int>(5, 21),
|
||||
positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]);
|
||||
positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -152,9 +191,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
|
||||
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap;
|
||||
|
||||
string input = @"string s = "" a string"";
|
||||
CompilerResults compilerResults = CompileScript(
|
||||
@"string s = "" a string"";
|
||||
|
||||
default
|
||||
{
|
||||
|
@ -164,24 +204,9 @@ default
|
|||
string tmp = (string) gAvatarKey + s;
|
||||
llSay(0, tmp);
|
||||
}
|
||||
}";
|
||||
}", out positionMap);
|
||||
|
||||
// System.Console.WriteLine(input);
|
||||
CSCodeGenerator cg = new CSCodeGenerator();
|
||||
string output = cg.Convert(input);
|
||||
|
||||
output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
|
||||
// System.Console.WriteLine(output);
|
||||
|
||||
m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
|
||||
|
||||
System.Console.WriteLine("ERRORS: {0}", m_compilerResults.Errors.Count);
|
||||
foreach (CompilerError compErr in m_compilerResults.Errors)
|
||||
{
|
||||
System.Console.WriteLine("Error: {0}", compErr);
|
||||
}
|
||||
|
||||
Assert.AreEqual(0, m_compilerResults.Errors.Count);
|
||||
Assert.AreEqual(0, compilerResults.Errors.Count);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,6 +45,7 @@ using OpenSim.Region.ScriptEngine.Shared.Instance;
|
|||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
using PermissionMask = OpenSim.Framework.PermissionMask;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
{
|
||||
|
@ -167,5 +168,123 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test giving inventory from an object to an avatar that is not the object's owner.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLlGiveInventoryO2DifferentAvatar()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID user1Id = TestHelpers.ParseTail(0x1);
|
||||
UUID user2Id = TestHelpers.ParseTail(0x2);
|
||||
string inventoryItemName = "item1";
|
||||
|
||||
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
|
||||
m_scene.AddSceneObject(so1);
|
||||
LSL_Api api = new LSL_Api();
|
||||
api.Initialize(m_engine, so1.RootPart, null, null);
|
||||
|
||||
// Create an object embedded inside the first
|
||||
UUID itemId = TestHelpers.ParseTail(0x20);
|
||||
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
|
||||
|
||||
api.llGiveInventory(user2Id.ToString(), inventoryItemName);
|
||||
|
||||
InventoryItemBase receivedItem
|
||||
= UserInventoryHelpers.GetInventoryItem(
|
||||
m_scene.InventoryService, user2Id, string.Format("Objects/{0}", inventoryItemName));
|
||||
|
||||
Assert.IsNotNull(receivedItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test giving inventory from an object to an avatar that is not the object's owner and where the next
|
||||
/// permissions do not include mod.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLlGiveInventoryO2DifferentAvatarNoMod()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID user1Id = TestHelpers.ParseTail(0x1);
|
||||
UUID user2Id = TestHelpers.ParseTail(0x2);
|
||||
string inventoryItemName = "item1";
|
||||
|
||||
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
|
||||
m_scene.AddSceneObject(so1);
|
||||
LSL_Api api = new LSL_Api();
|
||||
api.Initialize(m_engine, so1.RootPart, null, null);
|
||||
|
||||
// Create an object embedded inside the first
|
||||
UUID itemId = TestHelpers.ParseTail(0x20);
|
||||
TaskInventoryItem tii
|
||||
= TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
|
||||
tii.NextPermissions &= ~((uint)PermissionMask.Modify);
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
|
||||
|
||||
api.llGiveInventory(user2Id.ToString(), inventoryItemName);
|
||||
|
||||
InventoryItemBase receivedItem
|
||||
= UserInventoryHelpers.GetInventoryItem(
|
||||
m_scene.InventoryService, user2Id, string.Format("Objects/{0}", inventoryItemName));
|
||||
|
||||
Assert.IsNotNull(receivedItem);
|
||||
Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLlRemoteLoadScriptPin()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID user1Id = TestHelpers.ParseTail(0x1);
|
||||
UUID user2Id = TestHelpers.ParseTail(0x2);
|
||||
|
||||
SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, 1, user1Id, "sourceSo", 0x10);
|
||||
m_scene.AddSceneObject(sourceSo);
|
||||
LSL_Api api = new LSL_Api();
|
||||
api.Initialize(m_engine, sourceSo.RootPart, null, null);
|
||||
TaskInventoryHelpers.AddScript(m_scene, sourceSo.RootPart, "script", "Hello World");
|
||||
|
||||
SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, 1, user1Id, "targetSo", 0x20);
|
||||
SceneObjectGroup otherOwnedTargetSo
|
||||
= SceneHelpers.AddSceneObject(m_scene, 1, user2Id, "otherOwnedTargetSo", 0x30);
|
||||
|
||||
// Test that we cannot load a script when the target pin has never been set (i.e. it is zero)
|
||||
api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 0, 0, 0);
|
||||
Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
|
||||
|
||||
// Test that we cannot load a script when the given pin does not match the target
|
||||
targetSo.RootPart.ScriptAccessPin = 5;
|
||||
api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
|
||||
Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
|
||||
|
||||
// Test that we cannot load into a prim with a different owner
|
||||
otherOwnedTargetSo.RootPart.ScriptAccessPin = 3;
|
||||
api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
|
||||
Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
|
||||
|
||||
// Test that we can load a script when given pin and dest pin match.
|
||||
targetSo.RootPart.ScriptAccessPin = 3;
|
||||
api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
|
||||
TaskInventoryItem insertedItem = targetSo.RootPart.Inventory.GetInventoryItem("script");
|
||||
Assert.IsNotNull(insertedItem);
|
||||
|
||||
// Test that we can no longer load if access pin is unset
|
||||
targetSo.RootPart.Inventory.RemoveInventoryItem(insertedItem.ItemID);
|
||||
Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
|
||||
|
||||
targetSo.RootPart.ScriptAccessPin = 0;
|
||||
api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
|
||||
Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -389,7 +389,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "debug scripts log", "debug scripts log <item-id> <log-level>", "Extra debug logging for a script",
|
||||
"Debug", false, "debug scripts log", "debug scripts log <item-id> <log-level>", "Extra debug logging for a particular script.",
|
||||
"Activates or deactivates extra debug logging for the given script.\n"
|
||||
+ "Level == 0, deactivate extra debug logging.\n"
|
||||
+ "Level >= 1, log state changes.\n"
|
||||
|
|
|
@ -196,17 +196,19 @@ namespace OpenSim.Server.Base
|
|||
|
||||
public static byte[] SerializeResult(XmlSerializer xs, object data)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8);
|
||||
xw.Formatting = Formatting.Indented;
|
||||
xs.Serialize(xw, data);
|
||||
xw.Flush();
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
using (XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8))
|
||||
{
|
||||
xw.Formatting = Formatting.Indented;
|
||||
xs.Serialize(xw, data);
|
||||
xw.Flush();
|
||||
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
byte[] ret = ms.GetBuffer();
|
||||
Array.Resize(ref ret, (int)ms.Length);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
byte[] ret = ms.GetBuffer();
|
||||
Array.Resize(ref ret, (int)ms.Length);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -209,7 +209,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
|
||||
rootElement.AppendChild(result);
|
||||
|
||||
return DocToBytes(doc);
|
||||
return Util.DocToBytes(doc);
|
||||
}
|
||||
|
||||
byte[] GetAuthInfo(UUID principalID)
|
||||
|
@ -279,7 +279,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
|
||||
rootElement.AppendChild(result);
|
||||
|
||||
return DocToBytes(doc);
|
||||
return Util.DocToBytes(doc);
|
||||
}
|
||||
|
||||
private byte[] SuccessResult(string token)
|
||||
|
@ -306,18 +306,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
|
||||
rootElement.AppendChild(t);
|
||||
|
||||
return DocToBytes(doc);
|
||||
}
|
||||
|
||||
private byte[] DocToBytes(XmlDocument doc)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
||||
xw.Formatting = Formatting.Indented;
|
||||
doc.WriteTo(xw);
|
||||
xw.Flush();
|
||||
|
||||
return ms.GetBuffer();
|
||||
return Util.DocToBytes(doc);
|
||||
}
|
||||
|
||||
private byte[] ResultToBytes(Dictionary<string, object> result)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue