Merge branch 'master' into 0.7.1-dev
commit
149d4e48d8
|
@ -94,7 +94,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
public void Initialise()
|
||||
{
|
||||
m_log.Info("[RADMIN]: " + Name + " cannot be default-initialized!");
|
||||
m_log.Error("[RADMIN]: " + Name + " cannot be default-initialized!");
|
||||
throw new PluginNotInitialisedException(Name);
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
else
|
||||
{
|
||||
m_config = m_configSource.Configs["RemoteAdmin"];
|
||||
m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
|
||||
m_log.Debug("[RADMIN]: Remote Admin Plugin Enabled");
|
||||
m_requiredPassword = m_config.GetString("access_password", String.Empty);
|
||||
int port = m_config.GetInt("port", 0);
|
||||
|
||||
|
@ -130,6 +130,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
availableMethods["admin_broadcast"] = XmlRpcAlertMethod;
|
||||
availableMethods["admin_restart"] = XmlRpcRestartMethod;
|
||||
availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod;
|
||||
availableMethods["admin_save_heightmap"] = XmlRpcSaveHeightmapMethod;
|
||||
// User management
|
||||
availableMethods["admin_create_user"] = XmlRpcCreateUserMethod;
|
||||
availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod;
|
||||
|
@ -230,8 +231,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN]: Restart region: failed: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0} {1}", e.Message, e.StackTrace);
|
||||
responseData["accepted"] = false;
|
||||
responseData["success"] = false;
|
||||
responseData["rebooting"] = false;
|
||||
|
@ -277,8 +277,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["accepted"] = false;
|
||||
responseData["success"] = false;
|
||||
|
@ -301,7 +300,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
Hashtable requestData = (Hashtable) request.Params[0];
|
||||
|
||||
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString());
|
||||
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request);
|
||||
// foreach (string k in requestData.Keys)
|
||||
// {
|
||||
// m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}",
|
||||
|
@ -348,8 +347,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN]: Terrain Loading: failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN]: Terrain Loading: failed: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN]: Terrain Loading: failed: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -360,6 +358,61 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
return response;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcSaveHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
m_log.Info("[RADMIN]: Save height maps request started");
|
||||
|
||||
try
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString());
|
||||
|
||||
CheckStringParameters(request, new string[] { "password", "filename", "regionid" });
|
||||
|
||||
if (m_requiredPassword != String.Empty &&
|
||||
(!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword))
|
||||
throw new Exception("wrong password");
|
||||
|
||||
string file = (string)requestData["filename"];
|
||||
UUID regionID = (UUID)(string)requestData["regionid"];
|
||||
m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file);
|
||||
|
||||
responseData["accepted"] = true;
|
||||
|
||||
Scene region = null;
|
||||
|
||||
if (!m_application.SceneManager.TryGetScene(regionID, out region))
|
||||
throw new Exception("1: unable to get a scene with that name");
|
||||
|
||||
ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
|
||||
if (null == terrainModule) throw new Exception("terrain module not available");
|
||||
|
||||
terrainModule.SaveToFile(file);
|
||||
|
||||
responseData["success"] = false;
|
||||
|
||||
response.Value = responseData;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN]: Terrain Saving: failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN]: Terrain Saving: failed: {0}", e.ToString());
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
||||
}
|
||||
|
||||
m_log.Info("[RADMIN]: Save height maps request complete");
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
m_log.Info("[RADMIN]: Received Shutdown Administrator Request");
|
||||
|
@ -417,14 +470,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN]: Shutdown: failed: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["accepted"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
||||
response.Value = responseData;
|
||||
}
|
||||
|
||||
m_log.Info("[RADMIN]: Shutdown Administrator Request complete");
|
||||
return response;
|
||||
}
|
||||
|
@ -725,8 +778,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN] CreateRegion: failed {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] CreateRegion: failed {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN] CreateRegion: failed {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -792,8 +844,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN] DeleteRegion: failed {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] DeleteRegion: failed {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN] DeleteRegion: failed {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -884,8 +935,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN] CloseRegion: failed {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] CloseRegion: failed {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN]: CloseRegion: failed {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -982,8 +1032,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN] ModifyRegion: failed {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] ModifyRegion: failed {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN] ModifyRegion: failed {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -1106,8 +1155,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN]: CreateUser: failed: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["avatar_uuid"] = UUID.Zero.ToString();
|
||||
|
@ -1198,8 +1246,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN] UserExists: failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] UserExists: failed: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN]: UserExists: failed: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -1372,9 +1419,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["avatar_uuid"] = UUID.Zero.ToString();
|
||||
|
@ -1382,6 +1427,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
response.Value = responseData;
|
||||
}
|
||||
|
||||
m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
|
||||
return response;
|
||||
}
|
||||
|
@ -1397,7 +1443,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
private void UpdateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid)
|
||||
{
|
||||
m_log.DebugFormat("[RADMIN] updateUserAppearance");
|
||||
m_log.DebugFormat("[RADMIN]: updateUserAppearance");
|
||||
|
||||
string defaultMale = m_config.GetString("default_male", "Default Male");
|
||||
string defaultFemale = m_config.GetString("default_female", "Default Female");
|
||||
|
@ -1437,16 +1483,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
if (String.IsNullOrEmpty(model))
|
||||
{
|
||||
m_log.DebugFormat("[RADMIN] Appearance update not requested");
|
||||
m_log.DebugFormat("[RADMIN]: Appearance update not requested");
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model <{1}>", userid, model);
|
||||
m_log.DebugFormat("[RADMIN]: Setting appearance for avatar {0}, using model <{1}>", userid, model);
|
||||
|
||||
string[] modelSpecifiers = model.Split();
|
||||
if (modelSpecifiers.Length != 2)
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model);
|
||||
m_log.WarnFormat("[RADMIN]: User appearance not set for {0}. Invalid model name : <{1}>", userid, model);
|
||||
// modelSpecifiers = dmodel.Split();
|
||||
return;
|
||||
}
|
||||
|
@ -1457,7 +1503,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
if (modelProfile == null)
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model);
|
||||
m_log.WarnFormat("[RADMIN]: Requested model ({0}) not found. Appearance unchanged", model);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1467,7 +1513,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
EstablishAppearance(userid, modelProfile.PrincipalID);
|
||||
|
||||
m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}",
|
||||
m_log.DebugFormat("[RADMIN]: Finished setting appearance for avatar {0}, using model {1}",
|
||||
userid, model);
|
||||
}
|
||||
|
||||
|
@ -1479,7 +1525,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
private void EstablishAppearance(UUID destination, UUID source)
|
||||
{
|
||||
m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", destination, source);
|
||||
m_log.DebugFormat("[RADMIN]: Initializing inventory for {0} from {1}", destination, source);
|
||||
Scene scene = m_application.SceneManager.CurrentOrFirstScene;
|
||||
|
||||
// If the model has no associated appearance we're done.
|
||||
|
@ -1501,7 +1547,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}",
|
||||
m_log.WarnFormat("[RADMIN]: Error transferring appearance for {0} : {1}",
|
||||
destination, e.Message);
|
||||
}
|
||||
|
||||
|
@ -1532,7 +1578,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}",
|
||||
m_log.WarnFormat("[RADMIN]: Error transferring appearance for {0} : {1}",
|
||||
destination, e.Message);
|
||||
}
|
||||
|
||||
|
@ -1567,7 +1613,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID;
|
||||
destinationFolder.Version = 1;
|
||||
inventoryService.AddFolder(destinationFolder); // store base record
|
||||
m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source);
|
||||
m_log.ErrorFormat("[RADMIN]: Created folder for destination {0}", source);
|
||||
}
|
||||
|
||||
// Wearables
|
||||
|
@ -1587,6 +1633,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
|
||||
destinationItem.Name = item.Name;
|
||||
destinationItem.Owner = destination;
|
||||
destinationItem.Description = item.Description;
|
||||
destinationItem.InvType = item.InvType;
|
||||
destinationItem.CreatorId = item.CreatorId;
|
||||
|
@ -1606,6 +1653,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
destinationItem.Flags = item.Flags;
|
||||
destinationItem.CreationDate = item.CreationDate;
|
||||
destinationItem.Folder = destinationFolder.ID;
|
||||
ApplyNextOwnerPermissions(destinationItem);
|
||||
|
||||
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
|
||||
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
|
||||
|
@ -1640,6 +1688,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
|
||||
destinationItem.Name = item.Name;
|
||||
destinationItem.Owner = destination;
|
||||
destinationItem.Description = item.Description;
|
||||
destinationItem.InvType = item.InvType;
|
||||
destinationItem.CreatorId = item.CreatorId;
|
||||
|
@ -1659,6 +1708,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
destinationItem.Flags = item.Flags;
|
||||
destinationItem.CreationDate = item.CreationDate;
|
||||
destinationItem.Folder = destinationFolder.ID;
|
||||
ApplyNextOwnerPermissions(destinationItem);
|
||||
|
||||
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
|
||||
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
|
||||
|
@ -1716,13 +1766,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
destinationFolder = new InventoryFolderBase();
|
||||
destinationFolder.ID = UUID.Random();
|
||||
destinationFolder.Name = assetType.ToString();
|
||||
if (assetType == AssetType.Clothing) {
|
||||
destinationFolder.Name = "Clothing";
|
||||
} else {
|
||||
destinationFolder.Name = "Body Parts";
|
||||
}
|
||||
destinationFolder.Owner = destination;
|
||||
destinationFolder.Type = (short)assetType;
|
||||
destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID;
|
||||
destinationFolder.Version = 1;
|
||||
inventoryService.AddFolder(destinationFolder); // store base record
|
||||
m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source);
|
||||
m_log.ErrorFormat("[RADMIN]: Created folder for destination {0}", source);
|
||||
}
|
||||
|
||||
InventoryFolderBase extraFolder;
|
||||
|
@ -1740,7 +1794,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
extraFolder.ParentID = destinationFolder.ID;
|
||||
inventoryService.AddFolder(extraFolder);
|
||||
|
||||
m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID);
|
||||
m_log.DebugFormat("[RADMIN]: Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID);
|
||||
|
||||
List<InventoryItemBase> items = inventoryService.GetFolderContent(source, folder.ID).Items;
|
||||
|
||||
|
@ -1748,6 +1802,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
|
||||
destinationItem.Name = item.Name;
|
||||
destinationItem.Owner = destination;
|
||||
destinationItem.Description = item.Description;
|
||||
destinationItem.InvType = item.InvType;
|
||||
destinationItem.CreatorId = item.CreatorId;
|
||||
|
@ -1767,6 +1822,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
destinationItem.Flags = item.Flags;
|
||||
destinationItem.CreationDate = item.CreationDate;
|
||||
destinationItem.Folder = extraFolder.ID;
|
||||
ApplyNextOwnerPermissions(destinationItem);
|
||||
|
||||
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
|
||||
inventoryMap.Add(item.ID, destinationItem.ID);
|
||||
|
@ -1783,6 +1839,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply next owner permissions.
|
||||
/// </summary>
|
||||
|
||||
private void ApplyNextOwnerPermissions(InventoryItemBase item)
|
||||
{
|
||||
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
||||
{
|
||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
||||
item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
|
||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
||||
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
|
||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
|
||||
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
|
||||
}
|
||||
item.CurrentPermissions &= item.NextPermissions;
|
||||
item.BasePermissions &= item.NextPermissions;
|
||||
item.EveryOnePermissions &= item.NextPermissions;
|
||||
// item.OwnerChanged = true;
|
||||
// item.PermsMask = 0;
|
||||
// item.PermsGranter = UUID.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called if a given model avatar name can not be found. If the external
|
||||
/// file has already been loaded once, then control returns immediately. If not, then it
|
||||
|
@ -1792,7 +1871,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
/// indicate which outfit is the default, and this outfit will be automatically worn. The
|
||||
/// other outfits are provided to allow "real" avatars a way to easily change their outfits.
|
||||
/// </summary>
|
||||
|
||||
private bool CreateDefaultAvatars()
|
||||
{
|
||||
// Only load once
|
||||
|
@ -1801,7 +1879,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
return false;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[RADMIN] Creating default avatar entries");
|
||||
m_log.DebugFormat("[RADMIN]: Creating default avatar entries");
|
||||
|
||||
m_defaultAvatarsLoaded = true;
|
||||
|
||||
|
@ -1857,7 +1935,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
foreach (XmlElement avatar in avatars)
|
||||
{
|
||||
m_log.DebugFormat("[RADMIN] Loading appearance for {0}, gender = {1}",
|
||||
m_log.DebugFormat("[RADMIN]: Loading appearance for {0}, gender = {1}",
|
||||
GetStringAttribute(avatar,"name","?"), GetStringAttribute(avatar,"gender","?"));
|
||||
|
||||
// Create the user identified by the avatar entry
|
||||
|
@ -1879,7 +1957,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
account = CreateUser(scopeID, names[0], names[1], password, email);
|
||||
if (null == account)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", names[0], names[1]);
|
||||
m_log.ErrorFormat("[RADMIN]: Avatar {0} {1} was not created", names[0], names[1]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1897,12 +1975,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
ID = account.PrincipalID;
|
||||
|
||||
m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID);
|
||||
m_log.DebugFormat("[RADMIN]: User {0}[{1}] created or retrieved", name, ID);
|
||||
include = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[RADMIN] Error creating user {0} : {1}", name, e.Message);
|
||||
m_log.DebugFormat("[RADMIN]: Error creating user {0} : {1}", name, e.Message);
|
||||
include = false;
|
||||
}
|
||||
|
||||
|
@ -1942,7 +2020,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
clothingFolder.ParentID = inventoryService.GetRootFolder(ID).ID;
|
||||
clothingFolder.Version = 1;
|
||||
inventoryService.AddFolder(clothingFolder); // store base record
|
||||
m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID);
|
||||
m_log.ErrorFormat("[RADMIN]: Created clothing folder for {0}/{1}", name, ID);
|
||||
}
|
||||
|
||||
// OK, now we have an inventory for the user, read in the outfits from the
|
||||
|
@ -1955,7 +2033,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
foreach (XmlElement outfit in outfits)
|
||||
{
|
||||
m_log.DebugFormat("[RADMIN] Loading outfit {0} for {1}",
|
||||
m_log.DebugFormat("[RADMIN]: Loading outfit {0} for {1}",
|
||||
GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?"));
|
||||
|
||||
outfitName = GetStringAttribute(outfit,"name","");
|
||||
|
@ -1979,7 +2057,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
// Otherwise, we must create the folder.
|
||||
if (extraFolder == null)
|
||||
{
|
||||
m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", outfitName, name);
|
||||
m_log.DebugFormat("[RADMIN]: Creating outfit folder {0} for {1}", outfitName, name);
|
||||
extraFolder = new InventoryFolderBase();
|
||||
extraFolder.ID = UUID.Random();
|
||||
extraFolder.Name = outfitName;
|
||||
|
@ -1988,7 +2066,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
extraFolder.Version = 1;
|
||||
extraFolder.ParentID = clothingFolder.ID;
|
||||
inventoryService.AddFolder(extraFolder);
|
||||
m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", extraFolder.ID, clothingFolder.ID);
|
||||
m_log.DebugFormat("[RADMIN]: Adding outfile folder {0} to folder {1}", extraFolder.ID, clothingFolder.ID);
|
||||
}
|
||||
|
||||
// Now get the pieces that make up the outfit
|
||||
|
@ -2003,7 +2081,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
switch (child.Name)
|
||||
{
|
||||
case "Permissions" :
|
||||
m_log.DebugFormat("[RADMIN] Permissions specified");
|
||||
m_log.DebugFormat("[RADMIN]: Permissions specified");
|
||||
perms = child;
|
||||
break;
|
||||
case "Asset" :
|
||||
|
@ -2053,7 +2131,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
inventoryItem.Folder = extraFolder.ID; // Parent folder
|
||||
|
||||
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem);
|
||||
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID);
|
||||
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID);
|
||||
}
|
||||
|
||||
// Attach item, if attachpoint is specified
|
||||
|
@ -2061,7 +2139,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
if (attachpoint != 0)
|
||||
{
|
||||
avatarAppearance.SetAttachment(attachpoint, inventoryItem.ID, inventoryItem.AssetID);
|
||||
m_log.DebugFormat("[RADMIN] Attached {0}", inventoryItem.ID);
|
||||
m_log.DebugFormat("[RADMIN]: Attached {0}", inventoryItem.ID);
|
||||
}
|
||||
|
||||
// Record whether or not the item is to be initially worn
|
||||
|
@ -2074,32 +2152,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN] Error wearing item {0} : {1}", inventoryItem.ID, e.Message);
|
||||
m_log.WarnFormat("[RADMIN]: Error wearing item {0} : {1}", inventoryItem.ID, e.Message);
|
||||
}
|
||||
} // foreach item in outfit
|
||||
m_log.DebugFormat("[RADMIN] Outfit {0} load completed", outfitName);
|
||||
m_log.DebugFormat("[RADMIN]: Outfit {0} load completed", outfitName);
|
||||
} // foreach outfit
|
||||
m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name);
|
||||
m_log.DebugFormat("[RADMIN]: Inventory update complete for {0}", name);
|
||||
scene.AvatarService.SetAppearance(ID, avatarAppearance);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN] Inventory processing incomplete for user {0} : {1}",
|
||||
m_log.WarnFormat("[RADMIN]: Inventory processing incomplete for user {0} : {1}",
|
||||
name, e.Message);
|
||||
}
|
||||
} // End of include
|
||||
}
|
||||
m_log.DebugFormat("[RADMIN] Default avatar loading complete");
|
||||
m_log.DebugFormat("[RADMIN]: Default avatar loading complete");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[RADMIN] No default avatar information available");
|
||||
m_log.DebugFormat("[RADMIN]: No default avatar information available");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN] Exception whilst loading default avatars ; {0}", e.Message);
|
||||
m_log.WarnFormat("[RADMIN]: Exception whilst loading default avatars ; {0}", e.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2194,8 +2272,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] LoadOAR: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN]: LoadOAR: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["loaded"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -2300,8 +2377,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] SaveOAR: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] SaveOAR: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN]: SaveOAR: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["saved"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -2315,7 +2391,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
private void RemoteAdminOarSaveCompleted(Guid uuid, string name)
|
||||
{
|
||||
m_log.DebugFormat("[RADMIN] File processing complete for {0}", name);
|
||||
m_log.DebugFormat("[RADMIN]: File processing complete for {0}", name);
|
||||
lock (m_saveOarLock) Monitor.Pulse(m_saveOarLock);
|
||||
}
|
||||
|
||||
|
@ -2353,14 +2429,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
|
@ -2391,8 +2467,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN] LoadXml: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["loaded"] = false;
|
||||
responseData["switched"] = false;
|
||||
|
@ -2438,14 +2513,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
|
@ -2477,8 +2552,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] SaveXml: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] SaveXml: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[RADMIN]: SaveXml: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["saved"] = false;
|
||||
responseData["switched"] = false;
|
||||
|
@ -2517,14 +2591,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
|
@ -2536,7 +2610,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] RegionQuery: {0}", e.Message);
|
||||
m_log.InfoFormat("[RADMIN]: RegionQuery: {0}", e.Message);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -2577,7 +2651,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] ConsoleCommand: {0}", e.Message);
|
||||
m_log.InfoFormat("[RADMIN]: ConsoleCommand: {0}", e.Message);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -2614,14 +2688,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
|
@ -2632,7 +2706,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] Access List Clear Request: {0}", e.Message);
|
||||
m_log.ErrorFormat("[RADMIN]: Access List Clear Request: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -2671,14 +2745,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
|
@ -2698,7 +2772,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
if (account != null)
|
||||
{
|
||||
uuids.Add(account.PrincipalID);
|
||||
m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, scene.RegionInfo.RegionName);
|
||||
m_log.DebugFormat("[RADMIN]: adding \"{0}\" to ACL for \"{1}\"", name, scene.RegionInfo.RegionName);
|
||||
}
|
||||
}
|
||||
List<UUID> accessControlList = new List<UUID>(scene.RegionInfo.EstateSettings.EstateAccess);
|
||||
|
@ -2719,7 +2793,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] Access List Add Request: {0}", e.Message);
|
||||
m_log.ErrorFormat("[RADMIN]: Access List Add Request: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -2758,14 +2832,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
|
@ -2806,7 +2880,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] Access List Remove Request: {0}", e.Message);
|
||||
m_log.ErrorFormat("[RADMIN]: Access List Remove Request: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
@ -2845,14 +2919,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
UUID region_uuid = (UUID) (string) requestData["region_uuid"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string) requestData["region_name"];
|
||||
if (!m_application.SceneManager.TrySetCurrentScene(region_name))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
|
||||
m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
|
@ -2874,7 +2948,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] Acces List List: {0}", e.Message);
|
||||
m_log.ErrorFormat("[RADMIN]: Access List List: {0} {1}", e.Message, e.StackTrace);
|
||||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
|
|
@ -66,8 +66,8 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
private readonly IScene m_scene;
|
||||
private readonly string m_firstName;
|
||||
private readonly string m_lastName;
|
||||
private int m_objectsToSynchronize = 0;
|
||||
private int m_objectsSynchronized = -1;
|
||||
// private int m_objectsToSynchronize = 0;
|
||||
// private int m_objectsSynchronized = -1;
|
||||
|
||||
private Vector3 m_startPosition=new Vector3(128f, 128f, 128f);
|
||||
#endregion
|
||||
|
@ -462,8 +462,8 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
|
||||
public void MXPSendSynchronizationBegin(int objectCount)
|
||||
{
|
||||
m_objectsToSynchronize = objectCount;
|
||||
m_objectsSynchronized = 0;
|
||||
// m_objectsToSynchronize = objectCount;
|
||||
// m_objectsSynchronized = 0;
|
||||
SynchronizationBeginEventMessage synchronizationBeginEventMessage = new SynchronizationBeginEventMessage();
|
||||
synchronizationBeginEventMessage.ObjectCount = (uint)objectCount;
|
||||
Session.Send(synchronizationBeginEventMessage);
|
||||
|
@ -1337,12 +1337,12 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
// Need to translate to MXP somehow
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID, uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask, uint NextOwnerMask, int OwnershipCost, byte SaleType, int SalePrice, uint Category, UUID LastOwnerID, string ObjectName, string Description)
|
||||
public void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags)
|
||||
{
|
||||
//throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID, UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID, UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName, string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask, uint BaseMask, byte saleType, int salePrice)
|
||||
public void SendObjectPropertiesReply(ISceneEntity entity)
|
||||
{
|
||||
//throw new System.NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -884,12 +884,12 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
|||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID, uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask, uint NextOwnerMask, int OwnershipCost, byte SaleType, int SalePrice, uint Category, UUID LastOwnerID, string ObjectName, string Description)
|
||||
public void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID, UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID, UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName, string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask, uint BaseMask, byte saleType, int salePrice)
|
||||
public void SendObjectPropertiesReply(ISceneEntity entity)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected Dictionary<string, FieldInfo> m_Fields =
|
||||
new Dictionary<string, FieldInfo>();
|
||||
|
||||
|
@ -217,7 +219,6 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
|
||||
string query = "";
|
||||
List<String> names = new List<String>();
|
||||
List<String> values = new List<String>();
|
||||
|
@ -226,6 +227,16 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
names.Add(fi.Name);
|
||||
values.Add("?" + fi.Name);
|
||||
|
||||
// Temporarily return more information about what field is unexpectedly null for
|
||||
// http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the
|
||||
// InventoryTransferModule or we may be required to substitute a DBNull here.
|
||||
if (fi.GetValue(row) == null)
|
||||
throw new NullReferenceException(
|
||||
string.Format(
|
||||
"[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
|
||||
fi.Name, row));
|
||||
|
||||
cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ namespace OpenSim.Data.Null
|
|||
{
|
||||
public class NullEstateStore : IEstateDataStore
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_connectionString;
|
||||
// private string m_connectionString;
|
||||
|
||||
protected virtual Assembly Assembly
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ namespace OpenSim.Data.Null
|
|||
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
// m_connectionString = connectionString;
|
||||
}
|
||||
|
||||
private string[] FieldList
|
||||
|
|
|
@ -570,16 +570,35 @@ namespace OpenSim.Framework
|
|||
public float dwell;
|
||||
}
|
||||
|
||||
public class EntityUpdate
|
||||
public class IEntityUpdate
|
||||
{
|
||||
public ISceneEntity Entity;
|
||||
public PrimUpdateFlags Flags;
|
||||
public float TimeDilation;
|
||||
public uint Flags;
|
||||
|
||||
public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation)
|
||||
public virtual void Update(IEntityUpdate update)
|
||||
{
|
||||
this.Flags |= update.Flags;
|
||||
}
|
||||
|
||||
public IEntityUpdate(ISceneEntity entity, uint flags)
|
||||
{
|
||||
Entity = entity;
|
||||
Flags = flags;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class EntityUpdate : IEntityUpdate
|
||||
{
|
||||
// public ISceneEntity Entity;
|
||||
// public PrimUpdateFlags Flags;
|
||||
public float TimeDilation;
|
||||
|
||||
public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation)
|
||||
: base(entity,(uint)flags)
|
||||
{
|
||||
//Entity = entity;
|
||||
// Flags = flags;
|
||||
TimeDilation = timedilation;
|
||||
}
|
||||
}
|
||||
|
@ -1211,20 +1230,9 @@ namespace OpenSim.Framework
|
|||
/// <param name="stats"></param>
|
||||
void SendSimStats(SimStats stats);
|
||||
|
||||
void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID,
|
||||
uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask,
|
||||
uint NextOwnerMask, int OwnershipCost, byte SaleType, int SalePrice,
|
||||
uint Category,
|
||||
UUID LastOwnerID, string ObjectName, string Description);
|
||||
void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags);
|
||||
|
||||
void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID,
|
||||
UUID FromTaskUUID,
|
||||
UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID,
|
||||
UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle,
|
||||
string ItemName,
|
||||
string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask,
|
||||
uint EveryoneMask,
|
||||
uint BaseMask, byte saleType, int salePrice);
|
||||
void SendObjectPropertiesReply(ISceneEntity Entity);
|
||||
|
||||
void SendAgentOffline(UUID[] agentIDs);
|
||||
|
||||
|
|
|
@ -1,192 +0,0 @@
|
|||
/*
|
||||
* 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.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public class AsynchronousRestObjectRequester
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Perform an asynchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb">GET or POST</param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a
|
||||
/// network issue while posting the request. You'll want to make
|
||||
/// sure you deal with this as they're not uncommon</exception>
|
||||
//
|
||||
public static void MakeRequest<TRequest, TResponse>(string verb,
|
||||
string requestUrl, TRequest obj, Action<TResponse> action)
|
||||
{
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
|
||||
|
||||
Type type = typeof (TRequest);
|
||||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
WebResponse response = null;
|
||||
TResponse deserial = default(TResponse);
|
||||
XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
|
||||
|
||||
request.Method = verb;
|
||||
|
||||
if (verb == "POST")
|
||||
{
|
||||
request.ContentType = "text/xml";
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
|
||||
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;
|
||||
|
||||
request.BeginGetRequestStream(delegate(IAsyncResult res)
|
||||
{
|
||||
Stream requestStream = request.EndGetRequestStream(res);
|
||||
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
requestStream.Close();
|
||||
|
||||
request.BeginGetResponse(delegate(IAsyncResult ar)
|
||||
{
|
||||
response = request.EndGetResponse(ar);
|
||||
Stream respStream = null;
|
||||
try
|
||||
{
|
||||
respStream = response.GetResponseStream();
|
||||
deserial = (TResponse)deserializer.Deserialize(
|
||||
respStream);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Let's not close this
|
||||
//buffer.Close();
|
||||
respStream.Close();
|
||||
response.Close();
|
||||
}
|
||||
|
||||
action(deserial);
|
||||
|
||||
}, null);
|
||||
}, null);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
request.BeginGetResponse(delegate(IAsyncResult res2)
|
||||
{
|
||||
try
|
||||
{
|
||||
// If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't
|
||||
// documented in MSDN
|
||||
response = request.EndGetResponse(res2);
|
||||
|
||||
Stream respStream = null;
|
||||
try
|
||||
{
|
||||
respStream = response.GetResponseStream();
|
||||
deserial = (TResponse)deserializer.Deserialize(respStream);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
respStream.Close();
|
||||
response.Close();
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Status == WebExceptionStatus.ProtocolError)
|
||||
{
|
||||
if (e.Response is HttpWebResponse)
|
||||
{
|
||||
HttpWebResponse httpResponse = (HttpWebResponse)e.Response;
|
||||
|
||||
if (httpResponse.StatusCode != HttpStatusCode.NotFound)
|
||||
{
|
||||
// We don't appear to be handling any other status codes, so log these feailures to that
|
||||
// people don't spend unnecessary hours hunting phantom bugs.
|
||||
m_log.DebugFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}",
|
||||
verb, requestUrl, httpResponse.StatusCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
action(deserial);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e);
|
||||
}
|
||||
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
/*
|
||||
* 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.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public class SynchronousRestFormsRequester
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"> </param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj)
|
||||
{
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
request.Method = verb;
|
||||
string respstring = String.Empty;
|
||||
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
if ((verb == "POST") || (verb == "PUT"))
|
||||
{
|
||||
request.ContentType = "text/www-form-urlencoded";
|
||||
|
||||
int length = 0;
|
||||
using (StreamWriter writer = new StreamWriter(buffer))
|
||||
{
|
||||
writer.Write(obj);
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
length = (int)obj.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
Stream requestStream = null;
|
||||
try
|
||||
{
|
||||
requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (requestStream != null)
|
||||
requestStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (WebResponse resp = request.GetResponse())
|
||||
{
|
||||
if (resp.ContentLength != 0)
|
||||
{
|
||||
Stream respStream = null;
|
||||
try
|
||||
{
|
||||
respStream = resp.GetResponseStream();
|
||||
using (StreamReader reader = new StreamReader(respStream))
|
||||
{
|
||||
respstring = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (respStream != null)
|
||||
respStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// This is what happens when there is invalid XML
|
||||
m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
|
||||
}
|
||||
}
|
||||
return respstring;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* 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.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public class SynchronousRestObjectPoster
|
||||
{
|
||||
[Obsolete]
|
||||
public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
||||
{
|
||||
return SynchronousRestObjectRequester.MakeRequest<TRequest, TResponse>(verb, requestUrl, obj);
|
||||
}
|
||||
}
|
||||
|
||||
public class SynchronousRestObjectRequester
|
||||
{
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"> </param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
||||
{
|
||||
Type type = typeof (TRequest);
|
||||
TResponse deserial = default(TResponse);
|
||||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
request.Method = verb;
|
||||
|
||||
if ((verb == "POST") || (verb == "PUT"))
|
||||
{
|
||||
request.ContentType = "text/xml";
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
|
||||
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;
|
||||
|
||||
Stream requestStream = null;
|
||||
try
|
||||
{
|
||||
requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return deserial;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (requestStream != null)
|
||||
requestStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (WebResponse resp = request.GetResponse())
|
||||
{
|
||||
if (resp.ContentLength > 0)
|
||||
{
|
||||
Stream respStream = resp.GetResponseStream();
|
||||
XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
|
||||
deserial = (TResponse)deserializer.Deserialize(respStream);
|
||||
respStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// This is what happens when there is invalid XML
|
||||
}
|
||||
return deserial;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,6 +36,9 @@ using System.Net.Security;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using log4net;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
@ -220,7 +223,7 @@ namespace OpenSim.Framework
|
|||
reqnum,url,method,tickdiff,tickdata);
|
||||
}
|
||||
|
||||
m_log.WarnFormat("[WEB UTIL] <{0}> osd request failed: {1}",reqnum,errorMessage);
|
||||
m_log.WarnFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
||||
return ErrorResponseMap(errorMessage);
|
||||
}
|
||||
|
||||
|
@ -625,4 +628,336 @@ namespace OpenSim.Framework
|
|||
|
||||
|
||||
}
|
||||
|
||||
public static class AsynchronousRestObjectRequester
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Perform an asynchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb">GET or POST</param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a
|
||||
/// network issue while posting the request. You'll want to make
|
||||
/// sure you deal with this as they're not uncommon</exception>
|
||||
//
|
||||
public static void MakeRequest<TRequest, TResponse>(string verb,
|
||||
string requestUrl, TRequest obj, Action<TResponse> action)
|
||||
{
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
|
||||
|
||||
Type type = typeof(TRequest);
|
||||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
WebResponse response = null;
|
||||
TResponse deserial = default(TResponse);
|
||||
XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
|
||||
|
||||
request.Method = verb;
|
||||
|
||||
if (verb == "POST")
|
||||
{
|
||||
request.ContentType = "text/xml";
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
|
||||
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;
|
||||
|
||||
request.BeginGetRequestStream(delegate(IAsyncResult res)
|
||||
{
|
||||
Stream requestStream = request.EndGetRequestStream(res);
|
||||
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
requestStream.Close();
|
||||
|
||||
request.BeginGetResponse(delegate(IAsyncResult ar)
|
||||
{
|
||||
response = request.EndGetResponse(ar);
|
||||
Stream respStream = null;
|
||||
try
|
||||
{
|
||||
respStream = response.GetResponseStream();
|
||||
deserial = (TResponse)deserializer.Deserialize(
|
||||
respStream);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Let's not close this
|
||||
//buffer.Close();
|
||||
respStream.Close();
|
||||
response.Close();
|
||||
}
|
||||
|
||||
action(deserial);
|
||||
|
||||
}, null);
|
||||
}, null);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
request.BeginGetResponse(delegate(IAsyncResult res2)
|
||||
{
|
||||
try
|
||||
{
|
||||
// If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't
|
||||
// documented in MSDN
|
||||
response = request.EndGetResponse(res2);
|
||||
|
||||
Stream respStream = null;
|
||||
try
|
||||
{
|
||||
respStream = response.GetResponseStream();
|
||||
deserial = (TResponse)deserializer.Deserialize(respStream);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
respStream.Close();
|
||||
response.Close();
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Status == WebExceptionStatus.ProtocolError)
|
||||
{
|
||||
if (e.Response is HttpWebResponse)
|
||||
{
|
||||
HttpWebResponse httpResponse = (HttpWebResponse)e.Response;
|
||||
|
||||
if (httpResponse.StatusCode != HttpStatusCode.NotFound)
|
||||
{
|
||||
// We don't appear to be handling any other status codes, so log these feailures to that
|
||||
// people don't spend unnecessary hours hunting phantom bugs.
|
||||
m_log.DebugFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}",
|
||||
verb, requestUrl, httpResponse.StatusCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
action(deserial);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e);
|
||||
}
|
||||
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SynchronousRestFormsRequester
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"> </param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj)
|
||||
{
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
request.Method = verb;
|
||||
string respstring = String.Empty;
|
||||
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
if ((verb == "POST") || (verb == "PUT"))
|
||||
{
|
||||
request.ContentType = "text/www-form-urlencoded";
|
||||
|
||||
int length = 0;
|
||||
using (StreamWriter writer = new StreamWriter(buffer))
|
||||
{
|
||||
writer.Write(obj);
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
length = (int)obj.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
Stream requestStream = null;
|
||||
try
|
||||
{
|
||||
requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (requestStream != null)
|
||||
requestStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (WebResponse resp = request.GetResponse())
|
||||
{
|
||||
if (resp.ContentLength != 0)
|
||||
{
|
||||
Stream respStream = null;
|
||||
try
|
||||
{
|
||||
respStream = resp.GetResponseStream();
|
||||
using (StreamReader reader = new StreamReader(respStream))
|
||||
{
|
||||
respstring = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (respStream != null)
|
||||
respStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// This is what happens when there is invalid XML
|
||||
m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
|
||||
}
|
||||
}
|
||||
return respstring;
|
||||
}
|
||||
}
|
||||
|
||||
public class SynchronousRestObjectPoster
|
||||
{
|
||||
[Obsolete]
|
||||
public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
||||
{
|
||||
return SynchronousRestObjectRequester.MakeRequest<TRequest, TResponse>(verb, requestUrl, obj);
|
||||
}
|
||||
}
|
||||
|
||||
public class SynchronousRestObjectRequester
|
||||
{
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"> </param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
||||
{
|
||||
Type type = typeof(TRequest);
|
||||
TResponse deserial = default(TResponse);
|
||||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
request.Method = verb;
|
||||
|
||||
if ((verb == "POST") || (verb == "PUT"))
|
||||
{
|
||||
request.ContentType = "text/xml";
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
|
||||
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;
|
||||
|
||||
Stream requestStream = null;
|
||||
try
|
||||
{
|
||||
requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return deserial;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (requestStream != null)
|
||||
requestStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (WebResponse resp = request.GetResponse())
|
||||
{
|
||||
if (resp.ContentLength > 0)
|
||||
{
|
||||
Stream respStream = resp.GetResponseStream();
|
||||
XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
|
||||
deserial = (TResponse)deserializer.Deserialize(respStream);
|
||||
respStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// This is what happens when there is invalid XML
|
||||
}
|
||||
return deserial;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -341,7 +341,12 @@ namespace OpenSim
|
|||
|
||||
m_console.Commands.AddCommand("region", false, "config get",
|
||||
"config get [<section>] [<key>]",
|
||||
"Show a config option",
|
||||
"Synonym for config show",
|
||||
HandleConfig);
|
||||
|
||||
m_console.Commands.AddCommand("region", false, "config show",
|
||||
"config show [<section>] [<key>]",
|
||||
"Show config information",
|
||||
"If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
|
||||
+ "If a section is given but not a field, then all fields in that section are printed.",
|
||||
HandleConfig);
|
||||
|
@ -593,7 +598,9 @@ namespace OpenSim
|
|||
|
||||
if (cmdparams.Length > 0)
|
||||
{
|
||||
switch (cmdparams[0].ToLower())
|
||||
string firstParam = cmdparams[0].ToLower();
|
||||
|
||||
switch (firstParam)
|
||||
{
|
||||
case "set":
|
||||
if (cmdparams.Length < 4)
|
||||
|
@ -618,6 +625,7 @@ namespace OpenSim
|
|||
break;
|
||||
|
||||
case "get":
|
||||
case "show":
|
||||
if (cmdparams.Length == 1)
|
||||
{
|
||||
foreach (IConfig config in m_config.Source.Configs)
|
||||
|
@ -654,8 +662,8 @@ namespace OpenSim
|
|||
}
|
||||
else
|
||||
{
|
||||
Notice("Syntax: config get [<section>] [<key>]");
|
||||
Notice("Example: config get ScriptEngine.DotNetEngine NumberOfScriptThreads");
|
||||
Notice("Syntax: config {0} [<section>] [<key>]", firstParam);
|
||||
Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -49,6 +49,8 @@ using Timer = System.Timers.Timer;
|
|||
using AssetLandmark = OpenSim.Framework.AssetLandmark;
|
||||
using Nini.Config;
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
public delegate bool PacketMethod(IClientAPI simClient, Packet packet);
|
||||
|
@ -313,6 +315,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
private int m_cachedTextureSerial;
|
||||
private PriorityQueue m_entityUpdates;
|
||||
private PriorityQueue m_entityProps;
|
||||
private Prioritizer m_prioritizer;
|
||||
private bool m_disableFacelights = false;
|
||||
|
||||
|
@ -360,9 +363,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
protected IAssetService m_assetService;
|
||||
private const bool m_checkPackets = true;
|
||||
|
||||
private Timer m_propertiesPacketTimer;
|
||||
private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>();
|
||||
|
||||
#endregion Class Members
|
||||
|
||||
#region Properties
|
||||
|
@ -438,6 +438,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_scene = scene;
|
||||
|
||||
m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
|
||||
m_entityProps = new PriorityQueue(m_scene.Entities.Count);
|
||||
m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
|
||||
m_killRecord = new HashSet<uint>();
|
||||
// m_attachmentsSent = new HashSet<uint>();
|
||||
|
@ -461,9 +462,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_udpClient.OnQueueEmpty += HandleQueueEmpty;
|
||||
m_udpClient.OnPacketStats += PopulateStats;
|
||||
|
||||
m_propertiesPacketTimer = new Timer(100);
|
||||
m_propertiesPacketTimer.Elapsed += ProcessObjectPropertiesPacket;
|
||||
|
||||
m_prioritizer = new Prioritizer(m_scene);
|
||||
|
||||
RegisterLocalPacketHandlers();
|
||||
|
@ -1537,7 +1535,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
else
|
||||
{
|
||||
OutPacket(kill, ThrottleOutPacketType.State);
|
||||
// OutPacket(kill, ThrottleOutPacketType.State);
|
||||
OutPacket(kill, ThrottleOutPacketType.Task);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2367,7 +2366,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
packet.Effect = effectBlocks;
|
||||
|
||||
OutPacket(packet, ThrottleOutPacketType.State);
|
||||
// OutPacket(packet, ThrottleOutPacketType.State);
|
||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember,
|
||||
|
@ -3547,16 +3547,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
#region Primitive Packet/Data Sending Methods
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generate one of the object update packets based on PrimUpdateFlags
|
||||
/// and broadcast the packet to clients
|
||||
/// </summary>
|
||||
public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
|
||||
{
|
||||
double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||
//double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||
uint priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||
|
||||
lock (m_entityUpdates.SyncRoot)
|
||||
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation), entity.LocalId);
|
||||
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation));
|
||||
}
|
||||
|
||||
private void ProcessEntityUpdates(int maxUpdates)
|
||||
|
@ -3566,7 +3568,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
|
||||
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
|
||||
|
||||
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
|
||||
// Check to see if this is a flush
|
||||
if (maxUpdates <= 0)
|
||||
{
|
||||
maxUpdates = Int32.MaxValue;
|
||||
}
|
||||
|
||||
int updatesThisCall = 0;
|
||||
|
||||
// We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
|
||||
|
@ -3574,12 +3581,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
lock (m_killRecord)
|
||||
{
|
||||
float avgTimeDilation = 1.0f;
|
||||
EntityUpdate update;
|
||||
IEntityUpdate iupdate;
|
||||
Int32 timeinqueue; // this is just debugging code & can be dropped later
|
||||
|
||||
while (updatesThisCall < maxUpdates)
|
||||
{
|
||||
lock (m_entityUpdates.SyncRoot)
|
||||
if (!m_entityUpdates.TryDequeue(out update))
|
||||
if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
|
||||
break;
|
||||
|
||||
EntityUpdate update = (EntityUpdate)iupdate;
|
||||
|
||||
avgTimeDilation += update.TimeDilation;
|
||||
avgTimeDilation *= 0.5f;
|
||||
|
||||
|
@ -3619,7 +3631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
#region UpdateFlags to packet type conversion
|
||||
|
||||
PrimUpdateFlags updateFlags = update.Flags;
|
||||
PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
|
||||
|
||||
bool canUseCompressed = true;
|
||||
bool canUseImproved = true;
|
||||
|
@ -3679,36 +3691,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
else
|
||||
{
|
||||
// if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment)
|
||||
// {
|
||||
// SceneObjectPart sop = (SceneObjectPart)update.Entity;
|
||||
// string text = sop.Text;
|
||||
// if (text.IndexOf("\n") >= 0)
|
||||
// text = text.Remove(text.IndexOf("\n"));
|
||||
//
|
||||
// if (m_attachmentsSent.Contains(sop.ParentID))
|
||||
// {
|
||||
//// m_log.DebugFormat(
|
||||
//// "[CLIENT]: Sending full info about attached prim {0} text {1}",
|
||||
//// sop.LocalId, text);
|
||||
//
|
||||
// objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId));
|
||||
//
|
||||
// m_attachmentsSent.Add(sop.LocalId);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet",
|
||||
// sop.LocalId, text, sop.ParentID);
|
||||
//
|
||||
// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
|
||||
// }
|
||||
}
|
||||
}
|
||||
else if (!canUseImproved)
|
||||
|
@ -3728,6 +3711,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
#endregion Block Construction
|
||||
}
|
||||
|
||||
|
||||
#region Packet Sending
|
||||
|
||||
//const float TIME_DILATION = 1.0f;
|
||||
|
@ -3802,26 +3786,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
public void ReprioritizeUpdates()
|
||||
{
|
||||
//m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName);
|
||||
|
||||
lock (m_entityUpdates.SyncRoot)
|
||||
m_entityUpdates.Reprioritize(UpdatePriorityHandler);
|
||||
}
|
||||
|
||||
private bool UpdatePriorityHandler(ref double priority, uint localID)
|
||||
private bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity)
|
||||
{
|
||||
EntityBase entity;
|
||||
if (m_scene.Entities.TryGetValue(localID, out entity))
|
||||
if (entity != null)
|
||||
{
|
||||
priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||
return true;
|
||||
}
|
||||
|
||||
return priority != double.NaN;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void FlushPrimUpdates()
|
||||
{
|
||||
m_log.Debug("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName);
|
||||
m_log.WarnFormat("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName);
|
||||
|
||||
while (m_entityUpdates.Count > 0)
|
||||
ProcessEntityUpdates(-1);
|
||||
|
@ -3829,12 +3811,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
#endregion Primitive Packet/Data Sending Methods
|
||||
|
||||
// These are used to implement an adaptive backoff in the number
|
||||
// of updates converted to packets. Since we don't want packets
|
||||
// to sit in the queue with old data, only convert enough updates
|
||||
// to packets that can be sent in 200ms.
|
||||
private Int32 m_LastQueueFill = 0;
|
||||
private Int32 m_maxUpdates = 0;
|
||||
|
||||
void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories)
|
||||
{
|
||||
if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
|
||||
{
|
||||
if (m_maxUpdates == 0 || m_LastQueueFill == 0)
|
||||
{
|
||||
m_maxUpdates = m_udpServer.PrimUpdatesPerCallback;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Util.EnvironmentTickCountSubtract(m_LastQueueFill) < 200)
|
||||
m_maxUpdates += 5;
|
||||
else
|
||||
m_maxUpdates = m_maxUpdates >> 1;
|
||||
}
|
||||
m_maxUpdates = Util.Clamp<Int32>(m_maxUpdates,10,500);
|
||||
m_LastQueueFill = Util.EnvironmentTickCount();
|
||||
|
||||
if (m_entityUpdates.Count > 0)
|
||||
ProcessEntityUpdates(m_udpServer.PrimUpdatesPerCallback);
|
||||
ProcessEntityUpdates(m_maxUpdates);
|
||||
|
||||
if (m_entityProps.Count > 0)
|
||||
ProcessEntityPropertyRequests(m_maxUpdates);
|
||||
}
|
||||
|
||||
if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0)
|
||||
|
@ -3948,47 +3954,167 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
OutPacket(pack, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID,
|
||||
uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask,
|
||||
uint NextOwnerMask, int OwnershipCost, byte SaleType, int SalePrice, uint Category,
|
||||
UUID LastOwnerID, string ObjectName, string Description)
|
||||
private class ObjectPropertyUpdate : IEntityUpdate
|
||||
{
|
||||
ObjectPropertiesFamilyPacket objPropFamilyPack = (ObjectPropertiesFamilyPacket)PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily);
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
internal bool SendFamilyProps;
|
||||
internal bool SendObjectProps;
|
||||
|
||||
ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock();
|
||||
objPropDB.RequestFlags = RequestFlags;
|
||||
objPropDB.ObjectID = ObjectUUID;
|
||||
if (OwnerID == GroupID)
|
||||
objPropDB.OwnerID = UUID.Zero;
|
||||
else
|
||||
objPropDB.OwnerID = OwnerID;
|
||||
objPropDB.GroupID = GroupID;
|
||||
objPropDB.BaseMask = BaseMask;
|
||||
objPropDB.OwnerMask = OwnerMask;
|
||||
objPropDB.GroupMask = GroupMask;
|
||||
objPropDB.EveryoneMask = EveryoneMask;
|
||||
objPropDB.NextOwnerMask = NextOwnerMask;
|
||||
|
||||
// TODO: More properties are needed in SceneObjectPart!
|
||||
objPropDB.OwnershipCost = OwnershipCost;
|
||||
objPropDB.SaleType = SaleType;
|
||||
objPropDB.SalePrice = SalePrice;
|
||||
objPropDB.Category = Category;
|
||||
objPropDB.LastOwnerID = LastOwnerID;
|
||||
objPropDB.Name = Util.StringToBytes256(ObjectName);
|
||||
objPropDB.Description = Util.StringToBytes256(Description);
|
||||
objPropFamilyPack.ObjectData = objPropDB;
|
||||
objPropFamilyPack.Header.Zerocoded = true;
|
||||
OutPacket(objPropFamilyPack, ThrottleOutPacketType.Task);
|
||||
public ObjectPropertyUpdate(ISceneEntity entity, uint flags, bool sendfam, bool sendobj)
|
||||
: base(entity,flags)
|
||||
{
|
||||
SendFamilyProps = sendfam;
|
||||
SendObjectProps = sendobj;
|
||||
}
|
||||
public void Update(ObjectPropertyUpdate update)
|
||||
{
|
||||
SendFamilyProps = SendFamilyProps || update.SendFamilyProps;
|
||||
SendObjectProps = SendObjectProps || update.SendObjectProps;
|
||||
Flags |= update.Flags;
|
||||
}
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesReply(
|
||||
UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID,
|
||||
UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID,
|
||||
UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName,
|
||||
string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask,
|
||||
uint BaseMask, byte saleType, int salePrice)
|
||||
public void SendObjectPropertiesFamilyData(ISceneEntity entity, uint requestFlags)
|
||||
{
|
||||
uint priority = 0; // time based ordering only
|
||||
lock (m_entityProps.SyncRoot)
|
||||
m_entityProps.Enqueue(priority, new ObjectPropertyUpdate(entity,requestFlags,true,false));
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesReply(ISceneEntity entity)
|
||||
{
|
||||
uint priority = 0; // time based ordering only
|
||||
lock (m_entityProps.SyncRoot)
|
||||
m_entityProps.Enqueue(priority, new ObjectPropertyUpdate(entity,0,false,true));
|
||||
}
|
||||
|
||||
private void ProcessEntityPropertyRequests(int maxUpdates)
|
||||
{
|
||||
OpenSim.Framework.Lazy<List<ObjectPropertiesFamilyPacket.ObjectDataBlock>> objectFamilyBlocks =
|
||||
new OpenSim.Framework.Lazy<List<ObjectPropertiesFamilyPacket.ObjectDataBlock>>();
|
||||
|
||||
OpenSim.Framework.Lazy<List<ObjectPropertiesPacket.ObjectDataBlock>> objectPropertiesBlocks =
|
||||
new OpenSim.Framework.Lazy<List<ObjectPropertiesPacket.ObjectDataBlock>>();
|
||||
|
||||
IEntityUpdate iupdate;
|
||||
Int32 timeinqueue; // this is just debugging code & can be dropped later
|
||||
|
||||
int updatesThisCall = 0;
|
||||
while (updatesThisCall < m_maxUpdates)
|
||||
{
|
||||
lock (m_entityProps.SyncRoot)
|
||||
if (!m_entityProps.TryDequeue(out iupdate, out timeinqueue))
|
||||
break;
|
||||
|
||||
ObjectPropertyUpdate update = (ObjectPropertyUpdate)iupdate;
|
||||
if (update.SendFamilyProps)
|
||||
{
|
||||
if (update.Entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart sop = (SceneObjectPart)update.Entity;
|
||||
ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesFamilyBlock(sop,update.Flags);
|
||||
objectFamilyBlocks.Value.Add(objPropDB);
|
||||
}
|
||||
}
|
||||
|
||||
if (update.SendObjectProps)
|
||||
{
|
||||
if (update.Entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart sop = (SceneObjectPart)update.Entity;
|
||||
ObjectPropertiesPacket.ObjectDataBlock objPropDB = CreateObjectPropertiesBlock(sop);
|
||||
objectPropertiesBlocks.Value.Add(objPropDB);
|
||||
}
|
||||
}
|
||||
|
||||
updatesThisCall++;
|
||||
}
|
||||
|
||||
|
||||
Int32 ppcnt = 0;
|
||||
Int32 pbcnt = 0;
|
||||
|
||||
if (objectPropertiesBlocks.IsValueCreated)
|
||||
{
|
||||
List<ObjectPropertiesPacket.ObjectDataBlock> blocks = objectPropertiesBlocks.Value;
|
||||
|
||||
ObjectPropertiesPacket packet = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
|
||||
packet.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[blocks.Count];
|
||||
for (int i = 0; i < blocks.Count; i++)
|
||||
packet.ObjectData[i] = blocks[i];
|
||||
|
||||
packet.Header.Zerocoded = true;
|
||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
||||
|
||||
pbcnt += blocks.Count;
|
||||
ppcnt++;
|
||||
}
|
||||
|
||||
Int32 fpcnt = 0;
|
||||
Int32 fbcnt = 0;
|
||||
|
||||
if (objectFamilyBlocks.IsValueCreated)
|
||||
{
|
||||
List<ObjectPropertiesFamilyPacket.ObjectDataBlock> blocks = objectFamilyBlocks.Value;
|
||||
|
||||
// ObjectPropertiesFamilyPacket objPropFamilyPack =
|
||||
// (ObjectPropertiesFamilyPacket)PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily);
|
||||
//
|
||||
// objPropFamilyPack.ObjectData = new ObjectPropertiesFamilyPacket.ObjectDataBlock[blocks.Count];
|
||||
// for (int i = 0; i < blocks.Count; i++)
|
||||
// objPropFamilyPack.ObjectData[i] = blocks[i];
|
||||
//
|
||||
// OutPacket(objPropFamilyPack, ThrottleOutPacketType.Task, true);
|
||||
|
||||
// one packet per object block... uggh...
|
||||
for (int i = 0; i < blocks.Count; i++)
|
||||
{
|
||||
ObjectPropertiesFamilyPacket packet =
|
||||
(ObjectPropertiesFamilyPacket)PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily);
|
||||
|
||||
packet.ObjectData = blocks[i];
|
||||
packet.Header.Zerocoded = true;
|
||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||
|
||||
fpcnt++;
|
||||
fbcnt++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// m_log.WarnFormat("[PACKETCOUNTS] queued {0} property packets with {1} blocks",ppcnt,pbcnt);
|
||||
// m_log.WarnFormat("[PACKETCOUNTS] queued {0} family property packets with {1} blocks",fpcnt,fbcnt);
|
||||
}
|
||||
|
||||
private ObjectPropertiesFamilyPacket.ObjectDataBlock CreateObjectPropertiesFamilyBlock(SceneObjectPart sop, uint requestFlags)
|
||||
{
|
||||
ObjectPropertiesFamilyPacket.ObjectDataBlock block = new ObjectPropertiesFamilyPacket.ObjectDataBlock();
|
||||
|
||||
block.RequestFlags = requestFlags;
|
||||
block.ObjectID = sop.UUID;
|
||||
if (sop.OwnerID == sop.GroupID)
|
||||
block.OwnerID = UUID.Zero;
|
||||
else
|
||||
block.OwnerID = sop.OwnerID;
|
||||
block.GroupID = sop.GroupID;
|
||||
block.BaseMask = sop.BaseMask;
|
||||
block.OwnerMask = sop.OwnerMask;
|
||||
block.GroupMask = sop.GroupMask;
|
||||
block.EveryoneMask = sop.EveryoneMask;
|
||||
block.NextOwnerMask = sop.NextOwnerMask;
|
||||
|
||||
// TODO: More properties are needed in SceneObjectPart!
|
||||
block.OwnershipCost = sop.OwnershipCost;
|
||||
block.SaleType = sop.ObjectSaleType;
|
||||
block.SalePrice = sop.SalePrice;
|
||||
block.Category = sop.Category;
|
||||
block.LastOwnerID = sop.CreatorID; // copied from old SOG call... is this right?
|
||||
block.Name = Util.StringToBytes256(sop.Name);
|
||||
block.Description = Util.StringToBytes256(sop.Description);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
private ObjectPropertiesPacket.ObjectDataBlock CreateObjectPropertiesBlock(SceneObjectPart sop)
|
||||
{
|
||||
//ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
|
@ -3996,84 +4122,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
ObjectPropertiesPacket.ObjectDataBlock block =
|
||||
new ObjectPropertiesPacket.ObjectDataBlock();
|
||||
|
||||
block.ItemID = ItemID;
|
||||
block.CreationDate = CreationDate;
|
||||
block.CreatorID = CreatorUUID;
|
||||
block.FolderID = FolderUUID;
|
||||
block.FromTaskID = FromTaskUUID;
|
||||
block.GroupID = GroupUUID;
|
||||
block.InventorySerial = InventorySerial;
|
||||
block.ObjectID = sop.UUID;
|
||||
block.Name = Util.StringToBytes256(sop.Name);
|
||||
block.Description = Util.StringToBytes256(sop.Description);
|
||||
|
||||
block.LastOwnerID = LastOwnerUUID;
|
||||
// proper.ObjectData[0].LastOwnerID = UUID.Zero;
|
||||
|
||||
block.ObjectID = ObjectUUID;
|
||||
if (OwnerUUID == GroupUUID)
|
||||
block.CreationDate = (ulong)sop.CreationDate * 1000000; // viewer wants date in microseconds
|
||||
block.CreatorID = sop.CreatorID;
|
||||
block.GroupID = sop.GroupID;
|
||||
block.LastOwnerID = sop.LastOwnerID;
|
||||
if (sop.OwnerID == sop.GroupID)
|
||||
block.OwnerID = UUID.Zero;
|
||||
else
|
||||
block.OwnerID = OwnerUUID;
|
||||
block.TouchName = Util.StringToBytes256(TouchTitle);
|
||||
block.TextureID = TextureID;
|
||||
block.SitName = Util.StringToBytes256(SitTitle);
|
||||
block.Name = Util.StringToBytes256(ItemName);
|
||||
block.Description = Util.StringToBytes256(ItemDescription);
|
||||
block.OwnerMask = OwnerMask;
|
||||
block.NextOwnerMask = NextOwnerMask;
|
||||
block.GroupMask = GroupMask;
|
||||
block.EveryoneMask = EveryoneMask;
|
||||
block.BaseMask = BaseMask;
|
||||
// proper.ObjectData[0].AggregatePerms = 53;
|
||||
// proper.ObjectData[0].AggregatePermTextures = 0;
|
||||
// proper.ObjectData[0].AggregatePermTexturesOwner = 0;
|
||||
block.SaleType = saleType;
|
||||
block.SalePrice = salePrice;
|
||||
block.OwnerID = sop.OwnerID;
|
||||
|
||||
lock (m_propertiesPacketTimer)
|
||||
{
|
||||
m_propertiesBlocks.Add(block);
|
||||
block.ItemID = sop.FromUserInventoryItemID;
|
||||
block.FolderID = UUID.Zero; // sop.FromFolderID ??
|
||||
block.FromTaskID = UUID.Zero; // ???
|
||||
block.InventorySerial = (short)sop.InventorySerial;
|
||||
|
||||
int length = 0;
|
||||
foreach (ObjectPropertiesPacket.ObjectDataBlock b in m_propertiesBlocks)
|
||||
{
|
||||
length += b.Length;
|
||||
}
|
||||
if (length > 1100) // FIXME: use real MTU
|
||||
{
|
||||
ProcessObjectPropertiesPacket(null, null);
|
||||
m_propertiesPacketTimer.Stop();
|
||||
return;
|
||||
}
|
||||
SceneObjectPart root = sop.ParentGroup.RootPart;
|
||||
|
||||
m_propertiesPacketTimer.Stop();
|
||||
m_propertiesPacketTimer.Start();
|
||||
}
|
||||
block.TouchName = Util.StringToBytes256(root.TouchName);
|
||||
block.TextureID = new byte[0]; // TextureID ???
|
||||
block.SitName = Util.StringToBytes256(root.SitName);
|
||||
block.OwnerMask = root.OwnerMask;
|
||||
block.NextOwnerMask = root.NextOwnerMask;
|
||||
block.GroupMask = root.GroupMask;
|
||||
block.EveryoneMask = root.EveryoneMask;
|
||||
block.BaseMask = root.BaseMask;
|
||||
block.SaleType = root.ObjectSaleType;
|
||||
block.SalePrice = root.SalePrice;
|
||||
|
||||
//proper.Header.Zerocoded = true;
|
||||
//OutPacket(proper, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
private void ProcessObjectPropertiesPacket(Object sender, ElapsedEventArgs e)
|
||||
{
|
||||
ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
|
||||
|
||||
lock (m_propertiesPacketTimer)
|
||||
{
|
||||
m_propertiesPacketTimer.Stop();
|
||||
|
||||
proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count];
|
||||
|
||||
int index = 0;
|
||||
|
||||
foreach (ObjectPropertiesPacket.ObjectDataBlock b in m_propertiesBlocks)
|
||||
{
|
||||
proper.ObjectData[index++] = b;
|
||||
}
|
||||
|
||||
m_propertiesBlocks.Clear();
|
||||
}
|
||||
|
||||
proper.Header.Zerocoded = true;
|
||||
OutPacket(proper, ThrottleOutPacketType.Task);
|
||||
return block;
|
||||
}
|
||||
|
||||
#region Estate Data Sending Methods
|
||||
|
@ -4217,6 +4297,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
public void SendEstateCovenantInformation(UUID covenant)
|
||||
{
|
||||
// m_log.DebugFormat("[LLCLIENTVIEW]: Sending estate covenant asset id of {0} to {1}", covenant, Name);
|
||||
|
||||
EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
|
||||
EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
|
||||
edata.CovenantID = covenant;
|
||||
|
@ -4227,8 +4309,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
OutPacket(einfopack, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
|
||||
public void SendDetailedEstateData(
|
||||
UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition,
|
||||
UUID covenant, string abuseEmail, UUID estateOwner)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sending detailed estate data to {0} with covenant asset id {1}", Name, covenant);
|
||||
|
||||
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
|
||||
packet.MethodData.Invoice = invoice;
|
||||
packet.AgentData.TransactionID = UUID.Random();
|
||||
|
@ -4407,6 +4494,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
public void SendForceClientSelectObjects(List<uint> ObjectIDs)
|
||||
{
|
||||
m_log.WarnFormat("[LLCLIENTVIEW] sending select with {0} objects", ObjectIDs.Count);
|
||||
|
||||
bool firstCall = true;
|
||||
const int MAX_OBJECTS_PER_PACKET = 251;
|
||||
ForceObjectSelectPacket pack = (ForceObjectSelectPacket)PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect);
|
||||
|
@ -11726,171 +11815,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
OutPacket(pack, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
#region PriorityQueue
|
||||
public class PriorityQueue
|
||||
{
|
||||
internal delegate bool UpdatePriorityHandler(ref double priority, uint local_id);
|
||||
|
||||
private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[1];
|
||||
private Dictionary<uint, LookupItem> m_lookupTable;
|
||||
private Comparison<double> m_comparison;
|
||||
private object m_syncRoot = new object();
|
||||
|
||||
internal PriorityQueue() :
|
||||
this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, Comparer<double>.Default) { }
|
||||
internal PriorityQueue(int capacity) :
|
||||
this(capacity, Comparer<double>.Default) { }
|
||||
internal PriorityQueue(IComparer<double> comparer) :
|
||||
this(new Comparison<double>(comparer.Compare)) { }
|
||||
internal PriorityQueue(Comparison<double> comparison) :
|
||||
this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, comparison) { }
|
||||
internal PriorityQueue(int capacity, IComparer<double> comparer) :
|
||||
this(capacity, new Comparison<double>(comparer.Compare)) { }
|
||||
internal PriorityQueue(int capacity, Comparison<double> comparison)
|
||||
{
|
||||
m_lookupTable = new Dictionary<uint, LookupItem>(capacity);
|
||||
|
||||
for (int i = 0; i < m_heaps.Length; ++i)
|
||||
m_heaps[i] = new MinHeap<MinHeapItem>(capacity);
|
||||
this.m_comparison = comparison;
|
||||
}
|
||||
|
||||
public object SyncRoot { get { return this.m_syncRoot; } }
|
||||
internal int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < m_heaps.Length; ++i)
|
||||
count = m_heaps[i].Count;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Enqueue(double priority, EntityUpdate value, uint local_id)
|
||||
{
|
||||
LookupItem item;
|
||||
|
||||
if (m_lookupTable.TryGetValue(local_id, out item))
|
||||
{
|
||||
// Combine flags
|
||||
value.Flags |= item.Heap[item.Handle].Value.Flags;
|
||||
|
||||
item.Heap[item.Handle] = new MinHeapItem(priority, value, local_id, this.m_comparison);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Heap = m_heaps[0];
|
||||
item.Heap.Add(new MinHeapItem(priority, value, local_id, this.m_comparison), ref item.Handle);
|
||||
m_lookupTable.Add(local_id, item);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
internal EntityUpdate Peek()
|
||||
{
|
||||
for (int i = 0; i < m_heaps.Length; ++i)
|
||||
if (m_heaps[i].Count > 0)
|
||||
return m_heaps[i].Min().Value;
|
||||
throw new InvalidOperationException(string.Format("The {0} is empty", this.GetType().ToString()));
|
||||
}
|
||||
|
||||
internal bool TryDequeue(out EntityUpdate value)
|
||||
{
|
||||
for (int i = 0; i < m_heaps.Length; ++i)
|
||||
{
|
||||
if (m_heaps[i].Count > 0)
|
||||
{
|
||||
MinHeapItem item = m_heaps[i].RemoveMin();
|
||||
m_lookupTable.Remove(item.LocalID);
|
||||
value = item.Value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
value = default(EntityUpdate);
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void Reprioritize(UpdatePriorityHandler handler)
|
||||
{
|
||||
MinHeapItem item;
|
||||
double priority;
|
||||
|
||||
foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values))
|
||||
{
|
||||
if (lookup.Heap.TryGetValue(lookup.Handle, out item))
|
||||
{
|
||||
priority = item.Priority;
|
||||
if (handler(ref priority, item.LocalID))
|
||||
{
|
||||
if (lookup.Heap.ContainsHandle(lookup.Handle))
|
||||
lookup.Heap[lookup.Handle] =
|
||||
new MinHeapItem(priority, item.Value, item.LocalID, this.m_comparison);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[LLCLIENTVIEW]: UpdatePriorityHandler returned false, dropping update");
|
||||
lookup.Heap.Remove(lookup.Handle);
|
||||
this.m_lookupTable.Remove(item.LocalID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region MinHeapItem
|
||||
private struct MinHeapItem : IComparable<MinHeapItem>
|
||||
{
|
||||
private double priority;
|
||||
private EntityUpdate value;
|
||||
private uint local_id;
|
||||
private Comparison<double> comparison;
|
||||
|
||||
internal MinHeapItem(double priority, EntityUpdate value, uint local_id) :
|
||||
this(priority, value, local_id, Comparer<double>.Default) { }
|
||||
internal MinHeapItem(double priority, EntityUpdate value, uint local_id, IComparer<double> comparer) :
|
||||
this(priority, value, local_id, new Comparison<double>(comparer.Compare)) { }
|
||||
internal MinHeapItem(double priority, EntityUpdate value, uint local_id, Comparison<double> comparison)
|
||||
{
|
||||
this.priority = priority;
|
||||
this.value = value;
|
||||
this.local_id = local_id;
|
||||
this.comparison = comparison;
|
||||
}
|
||||
|
||||
internal double Priority { get { return this.priority; } }
|
||||
internal EntityUpdate Value { get { return this.value; } }
|
||||
internal uint LocalID { get { return this.local_id; } }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("[");
|
||||
sb.Append(this.priority.ToString());
|
||||
sb.Append(",");
|
||||
if (this.value != null)
|
||||
sb.Append(this.value.ToString());
|
||||
sb.Append("]");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public int CompareTo(MinHeapItem other)
|
||||
{
|
||||
return this.comparison(this.priority, other.priority);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region LookupItem
|
||||
private struct LookupItem
|
||||
{
|
||||
internal MinHeap<MinHeapItem> Heap;
|
||||
internal IHandle Handle;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public struct PacketProcessor
|
||||
{
|
||||
public PacketMethod method;
|
||||
|
@ -11911,8 +11835,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static OSD BuildEvent(string eventName, OSD eventBody)
|
||||
{
|
||||
OSDMap osdEvent = new OSDMap(2);
|
||||
|
|
|
@ -135,7 +135,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
private int m_nextOnQueueEmpty = 1;
|
||||
|
||||
/// <summary>Throttle bucket for this agent's connection</summary>
|
||||
private readonly TokenBucket m_throttle;
|
||||
private readonly TokenBucket m_throttleClient;
|
||||
/// <summary>Throttle bucket for this agent's connection</summary>
|
||||
private readonly TokenBucket m_throttleCategory;
|
||||
/// <summary>Throttle buckets for each packet category</summary>
|
||||
private readonly TokenBucket[] m_throttleCategories;
|
||||
/// <summary>Outgoing queues for throttled packets</summary>
|
||||
|
@ -149,7 +151,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <summary>Caches packed throttle information</summary>
|
||||
private byte[] m_packedThrottles;
|
||||
|
||||
private int m_defaultRTO = 3000;
|
||||
private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC
|
||||
private int m_maxRTO = 60000;
|
||||
|
||||
/// <summary>
|
||||
|
@ -174,7 +176,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_maxRTO = maxRTO;
|
||||
|
||||
// Create a token bucket throttle for this client that has the scene token bucket as a parent
|
||||
m_throttle = new TokenBucket(parentThrottle, rates.TotalLimit, rates.Total);
|
||||
m_throttleClient = new TokenBucket(parentThrottle, rates.TotalLimit);
|
||||
// Create a token bucket throttle for the total categary with the client bucket as a throttle
|
||||
m_throttleCategory = new TokenBucket(m_throttleClient, rates.TotalLimit);
|
||||
// Create an array of token buckets for this clients different throttle categories
|
||||
m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];
|
||||
|
||||
|
@ -185,7 +189,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// Initialize the packet outboxes, where packets sit while they are waiting for tokens
|
||||
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
|
||||
// Initialize the token buckets that control the throttling for each category
|
||||
m_throttleCategories[i] = new TokenBucket(m_throttle, rates.GetLimit(type), rates.GetRate(type));
|
||||
m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetLimit(type));
|
||||
}
|
||||
|
||||
// Default the retransmission timeout to three seconds
|
||||
|
@ -206,6 +210,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_packetOutboxes[i].Clear();
|
||||
m_nextPackets[i] = null;
|
||||
}
|
||||
|
||||
// pull the throttle out of the scene throttle
|
||||
m_throttleClient.Parent.UnregisterRequest(m_throttleClient);
|
||||
OnPacketStats = null;
|
||||
OnQueueEmpty = null;
|
||||
}
|
||||
|
@ -216,6 +223,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <returns>Information about the client connection</returns>
|
||||
public ClientInfo GetClientInfo()
|
||||
{
|
||||
///<mic>
|
||||
TokenBucket tb;
|
||||
|
||||
tb = m_throttleClient.Parent;
|
||||
m_log.WarnFormat("[TOKENS] {3}: Actual={0},Request={1},TotalRequest={2}",tb.DripRate,tb.RequestedDripRate,tb.TotalDripRequest,"ROOT");
|
||||
|
||||
tb = m_throttleClient;
|
||||
m_log.WarnFormat("[TOKENS] {3}: Actual={0},Request={1},TotalRequest={2}",tb.DripRate,tb.RequestedDripRate,tb.TotalDripRequest," CLIENT");
|
||||
|
||||
tb = m_throttleCategory;
|
||||
m_log.WarnFormat("[TOKENS] {3}: Actual={0},Request={1},TotalRequest={2}",tb.DripRate,tb.RequestedDripRate,tb.TotalDripRequest," CATEGORY");
|
||||
|
||||
for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++)
|
||||
{
|
||||
tb = m_throttleCategories[i];
|
||||
m_log.WarnFormat("[TOKENS] {4} <{0}:{1}>: Actual={2},Requested={3}",AgentID,i,tb.DripRate,tb.RequestedDripRate," BUCKET");
|
||||
}
|
||||
|
||||
///</mic>
|
||||
|
||||
// TODO: This data structure is wrong in so many ways. Locking and copying the entire lists
|
||||
// of pending and needed ACKs for every client every time some method wants information about
|
||||
// this connection is a recipe for poor performance
|
||||
|
@ -223,13 +250,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
info.pendingAcks = new Dictionary<uint, uint>();
|
||||
info.needAck = new Dictionary<uint, byte[]>();
|
||||
|
||||
info.resendThrottle = m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate;
|
||||
info.landThrottle = m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate;
|
||||
info.windThrottle = m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate;
|
||||
info.cloudThrottle = m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate;
|
||||
info.taskThrottle = m_throttleCategories[(int)ThrottleOutPacketType.State].DripRate + m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate;
|
||||
info.assetThrottle = m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate;
|
||||
info.textureThrottle = m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate;
|
||||
info.resendThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate;
|
||||
info.landThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate;
|
||||
info.windThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate;
|
||||
info.cloudThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate;
|
||||
// info.taskThrottle = m_throttleCategories[(int)ThrottleOutPacketType.State].DripRate + m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate;
|
||||
info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate;
|
||||
info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate;
|
||||
info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate;
|
||||
info.totalThrottle = info.resendThrottle + info.landThrottle + info.windThrottle + info.cloudThrottle +
|
||||
info.taskThrottle + info.assetThrottle + info.textureThrottle;
|
||||
|
||||
|
@ -317,8 +345,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||
int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
||||
// State is a subcategory of task that we allocate a percentage to
|
||||
int state = (int)((float)task * STATE_TASK_PERCENTAGE);
|
||||
task -= state;
|
||||
int state = 0;
|
||||
// int state = (int)((float)task * STATE_TASK_PERCENTAGE);
|
||||
// task -= state;
|
||||
|
||||
// Make sure none of the throttles are set below our packet MTU,
|
||||
// otherwise a throttle could become permanently clogged
|
||||
|
@ -339,40 +368,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// Update the token buckets with new throttle values
|
||||
TokenBucket bucket;
|
||||
|
||||
bucket = m_throttle;
|
||||
bucket.MaxBurst = total;
|
||||
bucket = m_throttleCategory;
|
||||
bucket.RequestedDripRate = total;
|
||||
|
||||
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend];
|
||||
bucket.DripRate = resend;
|
||||
bucket.MaxBurst = resend;
|
||||
bucket.RequestedDripRate = resend;
|
||||
|
||||
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Land];
|
||||
bucket.DripRate = land;
|
||||
bucket.MaxBurst = land;
|
||||
bucket.RequestedDripRate = land;
|
||||
|
||||
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Wind];
|
||||
bucket.DripRate = wind;
|
||||
bucket.MaxBurst = wind;
|
||||
bucket.RequestedDripRate = wind;
|
||||
|
||||
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Cloud];
|
||||
bucket.DripRate = cloud;
|
||||
bucket.MaxBurst = cloud;
|
||||
bucket.RequestedDripRate = cloud;
|
||||
|
||||
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Asset];
|
||||
bucket.DripRate = asset;
|
||||
bucket.MaxBurst = asset;
|
||||
bucket.RequestedDripRate = asset;
|
||||
|
||||
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task];
|
||||
bucket.DripRate = task + state;
|
||||
bucket.MaxBurst = task + state;
|
||||
bucket.RequestedDripRate = task;
|
||||
|
||||
bucket = m_throttleCategories[(int)ThrottleOutPacketType.State];
|
||||
bucket.DripRate = state;
|
||||
bucket.MaxBurst = state;
|
||||
bucket.RequestedDripRate = state;
|
||||
|
||||
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture];
|
||||
bucket.DripRate = texture;
|
||||
bucket.MaxBurst = texture;
|
||||
bucket.RequestedDripRate = texture;
|
||||
|
||||
// Reset the packed throttles cached data
|
||||
m_packedThrottles = null;
|
||||
|
@ -387,14 +408,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
data = new byte[7 * 4];
|
||||
int i = 0;
|
||||
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Land].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)(m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate) +
|
||||
m_throttleCategories[(int)ThrottleOutPacketType.State].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].RequestedDripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Land].RequestedDripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].RequestedDripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].RequestedDripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Task].RequestedDripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].RequestedDripRate), 0, data, i, 4); i += 4;
|
||||
Buffer.BlockCopy(Utils.FloatToBytes((float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].RequestedDripRate), 0, data, i, 4); i += 4;
|
||||
|
||||
m_packedThrottles = data;
|
||||
}
|
||||
|
@ -420,6 +440,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
|
||||
TokenBucket bucket = m_throttleCategories[category];
|
||||
|
||||
// Don't send this packet if there is already a packet waiting in the queue
|
||||
// even if we have the tokens to send it, tokens should go to the already
|
||||
// queued packets
|
||||
if (queue.Count > 0)
|
||||
{
|
||||
queue.Enqueue(packet);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!forceQueue && bucket.RemoveTokens(packet.Buffer.DataLength))
|
||||
{
|
||||
// Enough tokens were removed from the bucket, the packet will not be queued
|
||||
|
@ -557,7 +587,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
|
||||
|
||||
// Clamp the retransmission timeout to manageable values
|
||||
rto = Utils.Clamp(RTO, m_defaultRTO, m_maxRTO);
|
||||
rto = Utils.Clamp(rto, m_defaultRTO, m_maxRTO);
|
||||
|
||||
RTO = rto;
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
#endregion BinaryStats
|
||||
|
||||
m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps);
|
||||
m_throttle = new TokenBucket(null, sceneThrottleBps);
|
||||
ThrottleRates = new ThrottleRates(configSource);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
* 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Client;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
public class PriorityQueue
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
internal delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity);
|
||||
|
||||
// Heap[0] for self updates
|
||||
// Heap[1..12] for entity updates
|
||||
|
||||
internal const uint m_numberOfQueues = 12;
|
||||
|
||||
private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[m_numberOfQueues];
|
||||
private Dictionary<uint, LookupItem> m_lookupTable;
|
||||
private uint m_nextQueue = 0;
|
||||
private UInt64 m_nextRequest = 0;
|
||||
|
||||
private object m_syncRoot = new object();
|
||||
public object SyncRoot {
|
||||
get { return this.m_syncRoot; }
|
||||
}
|
||||
|
||||
internal PriorityQueue() : this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY) { }
|
||||
|
||||
internal PriorityQueue(int capacity)
|
||||
{
|
||||
m_lookupTable = new Dictionary<uint, LookupItem>(capacity);
|
||||
|
||||
for (int i = 0; i < m_heaps.Length; ++i)
|
||||
m_heaps[i] = new MinHeap<MinHeapItem>(capacity);
|
||||
}
|
||||
|
||||
internal int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 0; i < m_heaps.Length; ++i)
|
||||
count += m_heaps[i].Count;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Enqueue(uint pqueue, IEntityUpdate value)
|
||||
{
|
||||
LookupItem lookup;
|
||||
|
||||
uint localid = value.Entity.LocalId;
|
||||
UInt64 entry = m_nextRequest++;
|
||||
if (m_lookupTable.TryGetValue(localid, out lookup))
|
||||
{
|
||||
entry = lookup.Heap[lookup.Handle].EntryOrder;
|
||||
value.Update(lookup.Heap[lookup.Handle].Value);
|
||||
lookup.Heap.Remove(lookup.Handle);
|
||||
}
|
||||
|
||||
pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1);
|
||||
lookup.Heap = m_heaps[pqueue];
|
||||
lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle);
|
||||
m_lookupTable[localid] = lookup;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
internal bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue)
|
||||
{
|
||||
for (int i = 0; i < m_numberOfQueues; ++i)
|
||||
{
|
||||
// To get the fair queing, we cycle through each of the
|
||||
// queues when finding an element to dequeue, this code
|
||||
// assumes that the distribution of updates in the queues
|
||||
// is polynomial, probably quadractic (eg distance of PI * R^2)
|
||||
uint h = (uint)((m_nextQueue + i) % m_numberOfQueues);
|
||||
if (m_heaps[h].Count > 0)
|
||||
{
|
||||
m_nextQueue = (uint)((h + 1) % m_numberOfQueues);
|
||||
|
||||
MinHeapItem item = m_heaps[h].RemoveMin();
|
||||
m_lookupTable.Remove(item.Value.Entity.LocalId);
|
||||
timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
|
||||
value = item.Value;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
timeinqueue = 0;
|
||||
value = default(IEntityUpdate);
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void Reprioritize(UpdatePriorityHandler handler)
|
||||
{
|
||||
MinHeapItem item;
|
||||
foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values))
|
||||
{
|
||||
if (lookup.Heap.TryGetValue(lookup.Handle, out item))
|
||||
{
|
||||
uint pqueue = item.PriorityQueue;
|
||||
uint localid = item.Value.Entity.LocalId;
|
||||
|
||||
if (handler(ref pqueue, item.Value.Entity))
|
||||
{
|
||||
// unless the priority queue has changed, there is no need to modify
|
||||
// the entry
|
||||
pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1);
|
||||
if (pqueue != item.PriorityQueue)
|
||||
{
|
||||
lookup.Heap.Remove(lookup.Handle);
|
||||
|
||||
LookupItem litem = lookup;
|
||||
litem.Heap = m_heaps[pqueue];
|
||||
litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle);
|
||||
m_lookupTable[localid] = litem;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.WarnFormat("[PQUEUE]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID);
|
||||
lookup.Heap.Remove(lookup.Handle);
|
||||
this.m_lookupTable.Remove(localid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string s = "";
|
||||
for (int i = 0; i < m_numberOfQueues; i++)
|
||||
{
|
||||
if (s != "") s += ",";
|
||||
s += m_heaps[i].Count.ToString();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
#region MinHeapItem
|
||||
private struct MinHeapItem : IComparable<MinHeapItem>
|
||||
{
|
||||
private IEntityUpdate value;
|
||||
internal IEntityUpdate Value {
|
||||
get {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
private uint pqueue;
|
||||
internal uint PriorityQueue {
|
||||
get {
|
||||
return this.pqueue;
|
||||
}
|
||||
}
|
||||
|
||||
private Int32 entrytime;
|
||||
internal Int32 EntryTime {
|
||||
get {
|
||||
return this.entrytime;
|
||||
}
|
||||
}
|
||||
|
||||
private UInt64 entryorder;
|
||||
internal UInt64 EntryOrder
|
||||
{
|
||||
get {
|
||||
return this.entryorder;
|
||||
}
|
||||
}
|
||||
|
||||
internal MinHeapItem(uint pqueue, MinHeapItem other)
|
||||
{
|
||||
this.entrytime = other.entrytime;
|
||||
this.entryorder = other.entryorder;
|
||||
this.value = other.value;
|
||||
this.pqueue = pqueue;
|
||||
}
|
||||
|
||||
internal MinHeapItem(uint pqueue, UInt64 entryorder, IEntityUpdate value)
|
||||
{
|
||||
this.entrytime = Util.EnvironmentTickCount();
|
||||
this.entryorder = entryorder;
|
||||
this.value = value;
|
||||
this.pqueue = pqueue;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId);
|
||||
}
|
||||
|
||||
public int CompareTo(MinHeapItem other)
|
||||
{
|
||||
// I'm assuming that the root part of an SOG is added to the update queue
|
||||
// before the component parts
|
||||
return Comparer<UInt64>.Default.Compare(this.EntryOrder, other.EntryOrder);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region LookupItem
|
||||
private struct LookupItem
|
||||
{
|
||||
internal MinHeap<MinHeapItem> Heap;
|
||||
internal IHandle Handle;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -26,6 +26,10 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
|
@ -35,19 +39,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// </summary>
|
||||
public class TokenBucket
|
||||
{
|
||||
/// <summary>Parent bucket to this bucket, or null if this is a root
|
||||
/// bucket</summary>
|
||||
TokenBucket parent;
|
||||
/// <summary>Size of the bucket in bytes. If zero, the bucket has
|
||||
/// infinite capacity</summary>
|
||||
int maxBurst;
|
||||
/// <summary>Rate that the bucket fills, in bytes per millisecond. If
|
||||
/// zero, the bucket always remains full</summary>
|
||||
int tokensPerMS;
|
||||
/// <summary>Number of tokens currently in the bucket</summary>
|
||||
int content;
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static Int32 m_counter = 0;
|
||||
|
||||
private Int32 m_identifier;
|
||||
|
||||
/// <summary>
|
||||
/// Number of ticks (ms) per quantum, drip rate and max burst
|
||||
/// are defined over this interval.
|
||||
/// </summary>
|
||||
private const Int32 m_ticksPerQuantum = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// This is the number of quantums worth of packets that can
|
||||
/// be accommodated during a burst
|
||||
/// </summary>
|
||||
private const Double m_quantumsPerBurst = 1.5;
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
private const Int32 m_minimumDripRate = 1400;
|
||||
|
||||
/// <summary>Time of the last drip, in system ticks</summary>
|
||||
int lastDrip;
|
||||
private Int32 m_lastDrip;
|
||||
|
||||
/// <summary>
|
||||
/// The number of bytes that can be sent at this moment. This is the
|
||||
/// current number of tokens in the bucket
|
||||
/// </summary>
|
||||
private Int64 m_tokenCount;
|
||||
|
||||
/// <summary>
|
||||
/// Map of children buckets and their requested maximum burst rate
|
||||
/// </summary>
|
||||
private Dictionary<TokenBucket,Int64> m_children = new Dictionary<TokenBucket,Int64>();
|
||||
|
||||
#region Properties
|
||||
|
||||
|
@ -56,69 +81,85 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// parent. The parent bucket will limit the aggregate bandwidth of all
|
||||
/// of its children buckets
|
||||
/// </summary>
|
||||
private TokenBucket m_parent;
|
||||
public TokenBucket Parent
|
||||
{
|
||||
get { return parent; }
|
||||
get { return m_parent; }
|
||||
set { m_parent = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maximum burst rate in bytes per second. This is the maximum number
|
||||
/// of tokens that can accumulate in the bucket at any one time
|
||||
/// of tokens that can accumulate in the bucket at any one time. This
|
||||
/// also sets the total request for leaf nodes
|
||||
/// </summary>
|
||||
public int MaxBurst
|
||||
private Int64 m_burstRate;
|
||||
public Int64 RequestedBurstRate
|
||||
{
|
||||
get { return maxBurst; }
|
||||
set { maxBurst = (value >= 0 ? value : 0); }
|
||||
get { return m_burstRate; }
|
||||
set { m_burstRate = (value < 0 ? 0 : value); }
|
||||
}
|
||||
|
||||
public Int64 BurstRate
|
||||
{
|
||||
get {
|
||||
double rate = RequestedBurstRate * BurstRateModifier();
|
||||
if (rate < m_minimumDripRate * m_quantumsPerBurst)
|
||||
rate = m_minimumDripRate * m_quantumsPerBurst;
|
||||
|
||||
return (Int64) rate;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The speed limit of this bucket in bytes per second. This is the
|
||||
/// number of tokens that are added to the bucket per second
|
||||
/// number of tokens that are added to the bucket per quantum
|
||||
/// </summary>
|
||||
/// <remarks>Tokens are added to the bucket any time
|
||||
/// <seealso cref="RemoveTokens"/> is called, at the granularity of
|
||||
/// the system tick interval (typically around 15-22ms)</remarks>
|
||||
public int DripRate
|
||||
private Int64 m_dripRate;
|
||||
public Int64 RequestedDripRate
|
||||
{
|
||||
get { return tokensPerMS * 1000; }
|
||||
set
|
||||
{
|
||||
if (value == 0)
|
||||
tokensPerMS = 0;
|
||||
else
|
||||
{
|
||||
int bpms = (int)((float)value / 1000.0f);
|
||||
|
||||
if (bpms <= 0)
|
||||
tokensPerMS = 1; // 1 byte/ms is the minimum granularity
|
||||
else
|
||||
tokensPerMS = bpms;
|
||||
get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); }
|
||||
set {
|
||||
m_dripRate = (value < 0 ? 0 : value);
|
||||
m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst);
|
||||
m_totalDripRequest = m_dripRate;
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this,m_dripRate);
|
||||
}
|
||||
}
|
||||
|
||||
public Int64 DripRate
|
||||
{
|
||||
get {
|
||||
if (m_parent == null)
|
||||
return Math.Min(RequestedDripRate,TotalDripRequest);
|
||||
|
||||
double rate = (double)RequestedDripRate * m_parent.DripRateModifier();
|
||||
if (rate < m_minimumDripRate)
|
||||
rate = m_minimumDripRate;
|
||||
|
||||
return (Int64)rate;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The speed limit of this bucket in bytes per millisecond
|
||||
/// The current total of the requested maximum burst rates of
|
||||
/// this bucket's children buckets.
|
||||
/// </summary>
|
||||
public int DripPerMS
|
||||
private Int64 m_totalDripRequest;
|
||||
public Int64 TotalDripRequest
|
||||
{
|
||||
get { return tokensPerMS; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The number of bytes that can be sent at this moment. This is the
|
||||
/// current number of tokens in the bucket
|
||||
/// <remarks>If this bucket has a parent bucket that does not have
|
||||
/// enough tokens for a request, <seealso cref="RemoveTokens"/> will
|
||||
/// return false regardless of the content of this bucket</remarks>
|
||||
/// </summary>
|
||||
public int Content
|
||||
{
|
||||
get { return content; }
|
||||
get { return m_totalDripRequest; }
|
||||
set { m_totalDripRequest = value; }
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
|
@ -128,12 +169,76 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// zero if this bucket has no maximum capacity</param>
|
||||
/// <param name="dripRate">Rate that the bucket fills, in bytes per
|
||||
/// second. If zero, the bucket always remains full</param>
|
||||
public TokenBucket(TokenBucket parent, int maxBurst, int dripRate)
|
||||
public TokenBucket(TokenBucket parent, Int64 dripRate)
|
||||
{
|
||||
this.parent = parent;
|
||||
MaxBurst = maxBurst;
|
||||
DripRate = dripRate;
|
||||
lastDrip = Environment.TickCount & Int32.MaxValue;
|
||||
m_identifier = m_counter++;
|
||||
|
||||
Parent = parent;
|
||||
RequestedDripRate = dripRate;
|
||||
// TotalDripRequest = dripRate; // this will be overwritten when a child node registers
|
||||
// MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst);
|
||||
m_lastDrip = Environment.TickCount & Int32.MaxValue;
|
||||
}
|
||||
|
||||
#endregion Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Compute a modifier for the MaxBurst rate. This is 1.0, meaning
|
||||
/// no modification if the requested bandwidth is less than the
|
||||
/// max burst bandwidth all the way to the root of the throttle
|
||||
/// hierarchy. However, if any of the parents is over-booked, then
|
||||
/// the modifier will be less than 1.
|
||||
/// </summary>
|
||||
private double DripRateModifier()
|
||||
{
|
||||
Int64 driprate = DripRate;
|
||||
return driprate >= TotalDripRequest ? 1.0 : (double)driprate / (double)TotalDripRequest;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
private double BurstRateModifier()
|
||||
{
|
||||
// for now... burst rate is always m_quantumsPerBurst (constant)
|
||||
// larger than drip rate so the ratio of burst requests is the
|
||||
// same as the drip ratio
|
||||
return DripRateModifier();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register drip rate requested by a child of this throttle. Pass the
|
||||
/// changes up the hierarchy.
|
||||
/// </summary>
|
||||
public void RegisterRequest(TokenBucket child, Int64 request)
|
||||
{
|
||||
m_children[child] = request;
|
||||
// m_totalDripRequest = m_children.Values.Sum();
|
||||
|
||||
m_totalDripRequest = 0;
|
||||
foreach (KeyValuePair<TokenBucket, Int64> cref in m_children)
|
||||
m_totalDripRequest += cref.Value;
|
||||
|
||||
// Pass the new values up to the parent
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the rate requested by a child of this throttle. Pass the
|
||||
/// changes up the hierarchy.
|
||||
/// </summary>
|
||||
public void UnregisterRequest(TokenBucket child)
|
||||
{
|
||||
m_children.Remove(child);
|
||||
// m_totalDripRequest = m_children.Values.Sum();
|
||||
|
||||
m_totalDripRequest = 0;
|
||||
foreach (KeyValuePair<TokenBucket, Int64> cref in m_children)
|
||||
m_totalDripRequest += cref.Value;
|
||||
|
||||
// Pass the new values up to the parent
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -142,42 +247,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <param name="amount">Number of tokens to remove from the bucket</param>
|
||||
/// <returns>True if the requested number of tokens were removed from
|
||||
/// the bucket, otherwise false</returns>
|
||||
public bool RemoveTokens(int amount)
|
||||
public bool RemoveTokens(Int64 amount)
|
||||
{
|
||||
bool dummy;
|
||||
return RemoveTokens(amount, out dummy);
|
||||
// Deposit tokens for this interval
|
||||
Drip();
|
||||
|
||||
// If we have enough tokens then remove them and return
|
||||
if (m_tokenCount - amount >= 0)
|
||||
{
|
||||
// we don't have to remove from the parent, the drip rate is already
|
||||
// reflective of the drip rate limits in the parent
|
||||
m_tokenCount -= amount;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a given number of tokens from the bucket
|
||||
/// Deposit tokens into the bucket from a child bucket that did
|
||||
/// not use all of its available tokens
|
||||
/// </summary>
|
||||
/// <param name="amount">Number of tokens to remove from the bucket</param>
|
||||
/// <param name="dripSucceeded">True if tokens were added to the bucket
|
||||
/// during this call, otherwise false</param>
|
||||
/// <returns>True if the requested number of tokens were removed from
|
||||
/// the bucket, otherwise false</returns>
|
||||
public bool RemoveTokens(int amount, out bool dripSucceeded)
|
||||
private void Deposit(Int64 count)
|
||||
{
|
||||
if (maxBurst == 0)
|
||||
{
|
||||
dripSucceeded = true;
|
||||
return true;
|
||||
}
|
||||
m_tokenCount += count;
|
||||
|
||||
dripSucceeded = Drip();
|
||||
|
||||
if (content - amount >= 0)
|
||||
{
|
||||
if (parent != null && !parent.RemoveTokens(amount))
|
||||
return false;
|
||||
|
||||
content -= amount;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Deposit the overflow in the parent bucket, this is how we share
|
||||
// unused bandwidth
|
||||
Int64 burstrate = BurstRate;
|
||||
if (m_tokenCount > burstrate)
|
||||
m_tokenCount = burstrate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -186,37 +285,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// call to Drip
|
||||
/// </summary>
|
||||
/// <returns>True if tokens were added to the bucket, otherwise false</returns>
|
||||
public bool Drip()
|
||||
private void Drip()
|
||||
{
|
||||
if (tokensPerMS == 0)
|
||||
// This should never happen... means we are a leaf node and were created
|
||||
// with no drip rate...
|
||||
if (DripRate == 0)
|
||||
{
|
||||
content = maxBurst;
|
||||
return true;
|
||||
m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int now = Environment.TickCount & Int32.MaxValue;
|
||||
int deltaMS = now - lastDrip;
|
||||
|
||||
// Determine the interval over which we are adding tokens, never add
|
||||
// more than a single quantum of tokens
|
||||
Int32 now = Environment.TickCount & Int32.MaxValue;
|
||||
Int32 deltaMS = Math.Min(now - m_lastDrip, m_ticksPerQuantum);
|
||||
|
||||
m_lastDrip = now;
|
||||
|
||||
// This can be 0 in the very unusual case that the timer wrapped
|
||||
// It can be 0 if we try add tokens at a sub-tick rate
|
||||
if (deltaMS <= 0)
|
||||
{
|
||||
if (deltaMS < 0)
|
||||
lastDrip = now;
|
||||
return false;
|
||||
}
|
||||
return;
|
||||
|
||||
int dripAmount = deltaMS * tokensPerMS;
|
||||
|
||||
content = Math.Min(content + dripAmount, maxBurst);
|
||||
lastDrip = now;
|
||||
|
||||
if (dripAmount < 0 || content < 0)
|
||||
// sim has been idle for too long, integer has overflown
|
||||
// previous calculation is meaningless, let's put it at correct max
|
||||
content = maxBurst;
|
||||
|
||||
return true;
|
||||
}
|
||||
Deposit(deltaMS * DripRate / m_ticksPerQuantum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
private bool m_enabled = true;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
|
||||
|
@ -65,7 +66,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig meshConfig = source.Configs["Mesh"];
|
||||
if (meshConfig == null)
|
||||
return;
|
||||
|
||||
m_enabled = meshConfig.GetBoolean("ColladaMesh", true);
|
||||
}
|
||||
|
||||
public void AddRegion(Scene pScene)
|
||||
|
@ -101,16 +106,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
if(!m_enabled)
|
||||
return;
|
||||
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
// m_log.Info("[GETMESH]: /CAPS/" + capID);
|
||||
|
||||
caps.RegisterHandler("GetMesh",
|
||||
new RestHTTPHandler("GET", "/CAPS/" + capID,
|
||||
delegate(Hashtable m_dhttpMethod)
|
||||
{
|
||||
return ProcessGetMesh(m_dhttpMethod, agentID, caps);
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -56,6 +56,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
private Scene m_scene;
|
||||
// private IAssetService m_assetService;
|
||||
private bool m_dumpAssetsToFile = false;
|
||||
private bool m_enabled = true;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
|
||||
|
@ -67,7 +68,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig meshConfig = source.Configs["Mesh"];
|
||||
if (meshConfig == null)
|
||||
return;
|
||||
|
||||
m_enabled = meshConfig.GetBoolean("ColladaMesh", true);
|
||||
}
|
||||
|
||||
public void AddRegion(Scene pScene)
|
||||
|
@ -103,6 +108,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Assets
|
|||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
if(!m_enabled)
|
||||
return;
|
||||
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
// m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID);
|
||||
|
|
|
@ -34,13 +34,13 @@ using Nini.Config;
|
|||
using Nwc.XmlRpc;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Services.Connectors.Friends;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
|
||||
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
|
|
@ -33,7 +33,6 @@ using OpenMetaverse;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.Client;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
|
|
@ -78,11 +78,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
private Stream m_loadStream;
|
||||
|
||||
/// <summary>
|
||||
/// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things
|
||||
/// (I thought they weren't). We will need to bump the version number and perform this check on all
|
||||
/// subsequent IAR versions only
|
||||
/// Has the control file been loaded for this archive?
|
||||
/// </summary>
|
||||
protected bool m_controlFileLoaded = true;
|
||||
public bool ControlFileLoaded { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Do we want to enforce the check. IAR versions before 0.2 and 1.1 do not guarantee this order, so we can't
|
||||
/// enforce.
|
||||
/// </summary>
|
||||
public bool EnforceControlFileCheck { get; private set; }
|
||||
|
||||
protected bool m_assetsLoaded;
|
||||
protected bool m_inventoryNodesLoaded;
|
||||
|
||||
|
@ -131,6 +136,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
m_userInfo = userInfo;
|
||||
m_invPath = invPath;
|
||||
m_loadStream = loadStream;
|
||||
|
||||
// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things
|
||||
// (I thought they weren't). We will need to bump the version number and perform this check on all
|
||||
// subsequent IAR versions only
|
||||
ControlFileLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -471,16 +481,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
if (m_creatorIdForAssetId.ContainsKey(assetId))
|
||||
{
|
||||
string xmlData = Utils.BytesToString(data);
|
||||
SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
||||
foreach (SceneObjectPart sop in sog.Parts)
|
||||
List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
|
||||
|
||||
CoalescedSceneObjects coa = null;
|
||||
if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
|
||||
{
|
||||
if (sop.CreatorData == null || sop.CreatorData == "")
|
||||
{
|
||||
sop.CreatorID = m_creatorIdForAssetId[assetId];
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
|
||||
|
||||
sceneObjects.AddRange(coa.Objects);
|
||||
}
|
||||
else
|
||||
{
|
||||
sceneObjects.Add(SceneObjectSerializer.FromOriginalXmlFormat(xmlData));
|
||||
}
|
||||
|
||||
data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog));
|
||||
foreach (SceneObjectGroup sog in sceneObjects)
|
||||
foreach (SceneObjectPart sop in sog.Parts)
|
||||
if (sop.CreatorData == null || sop.CreatorData == "")
|
||||
sop.CreatorID = m_creatorIdForAssetId[assetId];
|
||||
|
||||
if (coa != null)
|
||||
data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa));
|
||||
else
|
||||
data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -508,7 +532,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="data"></param>
|
||||
protected void LoadControlFile(string path, byte[] data)
|
||||
public void LoadControlFile(string path, byte[] data)
|
||||
{
|
||||
XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data));
|
||||
XElement archiveElement = doc.Element("archive");
|
||||
|
@ -524,7 +548,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
majorVersion, MAX_MAJOR_VERSION));
|
||||
}
|
||||
|
||||
m_controlFileLoaded = true;
|
||||
ControlFileLoaded = true;
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
|
||||
}
|
||||
|
||||
|
@ -536,7 +560,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <param name="data"></param>
|
||||
protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data)
|
||||
{
|
||||
if (!m_controlFileLoaded)
|
||||
if (!ControlFileLoaded)
|
||||
throw new Exception(
|
||||
string.Format(
|
||||
"The IAR you are trying to load does not list {0} before {1}. Aborting load",
|
||||
|
@ -583,7 +607,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <param name="data"></param>
|
||||
protected void LoadAssetFile(string path, byte[] data)
|
||||
{
|
||||
if (!m_controlFileLoaded)
|
||||
if (!ControlFileLoaded)
|
||||
throw new Exception(
|
||||
string.Format(
|
||||
"The IAR you are trying to load does not list {0} before {1}. Aborting load",
|
||||
|
|
|
@ -394,12 +394,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
if (options.ContainsKey("profile"))
|
||||
{
|
||||
majorVersion = 1;
|
||||
minorVersion = 0;
|
||||
minorVersion = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
majorVersion = 0;
|
||||
minorVersion = 1;
|
||||
minorVersion = 2;
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion);
|
||||
|
|
|
@ -68,17 +68,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
|
||||
FirstName = "Mr",
|
||||
LastName = "Tiddles" };
|
||||
|
||||
protected UserAccount m_uaLL1
|
||||
= new UserAccount {
|
||||
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
|
||||
FirstName = "Lord",
|
||||
LastName = "Lucan" };
|
||||
|
||||
protected UserAccount m_uaLL2
|
||||
= new UserAccount {
|
||||
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"),
|
||||
FirstName = "Lord",
|
||||
LastName = "Lucan" };
|
||||
|
||||
protected string m_item1Name = "Ray Gun Item";
|
||||
protected string m_coaItemName = "Coalesced Item";
|
||||
|
||||
[SetUp]
|
||||
public virtual void SetUp()
|
||||
|
@ -97,38 +101,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
|
||||
// Create asset
|
||||
SceneObjectGroup object1;
|
||||
SceneObjectPart part1;
|
||||
{
|
||||
string partName = "Ray Gun Object";
|
||||
// Create scene object asset
|
||||
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
||||
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
|
||||
Vector3 groupPosition = new Vector3(10, 20, 30);
|
||||
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
|
||||
Vector3 offsetPosition = new Vector3(5, 10, 15);
|
||||
|
||||
part1
|
||||
= new SceneObjectPart(
|
||||
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
|
||||
part1.Name = partName;
|
||||
|
||||
object1 = new SceneObjectGroup(part1);
|
||||
scene.AddNewSceneObject(object1, false);
|
||||
}
|
||||
SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50);
|
||||
|
||||
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
||||
scene.AssetService.Store(asset1);
|
||||
|
||||
// Create item
|
||||
// Create scene object item
|
||||
InventoryItemBase item1 = new InventoryItemBase();
|
||||
item1.Name = m_item1Name;
|
||||
item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
||||
|
@ -139,8 +127,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
|
||||
scene.AddInventoryItem(item1);
|
||||
|
||||
// Create coalesced objects asset
|
||||
SceneObjectGroup cobj1 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120);
|
||||
cobj1.AbsolutePosition = new Vector3(15, 30, 45);
|
||||
|
||||
SceneObjectGroup cobj2 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140);
|
||||
cobj2.AbsolutePosition = new Vector3(25, 50, 75);
|
||||
|
||||
CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2);
|
||||
|
||||
AssetBase coaAsset = AssetHelpers.CreateAsset(0x160, coa);
|
||||
scene.AssetService.Store(coaAsset);
|
||||
|
||||
// Create coalesced objects inventory item
|
||||
InventoryItemBase coaItem = new InventoryItemBase();
|
||||
coaItem.Name = m_coaItemName;
|
||||
coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180");
|
||||
coaItem.AssetID = coaAsset.FullID;
|
||||
coaItem.GroupID = UUID.Random();
|
||||
coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID;
|
||||
coaItem.Owner = m_uaLL1.PrincipalID;
|
||||
coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
|
||||
scene.AddInventoryItem(coaItem);
|
||||
|
||||
archiverModule.ArchiveInventory(
|
||||
Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, m_item1Name, "hampshire", archiveWriteStream);
|
||||
Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream);
|
||||
|
||||
m_iarStreamBytes = archiveWriteStream.ToArray();
|
||||
}
|
||||
|
|
|
@ -62,10 +62,67 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
m_archiverModule = new InventoryArchiverModule();
|
||||
|
||||
m_scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLoadCoalesecedItem()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password");
|
||||
m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream);
|
||||
|
||||
InventoryItemBase coaItem
|
||||
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName);
|
||||
|
||||
Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1");
|
||||
|
||||
string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID);
|
||||
|
||||
CoalescedSceneObjects coa;
|
||||
bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa);
|
||||
|
||||
Assert.That(readResult, Is.True);
|
||||
Assert.That(coa.Count, Is.EqualTo(2));
|
||||
|
||||
List<SceneObjectGroup> coaObjects = coa.Objects;
|
||||
Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000120")));
|
||||
Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(new Vector3(15, 30, 45)));
|
||||
|
||||
Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140")));
|
||||
Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that the IAR has the required files in the right order.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// At the moment, the only thing that matters is that the control file is the very first one.
|
||||
/// </remarks>
|
||||
[Test]
|
||||
public void TestOrder()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes);
|
||||
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
||||
string filePath;
|
||||
TarArchiveReader.TarEntryType tarEntryType;
|
||||
|
||||
byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
|
||||
Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
|
||||
|
||||
InventoryArchiveReadRequest iarr
|
||||
= new InventoryArchiveReadRequest(null, null, null, (Stream)null, false);
|
||||
iarr.LoadControlFile(filePath, data);
|
||||
|
||||
Assert.That(iarr.ControlFileLoaded, Is.True);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive
|
||||
/// (subject to change since there is no fixed format yet).
|
||||
|
@ -84,24 +141,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
|
||||
|
||||
// Create asset
|
||||
SceneObjectGroup object1;
|
||||
SceneObjectPart part1;
|
||||
{
|
||||
string partName = "My Little Dog Object";
|
||||
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
||||
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
|
||||
Vector3 groupPosition = new Vector3(10, 20, 30);
|
||||
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
|
||||
Vector3 offsetPosition = new Vector3(5, 10, 15);
|
||||
|
||||
part1
|
||||
= new SceneObjectPart(
|
||||
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
|
||||
part1.Name = partName;
|
||||
|
||||
object1 = new SceneObjectGroup(part1);
|
||||
m_scene.AddNewSceneObject(object1, false);
|
||||
}
|
||||
SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50);
|
||||
|
||||
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
// Create user
|
||||
|
@ -180,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
|
||||
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
|
||||
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
|
||||
|
@ -223,7 +223,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
|
||||
SerialiserModule serialiserModule = new SerialiserModule();
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
|
||||
|
||||
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password");
|
||||
|
@ -248,7 +248,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
// Create user
|
||||
|
@ -327,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
|
||||
|
||||
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
||||
|
@ -394,7 +394,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
TestHelper.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
|
||||
|
||||
string folder1ExistingName = "a";
|
||||
|
@ -445,7 +445,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
|
||||
|
||||
string folder1ExistingName = "a";
|
||||
|
|
|
@ -75,6 +75,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
if (name == Name)
|
||||
{
|
||||
m_Enabled = true;
|
||||
|
||||
InitialiseCommon(source);
|
||||
|
||||
m_log.InfoFormat("[HG INVENTORY ACCESS MODULE]: {0} enabled.", Name);
|
||||
|
||||
IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
|
||||
|
@ -129,35 +132,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
}
|
||||
|
||||
///
|
||||
/// DeleteToInventory
|
||||
/// Used in DeleteToInventory
|
||||
///
|
||||
public override UUID DeleteToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient)
|
||||
protected override void ExportAsset(UUID agentID, UUID assetID)
|
||||
{
|
||||
UUID ret = UUID.Zero;
|
||||
|
||||
// HACK: Only works for lists of length one.
|
||||
// Intermediate version, just to make things compile
|
||||
foreach (SceneObjectGroup g in objectGroups)
|
||||
ret = DeleteToInventory(action, folderID, g, remoteClient);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// DO NOT OVERRIDE THE BASE METHOD
|
||||
public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
|
||||
SceneObjectGroup objectGroup, IClientAPI remoteClient)
|
||||
{
|
||||
UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient);
|
||||
|
||||
if (!assetID.Equals(UUID.Zero))
|
||||
{
|
||||
if (remoteClient != null)
|
||||
UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
|
||||
}
|
||||
UploadInventoryItem(agentID, assetID, "", 0);
|
||||
else
|
||||
m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
|
||||
|
||||
return assetID;
|
||||
}
|
||||
|
||||
///
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
}
|
||||
}
|
||||
|
||||
public bool CoalesceMultipleObjectsToInventory { get; set; }
|
||||
|
||||
#region INonSharedRegionModule
|
||||
|
||||
|
@ -87,11 +88,29 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
if (name == Name)
|
||||
{
|
||||
m_Enabled = true;
|
||||
|
||||
InitialiseCommon(source);
|
||||
|
||||
m_log.InfoFormat("[INVENTORY ACCESS MODULE]: {0} enabled.", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Common module config for both this and descendant classes.
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
protected virtual void InitialiseCommon(IConfigSource source)
|
||||
{
|
||||
IConfig inventoryConfig = source.Configs["Inventory"];
|
||||
|
||||
if (inventoryConfig != null)
|
||||
CoalesceMultipleObjectsToInventory
|
||||
= inventoryConfig.GetBoolean("CoalesceMultipleObjectsToInventory", true);
|
||||
else
|
||||
CoalesceMultipleObjectsToInventory = true;
|
||||
}
|
||||
|
||||
public virtual void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
@ -195,43 +214,63 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return UUID.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a scene object from a scene and place in the given avatar's inventory.
|
||||
/// Returns the UUID of the newly created asset.
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="objectGroup"></param>
|
||||
/// <param name="remoteClient"> </param>
|
||||
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
|
||||
public virtual UUID CopyToInventory(DeRezAction action, UUID folderID,
|
||||
List<SceneObjectGroup> objectGroups, IClientAPI remoteClient)
|
||||
{
|
||||
UUID ret = UUID.Zero;
|
||||
Dictionary<UUID, List<SceneObjectGroup>> bundlesToCopy = new Dictionary<UUID, List<SceneObjectGroup>>();
|
||||
|
||||
if (CoalesceMultipleObjectsToInventory)
|
||||
{
|
||||
// The following code groups the SOG's by owner. No objects
|
||||
// belonging to different people can be coalesced, for obvious
|
||||
// reasons.
|
||||
Dictionary<UUID, List<SceneObjectGroup>> deletes =
|
||||
new Dictionary<UUID, List<SceneObjectGroup>>();
|
||||
|
||||
foreach (SceneObjectGroup g in objectGroups)
|
||||
{
|
||||
if (!deletes.ContainsKey(g.OwnerID))
|
||||
deletes[g.OwnerID] = new List<SceneObjectGroup>();
|
||||
if (!bundlesToCopy.ContainsKey(g.OwnerID))
|
||||
bundlesToCopy[g.OwnerID] = new List<SceneObjectGroup>();
|
||||
|
||||
deletes[g.OwnerID].Add(g);
|
||||
bundlesToCopy[g.OwnerID].Add(g);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we don't want to coalesce then put every object in its own bundle.
|
||||
foreach (SceneObjectGroup g in objectGroups)
|
||||
{
|
||||
List<SceneObjectGroup> bundle = new List<SceneObjectGroup>();
|
||||
bundle.Add(g);
|
||||
bundlesToCopy[g.UUID] = bundle;
|
||||
}
|
||||
}
|
||||
|
||||
// This is pethod scoped and will be returned. It will be the
|
||||
// This is method scoped and will be returned. It will be the
|
||||
// last created asset id
|
||||
UUID assetID = UUID.Zero;
|
||||
|
||||
// Each iteration is really a separate asset being created,
|
||||
// with distinct destinations as well.
|
||||
foreach (List<SceneObjectGroup> objlist in deletes.Values)
|
||||
foreach (List<SceneObjectGroup> bundle in bundlesToCopy.Values)
|
||||
assetID = CopyBundleToInventory(action, folderID, bundle, remoteClient);
|
||||
|
||||
return assetID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy a bundle of objects to inventory. If there is only one object, then this will create an object
|
||||
/// item. If there are multiple objects then these will be saved as a single coalesced item.
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="objlist"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <returns></returns>
|
||||
protected UUID CopyBundleToInventory(
|
||||
DeRezAction action, UUID folderID, List<SceneObjectGroup> objlist, IClientAPI remoteClient)
|
||||
{
|
||||
Dictionary<UUID, string> xmlStrings =
|
||||
new Dictionary<UUID, string>();
|
||||
UUID assetID = UUID.Zero;
|
||||
|
||||
CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
|
||||
Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
|
||||
|
||||
foreach (SceneObjectGroup objectGroup in objlist)
|
||||
{
|
||||
|
@ -240,12 +279,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
? 250
|
||||
: objectGroup.AbsolutePosition.X)
|
||||
,
|
||||
(objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
|
||||
(objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize)
|
||||
? 250
|
||||
: objectGroup.AbsolutePosition.X,
|
||||
: objectGroup.AbsolutePosition.Y,
|
||||
objectGroup.AbsolutePosition.Z);
|
||||
|
||||
Vector3 originalPosition = objectGroup.AbsolutePosition;
|
||||
originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
|
||||
|
||||
objectGroup.AbsolutePosition = inventoryStoredPosition;
|
||||
|
||||
|
@ -260,208 +299,36 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
objectGroup.RootPart.NextOwnerMask |=
|
||||
(uint)PermissionMask.Move;
|
||||
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
|
||||
|
||||
objectGroup.AbsolutePosition = originalPosition;
|
||||
|
||||
xmlStrings[objectGroup.UUID] = sceneObjectXml;
|
||||
coa.Add(objectGroup);
|
||||
}
|
||||
|
||||
string itemXml;
|
||||
|
||||
if (objlist.Count > 1)
|
||||
{
|
||||
float minX, minY, minZ;
|
||||
float maxX, maxY, maxZ;
|
||||
|
||||
Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist,
|
||||
out minX, out maxX, out minY, out maxY,
|
||||
out minZ, out maxZ);
|
||||
|
||||
// CreateWrapper
|
||||
XmlDocument itemDoc = new XmlDocument();
|
||||
XmlElement root = itemDoc.CreateElement("", "CoalescedObject", "");
|
||||
itemDoc.AppendChild(root);
|
||||
|
||||
// Embed the offsets into the group XML
|
||||
for ( int i = 0 ; i < objlist.Count ; i++ )
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
SceneObjectGroup g = objlist[i];
|
||||
doc.LoadXml(xmlStrings[g.UUID]);
|
||||
XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup");
|
||||
e.SetAttribute("offsetx", offsets[i].X.ToString());
|
||||
e.SetAttribute("offsety", offsets[i].Y.ToString());
|
||||
e.SetAttribute("offsetz", offsets[i].Z.ToString());
|
||||
|
||||
XmlNode objectNode = itemDoc.ImportNode(e, true);
|
||||
root.AppendChild(objectNode);
|
||||
}
|
||||
|
||||
float sizeX = maxX - minX;
|
||||
float sizeY = maxY - minY;
|
||||
float sizeZ = maxZ - minZ;
|
||||
|
||||
root.SetAttribute("x", sizeX.ToString());
|
||||
root.SetAttribute("y", sizeY.ToString());
|
||||
root.SetAttribute("z", sizeZ.ToString());
|
||||
|
||||
itemXml = itemDoc.InnerXml;
|
||||
}
|
||||
itemXml = CoalescedSceneObjectsSerializer.ToXml(coa);
|
||||
else
|
||||
{
|
||||
itemXml = xmlStrings[objlist[0].UUID];
|
||||
}
|
||||
itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]);
|
||||
|
||||
// Get the user info of the item destination
|
||||
//
|
||||
UUID userID = UUID.Zero;
|
||||
// Restore the position of each group now that it has been stored to inventory.
|
||||
foreach (SceneObjectGroup objectGroup in objlist)
|
||||
objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];
|
||||
|
||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy ||
|
||||
action == DeRezAction.SaveToExistingUserInventoryItem)
|
||||
{
|
||||
// Take or take copy require a taker
|
||||
// Saving changes requires a local user
|
||||
//
|
||||
if (remoteClient == null)
|
||||
InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID);
|
||||
if (item == null)
|
||||
return UUID.Zero;
|
||||
|
||||
userID = remoteClient.AgentId;
|
||||
}
|
||||
else
|
||||
{
|
||||
// All returns / deletes go to the object owner
|
||||
//
|
||||
|
||||
userID = objlist[0].RootPart.OwnerID;
|
||||
}
|
||||
|
||||
if (userID == UUID.Zero) // Can't proceed
|
||||
{
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
// If we're returning someone's item, it goes back to the
|
||||
// owner's Lost And Found folder.
|
||||
// Delete is treated like return in this case
|
||||
// Deleting your own items makes them go to trash
|
||||
//
|
||||
|
||||
InventoryFolderBase folder = null;
|
||||
InventoryItemBase item = null;
|
||||
|
||||
if (DeRezAction.SaveToExistingUserInventoryItem == action)
|
||||
{
|
||||
item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID);
|
||||
item = m_Scene.InventoryService.GetItem(item);
|
||||
|
||||
//item = userInfo.RootFolder.FindItem(
|
||||
// objectGroup.RootPart.FromUserInventoryItemID);
|
||||
|
||||
if (null == item)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
|
||||
objlist[0].Name, objlist[0].UUID);
|
||||
return UUID.Zero;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Folder magic
|
||||
//
|
||||
if (action == DeRezAction.Delete)
|
||||
{
|
||||
// Deleting someone else's item
|
||||
//
|
||||
if (remoteClient == null ||
|
||||
objlist[0].OwnerID != remoteClient.AgentId)
|
||||
{
|
||||
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
|
||||
}
|
||||
}
|
||||
else if (action == DeRezAction.Return)
|
||||
{
|
||||
|
||||
// Dump to lost + found unconditionally
|
||||
//
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
|
||||
if (folderID == UUID.Zero && folder == null)
|
||||
{
|
||||
if (action == DeRezAction.Delete)
|
||||
{
|
||||
// Deletes go to trash by default
|
||||
//
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (remoteClient == null ||
|
||||
objlist[0].OwnerID != remoteClient.AgentId)
|
||||
{
|
||||
// Taking copy of another person's item. Take to
|
||||
// Objects folder.
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Catch all. Use lost & found
|
||||
//
|
||||
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Override and put into where it came from, if it came
|
||||
// from anywhere in inventory
|
||||
//
|
||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
||||
{
|
||||
if (objlist[0].RootPart.FromFolderID != UUID.Zero)
|
||||
{
|
||||
InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID);
|
||||
folder = m_Scene.InventoryService.GetFolder(f);
|
||||
}
|
||||
}
|
||||
|
||||
if (folder == null) // None of the above
|
||||
{
|
||||
folder = new InventoryFolderBase(folderID);
|
||||
|
||||
if (folder == null) // Nowhere to put it
|
||||
{
|
||||
return UUID.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
item = new InventoryItemBase();
|
||||
// Can't know creator is the same, so null it in inventory
|
||||
if (objlist.Count > 1)
|
||||
item.CreatorId = UUID.Zero.ToString();
|
||||
else
|
||||
item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
|
||||
item.ID = UUID.Random();
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
item.Folder = folder.ID;
|
||||
item.Owner = userID;
|
||||
if (objlist.Count > 1)
|
||||
{
|
||||
item.CreatorId = UUID.Zero.ToString();
|
||||
item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
|
||||
item.SaleType = objlist[0].RootPart.ObjectSaleType;
|
||||
item.SalePrice = objlist[0].RootPart.SalePrice;
|
||||
}
|
||||
}
|
||||
|
||||
AssetBase asset = CreateAsset(
|
||||
objlist[0].GetPartName(objlist[0].RootPart.LocalId),
|
||||
|
@ -470,59 +337,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
Utils.StringToBytes(itemXml),
|
||||
objlist[0].OwnerID.ToString());
|
||||
m_Scene.AssetService.Store(asset);
|
||||
|
||||
item.AssetID = asset.FullID;
|
||||
assetID = asset.FullID;
|
||||
|
||||
if (DeRezAction.SaveToExistingUserInventoryItem == action)
|
||||
{
|
||||
item.AssetID = asset.FullID;
|
||||
m_Scene.InventoryService.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.AssetID = asset.FullID;
|
||||
|
||||
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7;
|
||||
foreach (SceneObjectGroup grp in objlist)
|
||||
effectivePerms &= grp.GetEffectivePermissions();
|
||||
effectivePerms |= (uint)PermissionMask.Move;
|
||||
|
||||
if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
uint perms = effectivePerms;
|
||||
uint nextPerms = (perms & 7) << 13;
|
||||
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
||||
perms &= ~(uint)PermissionMask.Copy;
|
||||
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
||||
perms &= ~(uint)PermissionMask.Transfer;
|
||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~(uint)PermissionMask.Modify;
|
||||
|
||||
item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions = item.BasePermissions;
|
||||
item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask;
|
||||
item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask;
|
||||
|
||||
// Magic number badness. Maybe this deserves an enum.
|
||||
// bit 4 (16) is the "Slam" bit, it means treat as passed
|
||||
// and apply next owner perms on rez
|
||||
item.CurrentPermissions |= 16; // Slam!
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BasePermissions = effectivePerms;
|
||||
item.CurrentPermissions = effectivePerms;
|
||||
item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms;
|
||||
item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms;
|
||||
item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms;
|
||||
|
||||
item.CurrentPermissions &=
|
||||
((uint)PermissionMask.Copy |
|
||||
(uint)PermissionMask.Transfer |
|
||||
(uint)PermissionMask.Modify |
|
||||
(uint)PermissionMask.Move |
|
||||
7); // Preserve folded permissions
|
||||
}
|
||||
AddPermissions(item, objlist[0], objlist, remoteClient);
|
||||
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
item.Description = asset.Description;
|
||||
|
@ -544,16 +369,230 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is a hook to do some per-asset post-processing for subclasses that need that
|
||||
ExportAsset(remoteClient.AgentId, assetID);
|
||||
|
||||
return assetID;
|
||||
}
|
||||
|
||||
protected virtual void ExportAsset(UUID agentID, UUID assetID)
|
||||
{
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add relevant permissions for an object to the item.
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="so"></param>
|
||||
/// <param name="objsForEffectivePermissions"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <returns></returns>
|
||||
protected InventoryItemBase AddPermissions(
|
||||
InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions,
|
||||
IClientAPI remoteClient)
|
||||
{
|
||||
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7;
|
||||
foreach (SceneObjectGroup grp in objsForEffectivePermissions)
|
||||
effectivePerms &= grp.GetEffectivePermissions();
|
||||
effectivePerms |= (uint)PermissionMask.Move;
|
||||
|
||||
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
uint perms = effectivePerms;
|
||||
uint nextPerms = (perms & 7) << 13;
|
||||
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
||||
perms &= ~(uint)PermissionMask.Copy;
|
||||
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
||||
perms &= ~(uint)PermissionMask.Transfer;
|
||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~(uint)PermissionMask.Modify;
|
||||
|
||||
item.BasePermissions = perms & so.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions = item.BasePermissions;
|
||||
item.NextPermissions = perms & so.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
|
||||
item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
|
||||
|
||||
// Magic number badness. Maybe this deserves an enum.
|
||||
// bit 4 (16) is the "Slam" bit, it means treat as passed
|
||||
// and apply next owner perms on rez
|
||||
item.CurrentPermissions |= 16; // Slam!
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BasePermissions = effectivePerms;
|
||||
item.CurrentPermissions = effectivePerms;
|
||||
item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms;
|
||||
item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms;
|
||||
item.GroupPermissions = so.RootPart.GroupMask & effectivePerms;
|
||||
|
||||
item.CurrentPermissions &=
|
||||
((uint)PermissionMask.Copy |
|
||||
(uint)PermissionMask.Transfer |
|
||||
(uint)PermissionMask.Modify |
|
||||
(uint)PermissionMask.Move |
|
||||
7); // Preserve folded permissions
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an item using details for the given scene object.
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="so"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <returns></returns>
|
||||
protected InventoryItemBase CreateItemForObject(
|
||||
DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID)
|
||||
{
|
||||
// Get the user info of the item destination
|
||||
//
|
||||
UUID userID = UUID.Zero;
|
||||
|
||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy ||
|
||||
action == DeRezAction.SaveToExistingUserInventoryItem)
|
||||
{
|
||||
// Take or take copy require a taker
|
||||
// Saving changes requires a local user
|
||||
//
|
||||
if (remoteClient == null)
|
||||
return null;
|
||||
|
||||
userID = remoteClient.AgentId;
|
||||
}
|
||||
else
|
||||
{
|
||||
// All returns / deletes go to the object owner
|
||||
//
|
||||
userID = so.RootPart.OwnerID;
|
||||
}
|
||||
|
||||
if (userID == UUID.Zero) // Can't proceed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// If we're returning someone's item, it goes back to the
|
||||
// owner's Lost And Found folder.
|
||||
// Delete is treated like return in this case
|
||||
// Deleting your own items makes them go to trash
|
||||
//
|
||||
|
||||
InventoryFolderBase folder = null;
|
||||
InventoryItemBase item = null;
|
||||
|
||||
if (DeRezAction.SaveToExistingUserInventoryItem == action)
|
||||
{
|
||||
item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID);
|
||||
item = m_Scene.InventoryService.GetItem(item);
|
||||
|
||||
//item = userInfo.RootFolder.FindItem(
|
||||
// objectGroup.RootPart.FromUserInventoryItemID);
|
||||
|
||||
if (null == item)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
|
||||
so.Name, so.UUID);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Folder magic
|
||||
//
|
||||
if (action == DeRezAction.Delete)
|
||||
{
|
||||
// Deleting someone else's item
|
||||
//
|
||||
if (remoteClient == null ||
|
||||
so.OwnerID != remoteClient.AgentId)
|
||||
{
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
|
||||
}
|
||||
}
|
||||
else if (action == DeRezAction.Return)
|
||||
{
|
||||
// Dump to lost + found unconditionally
|
||||
//
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
|
||||
if (folderID == UUID.Zero && folder == null)
|
||||
{
|
||||
if (action == DeRezAction.Delete)
|
||||
{
|
||||
// Deletes go to trash by default
|
||||
//
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (remoteClient == null || so.OwnerID != remoteClient.AgentId)
|
||||
{
|
||||
// Taking copy of another person's item. Take to
|
||||
// Objects folder.
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Catch all. Use lost & found
|
||||
//
|
||||
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Override and put into where it came from, if it came
|
||||
// from anywhere in inventory
|
||||
//
|
||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
||||
{
|
||||
if (so.RootPart.FromFolderID != UUID.Zero)
|
||||
{
|
||||
InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID);
|
||||
folder = m_Scene.InventoryService.GetFolder(f);
|
||||
}
|
||||
}
|
||||
|
||||
if (folder == null) // None of the above
|
||||
{
|
||||
folder = new InventoryFolderBase(folderID);
|
||||
|
||||
if (folder == null) // Nowhere to put it
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
item = new InventoryItemBase();
|
||||
item.ID = UUID.Random();
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
item.Folder = folder.ID;
|
||||
item.Owner = userID;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rez an object into the scene from the user's inventory
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing
|
||||
/// things to the scene. The caller should be doing that, I think.
|
||||
/// </remarks>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="RayEnd"></param>
|
||||
|
@ -570,21 +609,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
|
||||
bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
|
||||
{
|
||||
// Work out position details
|
||||
byte bRayEndIsIntersection = (byte)0;
|
||||
|
||||
if (RayEndIsIntersection)
|
||||
{
|
||||
bRayEndIsIntersection = (byte)1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bRayEndIsIntersection = (byte)0;
|
||||
}
|
||||
// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID);
|
||||
|
||||
byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
|
||||
Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);
|
||||
|
||||
|
||||
Vector3 pos = m_Scene.GetNewRezLocation(
|
||||
RayStart, RayEnd, RayTargetID, Quaternion.Identity,
|
||||
BypassRayCast, bRayEndIsIntersection, true, scale, false);
|
||||
|
@ -668,9 +696,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
itemId, n.OuterXml);
|
||||
objlist.Add(g);
|
||||
XmlElement el = (XmlElement)n;
|
||||
float x = Convert.ToSingle(el.GetAttribute("offsetx"));
|
||||
float y = Convert.ToSingle(el.GetAttribute("offsety"));
|
||||
float z = Convert.ToSingle(el.GetAttribute("offsetz"));
|
||||
|
||||
string rawX = el.GetAttribute("offsetx");
|
||||
string rawY = el.GetAttribute("offsety");
|
||||
string rawZ = el.GetAttribute("offsetz");
|
||||
//
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>",
|
||||
// g.Name, rawX, rawY, rawZ);
|
||||
|
||||
float x = Convert.ToSingle(rawX);
|
||||
float y = Convert.ToSingle(rawY);
|
||||
float z = Convert.ToSingle(rawZ);
|
||||
veclist.Add(new Vector3(x, y, z));
|
||||
}
|
||||
}
|
||||
|
@ -762,10 +799,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
// affect the name stored in the serialization, transfer
|
||||
// the correct name from the inventory to the
|
||||
// object itself before we rez.
|
||||
//
|
||||
// Only do these for the first object if we are rezzing a coalescence.
|
||||
if (i == 0)
|
||||
{
|
||||
rootPart.Name = item.Name;
|
||||
rootPart.Description = item.Description;
|
||||
rootPart.ObjectSaleType = item.SaleType;
|
||||
rootPart.SalePrice = item.SalePrice;
|
||||
}
|
||||
|
||||
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
||||
if ((rootPart.OwnerID != item.Owner) ||
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
* 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.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Serialization;
|
||||
using OpenSim.Framework.Serialization.External;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
|
||||
using OpenSim.Region.CoreModules.Framework.InventoryAccess;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
using OpenSim.Tests.Common.Setup;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class InventoryAccessModuleTests
|
||||
{
|
||||
protected TestScene m_scene;
|
||||
protected BasicInventoryAccessModule m_iam;
|
||||
protected UUID m_userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
||||
protected TestClient m_tc;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
m_iam = new BasicInventoryAccessModule();
|
||||
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam);
|
||||
|
||||
// Create user
|
||||
string userFirstName = "Jock";
|
||||
string userLastName = "Stirrup";
|
||||
string userPassword = "troll";
|
||||
UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword);
|
||||
|
||||
AgentCircuitData acd = new AgentCircuitData();
|
||||
acd.AgentID = m_userId;
|
||||
m_tc = new TestClient(acd, m_scene);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRezCoalescedObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// Create asset
|
||||
SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20);
|
||||
object1.AbsolutePosition = new Vector3(15, 30, 45);
|
||||
|
||||
SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40);
|
||||
object2.AbsolutePosition = new Vector3(25, 50, 75);
|
||||
|
||||
CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2);
|
||||
|
||||
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, coa);
|
||||
m_scene.AssetService.Store(asset1);
|
||||
|
||||
// Create item
|
||||
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
|
||||
string item1Name = "My Little Dog";
|
||||
InventoryItemBase item1 = new InventoryItemBase();
|
||||
item1.Name = item1Name;
|
||||
item1.AssetID = asset1.FullID;
|
||||
item1.ID = item1Id;
|
||||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
m_scene.AddInventoryItem(item1);
|
||||
|
||||
SceneObjectGroup so
|
||||
= m_iam.RezObject(
|
||||
m_tc, item1Id, new Vector3(100, 100, 100), Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
|
||||
|
||||
Assert.That(so, Is.Not.Null);
|
||||
|
||||
Assert.That(m_scene.SceneGraph.GetTotalObjectsCount(), Is.EqualTo(2));
|
||||
|
||||
SceneObjectPart retrievedObj1Part = m_scene.GetSceneObjectPart(object1.Name);
|
||||
Assert.That(retrievedObj1Part, Is.Null);
|
||||
|
||||
retrievedObj1Part = m_scene.GetSceneObjectPart(item1.Name);
|
||||
Assert.That(retrievedObj1Part, Is.Not.Null);
|
||||
Assert.That(retrievedObj1Part.Name, Is.EqualTo(item1.Name));
|
||||
|
||||
// Bottom of coalescence is placed on ground, hence we end up with 100.5 rather than 85 since the bottom
|
||||
// object is unit square.
|
||||
Assert.That(retrievedObj1Part.AbsolutePosition, Is.EqualTo(new Vector3(95, 90, 100.5f)));
|
||||
|
||||
SceneObjectPart retrievedObj2Part = m_scene.GetSceneObjectPart(object2.Name);
|
||||
Assert.That(retrievedObj2Part, Is.Not.Null);
|
||||
Assert.That(retrievedObj2Part.Name, Is.EqualTo(object2.Name));
|
||||
Assert.That(retrievedObj2Part.AbsolutePosition, Is.EqualTo(new Vector3(105, 110, 130.5f)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRezObject()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// Create asset
|
||||
SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40);
|
||||
|
||||
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
||||
m_scene.AssetService.Store(asset1);
|
||||
|
||||
// Create item
|
||||
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
|
||||
string item1Name = "My Little Dog";
|
||||
InventoryItemBase item1 = new InventoryItemBase();
|
||||
item1.Name = item1Name;
|
||||
item1.AssetID = asset1.FullID;
|
||||
item1.ID = item1Id;
|
||||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
m_scene.AddInventoryItem(item1);
|
||||
|
||||
SceneObjectGroup so
|
||||
= m_iam.RezObject(
|
||||
m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
|
||||
|
||||
Assert.That(so, Is.Not.Null);
|
||||
|
||||
SceneObjectPart retrievedPart = m_scene.GetSceneObjectPart(so.UUID);
|
||||
Assert.That(retrievedPart, Is.Not.Null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,8 +29,10 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Security;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
@ -100,8 +102,24 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
|
||||
public HttpRequestModule()
|
||||
{
|
||||
ServicePointManager.ServerCertificateValidationCallback +=ValidateServerCertificate;
|
||||
}
|
||||
|
||||
public static bool ValidateServerCertificate(
|
||||
object sender,
|
||||
X509Certificate certificate,
|
||||
X509Chain chain,
|
||||
SslPolicyErrors sslPolicyErrors)
|
||||
{
|
||||
HttpWebRequest Request = (HttpWebRequest)sender;
|
||||
|
||||
if (Request.Headers.Get("NoVerifyCert") != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return chain.Build(new X509Certificate2(certificate));
|
||||
}
|
||||
#region IHttpRequestModule Members
|
||||
|
||||
public UUID MakeHttpRequest(string url, string parameters, string body)
|
||||
|
@ -141,8 +159,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
break;
|
||||
|
||||
case (int)HttpRequestConstants.HTTP_VERIFY_CERT:
|
||||
|
||||
// TODO implement me
|
||||
htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
* Not sure how important ordering is is here - the next first
|
||||
* one completed in the list is returned, based soley on its list
|
||||
* position, not the order in which the request was started or
|
||||
* finsihed. I thought about setting up a queue for this, but
|
||||
* finished. I thought about setting up a queue for this, but
|
||||
* it will need some refactoring and this works 'enough' right now
|
||||
*/
|
||||
|
||||
|
@ -282,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
public string HttpMethod = "GET";
|
||||
public string HttpMIMEType = "text/plain;charset=utf-8";
|
||||
public int HttpTimeout;
|
||||
// public bool HttpVerifyCert = true; // not implemented
|
||||
public bool HttpVerifyCert = true;
|
||||
private Thread httpThread;
|
||||
|
||||
// Request info
|
||||
|
@ -344,6 +361,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
Request.Method = HttpMethod;
|
||||
Request.ContentType = HttpMIMEType;
|
||||
|
||||
if(!HttpVerifyCert)
|
||||
{
|
||||
// We could hijack Connection Group Name to identify
|
||||
// a desired security exception. But at the moment we'll use a dummy header instead.
|
||||
// Request.ConnectionGroupName = "NoVerify";
|
||||
Request.Headers.Add("NoVerifyCert", "true");
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// Request.ConnectionGroupName="Verify";
|
||||
// }
|
||||
if (proxyurl != null && proxyurl.Length > 0)
|
||||
{
|
||||
if (proxyexcepts != null && proxyexcepts.Length > 0)
|
||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -31,9 +31,8 @@ using System.Collections.Generic;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
|||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -195,6 +195,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
|
||||
public byte[] GetData(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Requesting data for asset {0}", id);
|
||||
|
||||
AssetBase asset = m_Cache.Get(id);
|
||||
|
||||
if (asset != null)
|
||||
|
|
|
@ -58,6 +58,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
/// </summary>
|
||||
public static int MAX_MAJOR_VERSION = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Has the control file been loaded for this archive?
|
||||
/// </summary>
|
||||
public bool ControlFileLoaded { get; private set; }
|
||||
|
||||
protected Scene m_scene;
|
||||
protected Stream m_loadStream;
|
||||
protected Guid m_requestId;
|
||||
|
@ -527,7 +532,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="data"></param>
|
||||
protected void LoadControlFile(string path, byte[] data)
|
||||
public void LoadControlFile(string path, byte[] data)
|
||||
{
|
||||
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
|
||||
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
|
||||
|
@ -573,6 +578,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
}
|
||||
|
||||
currentRegionSettings.Save();
|
||||
|
||||
ControlFileLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
/// <returns></returns>
|
||||
public static string CreateControlFile(Dictionary<string, object> options)
|
||||
{
|
||||
int majorVersion = MAX_MAJOR_VERSION, minorVersion = 5;
|
||||
int majorVersion = MAX_MAJOR_VERSION, minorVersion = 6;
|
||||
//
|
||||
// if (options.ContainsKey("version"))
|
||||
// {
|
||||
|
|
|
@ -171,7 +171,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
||||
|
||||
bool gotControlFile = false;
|
||||
bool gotNcAssetFile = false;
|
||||
|
||||
string expectedNcAssetFileName = string.Format("{0}_{1}", ncAssetUuid, "notecard.txt");
|
||||
|
@ -184,13 +183,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
string filePath;
|
||||
TarArchiveReader.TarEntryType tarEntryType;
|
||||
|
||||
byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
|
||||
Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
|
||||
|
||||
ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty);
|
||||
arr.LoadControlFile(filePath, data);
|
||||
|
||||
Assert.That(arr.ControlFileLoaded, Is.True);
|
||||
|
||||
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
|
||||
{
|
||||
if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
|
||||
{
|
||||
gotControlFile = true;
|
||||
}
|
||||
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
|
||||
if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
|
||||
{
|
||||
string fileName = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
|
||||
|
||||
|
@ -203,7 +206,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
}
|
||||
}
|
||||
|
||||
Assert.That(gotControlFile, Is.True, "No control file in archive");
|
||||
Assert.That(gotNcAssetFile, Is.True, "No notecard asset file in archive");
|
||||
Assert.That(foundPaths, Is.EquivalentTo(expectedPaths));
|
||||
|
||||
|
|
|
@ -259,6 +259,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
|
||||
private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ESTATE MANAGEMENT MODULE]: Handling request from {0} to change estate covenant to {1}",
|
||||
// remoteClient.Name, estateCovenantID);
|
||||
|
||||
Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID;
|
||||
Scene.RegionInfo.RegionSettings.Save();
|
||||
TriggerRegionInfoChange();
|
||||
|
|
|
@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
|
|||
public void Init()
|
||||
{
|
||||
m_serialiserModule = new SerialiserModule();
|
||||
m_scene = SceneSetupHelpers.SetupScene("");
|
||||
m_scene = SceneSetupHelpers.SetupScene();
|
||||
SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule);
|
||||
}
|
||||
|
||||
|
|
|
@ -124,6 +124,52 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
colours.Save(stream, ImageFormat.Png);
|
||||
}
|
||||
|
||||
public virtual void SaveFile(ITerrainChannel m_channel, string filename,
|
||||
int offsetX, int offsetY,
|
||||
int fileWidth, int fileHeight,
|
||||
int regionSizeX, int regionSizeY)
|
||||
|
||||
{
|
||||
// We need to do this because:
|
||||
// "Saving the image to the same file it was constructed from is not allowed and throws an exception."
|
||||
string tempName = offsetX + "_ " + offsetY + "_" + filename;
|
||||
|
||||
Bitmap entireBitmap = null;
|
||||
Bitmap thisBitmap = null;
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
File.Copy(filename, tempName);
|
||||
entireBitmap = new Bitmap(tempName);
|
||||
if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY)
|
||||
{
|
||||
// old file, let's overwrite it
|
||||
entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
|
||||
}
|
||||
|
||||
thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
|
||||
Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
|
||||
for (int x = 0; x < regionSizeX; x++)
|
||||
for (int y = 0; y < regionSizeY; y++)
|
||||
entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));
|
||||
|
||||
Save(entireBitmap, filename);
|
||||
thisBitmap.Dispose();
|
||||
entireBitmap.Dispose();
|
||||
|
||||
if (File.Exists(tempName))
|
||||
File.Delete(tempName);
|
||||
}
|
||||
|
||||
protected virtual void Save(Bitmap bmp, string filename)
|
||||
{
|
||||
bmp.Save(filename, ImageFormat.Png);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
|
|
|
@ -76,6 +76,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
colours.Save(stream, ImageFormat.Jpeg);
|
||||
}
|
||||
|
||||
public virtual void SaveFile(ITerrainChannel m_channel, string filename,
|
||||
int offsetX, int offsetY,
|
||||
int fileWidth, int fileHeight,
|
||||
int regionSizeX, int regionSizeY)
|
||||
{
|
||||
throw new System.Exception("Not Implemented");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
|
|
|
@ -240,6 +240,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
get { return ".raw"; }
|
||||
}
|
||||
|
||||
public virtual void SaveFile(ITerrainChannel m_channel, string filename,
|
||||
int offsetX, int offsetY,
|
||||
int fileWidth, int fileHeight,
|
||||
int regionSizeX, int regionSizeY)
|
||||
{
|
||||
throw new System.Exception("Not Implemented");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
|
|
|
@ -160,6 +160,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
bs.Close();
|
||||
}
|
||||
|
||||
public virtual void SaveFile(ITerrainChannel m_channel, string filename,
|
||||
int offsetX, int offsetY,
|
||||
int fileWidth, int fileHeight,
|
||||
int regionSizeX, int regionSizeY)
|
||||
{
|
||||
throw new System.Exception("Not Implemented");
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
|
|
|
@ -308,6 +308,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
|||
get { return ".ter"; }
|
||||
}
|
||||
|
||||
public virtual void SaveFile(ITerrainChannel m_channel, string filename,
|
||||
int offsetX, int offsetY,
|
||||
int fileWidth, int fileHeight,
|
||||
int regionSizeX, int regionSizeY)
|
||||
{
|
||||
throw new System.Exception("Not Implemented");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
|
|
|
@ -38,5 +38,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
ITerrainChannel LoadStream(Stream stream);
|
||||
void SaveFile(string filename, ITerrainChannel map);
|
||||
void SaveStream(Stream stream, ITerrainChannel map);
|
||||
void SaveFile(ITerrainChannel map, string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int regionSizeX, int regionSizeY);
|
||||
}
|
||||
}
|
|
@ -540,6 +540,39 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the terrain to a larger terrain file.
|
||||
/// </summary>
|
||||
/// <param name="filename">The terrain file to save</param>
|
||||
/// <param name="fileWidth">The width of the file in units</param>
|
||||
/// <param name="fileHeight">The height of the file in units</param>
|
||||
/// <param name="fileStartX">Where to begin our slice</param>
|
||||
/// <param name="fileStartY">Where to begin our slice</param>
|
||||
public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY)
|
||||
{
|
||||
int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX;
|
||||
int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY;
|
||||
|
||||
if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight)
|
||||
{
|
||||
// this region is included in the tile request
|
||||
foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
|
||||
{
|
||||
if (filename.EndsWith(loader.Key))
|
||||
{
|
||||
lock (m_scene)
|
||||
{
|
||||
loader.Value.SaveFile(m_channel, filename, offsetX, offsetY,
|
||||
fileWidth, fileHeight,
|
||||
(int)Constants.RegionSize,
|
||||
(int)Constants.RegionSize);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs updates to the region periodically, synchronising physics and other heightmap aware sections
|
||||
/// </summary>
|
||||
|
@ -860,6 +893,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
SaveToFile((string) args[0]);
|
||||
}
|
||||
|
||||
private void InterfaceSaveTileFile(Object[] args)
|
||||
{
|
||||
SaveToFile((string)args[0],
|
||||
(int)args[1],
|
||||
(int)args[2],
|
||||
(int)args[3],
|
||||
(int)args[4]);
|
||||
}
|
||||
|
||||
private void InterfaceBakeTerrain(Object[] args)
|
||||
{
|
||||
UpdateRevertMap();
|
||||
|
@ -1115,6 +1157,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
loadFromTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file",
|
||||
"Integer");
|
||||
|
||||
Command saveToTileCommand =
|
||||
new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file.");
|
||||
saveToTileCommand.AddArgument("filename",
|
||||
"The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " +
|
||||
supportedFileExtensions, "String");
|
||||
saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer");
|
||||
saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer");
|
||||
saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file",
|
||||
"Integer");
|
||||
saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file",
|
||||
"Integer");
|
||||
// Terrain adjustments
|
||||
Command fillRegionCommand =
|
||||
new Command("fill", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFillTerrain, "Fills the current heightmap with a specified value.");
|
||||
|
@ -1166,6 +1219,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
m_commander.RegisterCommand("load", loadFromFileCommand);
|
||||
m_commander.RegisterCommand("load-tile", loadFromTileCommand);
|
||||
m_commander.RegisterCommand("save", saveToFileCommand);
|
||||
m_commander.RegisterCommand("save-tile", saveToTileCommand);
|
||||
m_commander.RegisterCommand("fill", fillRegionCommand);
|
||||
m_commander.RegisterCommand("elevate", elevateCommand);
|
||||
m_commander.RegisterCommand("lower", lowerCommand);
|
||||
|
|
|
@ -702,18 +702,12 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
{
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID,
|
||||
uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask,
|
||||
uint NextOwnerMask, int OwnershipCost, byte SaleType,int SalePrice, uint Category,
|
||||
UUID LastOwnerID, string ObjectName, string Description)
|
||||
public void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID,
|
||||
UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID,
|
||||
UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName,
|
||||
string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask,
|
||||
uint BaseMask, byte saleType, int salePrice)
|
||||
public void SendObjectPropertiesReply(ISceneEntity entity)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,23 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
public interface IInventoryAccessModule
|
||||
{
|
||||
UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data);
|
||||
UUID DeleteToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient);
|
||||
|
||||
/// <summary>
|
||||
/// Copy objects to a user's inventory.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Is it left to the caller to delete them from the scene if required.
|
||||
/// </remarks>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="objectGroups"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <returns>
|
||||
/// Returns the UUID of the newly created item asset (not the item itself).
|
||||
/// FIXME: This is not very useful. It would be far more useful to return a list of items instead.
|
||||
/// </returns>
|
||||
UUID CopyToInventory(DeRezAction action, UUID folderID, List<SceneObjectGroup> objectGroups, IClientAPI remoteClient);
|
||||
|
||||
SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart,
|
||||
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
|
||||
bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);
|
||||
|
|
|
@ -223,7 +223,8 @@ namespace OpenSim.Region.Framework
|
|||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[MODULES]: Could not load types for [{0}]. Exception {1}", pluginAssembly.FullName, e);
|
||||
"[MODULES]: Could not load types for plugin DLL {0}. Exception {1} {2}",
|
||||
pluginAssembly.FullName, e.Message, e.StackTrace);
|
||||
|
||||
// justincc: Right now this is fatal to really get the user's attention
|
||||
throw e;
|
||||
|
|
|
@ -143,7 +143,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
if (invAccess != null)
|
||||
invAccess.DeleteToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient);
|
||||
invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient);
|
||||
|
||||
if (x.permissionToDelete)
|
||||
{
|
||||
foreach (SceneObjectGroup g in x.objectGroups)
|
||||
|
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* 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.Linq;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a coalescene of scene objects. A coalescence occurs when objects that are not in the same linkset
|
||||
/// are grouped together.
|
||||
/// </summary>
|
||||
public class CoalescedSceneObjects
|
||||
{
|
||||
/// <summary>
|
||||
/// The creator of this coalesence, though not necessarily the objects within it.
|
||||
/// </summary>
|
||||
public UUID CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of objects in this coalesence
|
||||
/// </summary>
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (m_memberObjects)
|
||||
return m_memberObjects.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does this coalesence have any member objects?
|
||||
/// </summary>
|
||||
public bool HasObjects { get { return Count > 0; } }
|
||||
|
||||
/// <summary>
|
||||
/// Get the objects currently in this coalescence
|
||||
/// </summary>
|
||||
public List<SceneObjectGroup> Objects
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (m_memberObjects)
|
||||
return new List<SceneObjectGroup>(m_memberObjects);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the scene that contains the objects in this coalescence. If there are no objects then null is returned.
|
||||
/// </summary>
|
||||
public Scene Scene
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!HasObjects)
|
||||
return null;
|
||||
else
|
||||
return Objects[0].Scene;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// At this point, we need to preserve the order of objects added to the coalescence, since the first
|
||||
/// one will end up matching the item name when rerezzed.
|
||||
/// </summary>
|
||||
protected List<SceneObjectGroup> m_memberObjects = new List<SceneObjectGroup>();
|
||||
|
||||
public CoalescedSceneObjects(UUID creatorId)
|
||||
{
|
||||
CreatorId = creatorId;
|
||||
}
|
||||
|
||||
public CoalescedSceneObjects(UUID creatorId, params SceneObjectGroup[] objs) : this(creatorId)
|
||||
{
|
||||
foreach (SceneObjectGroup obj in objs)
|
||||
Add(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an object to the coalescence.
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="offset">The offset of the object within the group</param>
|
||||
public void Add(SceneObjectGroup obj)
|
||||
{
|
||||
lock (m_memberObjects)
|
||||
m_memberObjects.Add(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a scene object from the coalescene
|
||||
/// </summary>
|
||||
/// <param name="sceneObjectId"></param>
|
||||
/// <returns>true if the object was there to be removed, false if not.</returns>
|
||||
public bool Remove(SceneObjectGroup obj)
|
||||
{
|
||||
lock (m_memberObjects)
|
||||
return m_memberObjects.Remove(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the total size of the coalescence (the size required to cover all the objects within it) and the
|
||||
/// offsets of each of those objects.
|
||||
/// </summary>
|
||||
/// <param name="size"></param>
|
||||
/// <returns>
|
||||
/// An array of offsets. The order of objects is the same as returned from the Objects property
|
||||
/// </returns>
|
||||
public Vector3[] GetSizeAndOffsets(out Vector3 size)
|
||||
{
|
||||
float minX, minY, minZ;
|
||||
float maxX, maxY, maxZ;
|
||||
|
||||
Vector3[] offsets
|
||||
= Scene.GetCombinedBoundingBox(
|
||||
Objects, out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
|
||||
|
||||
float sizeX = maxX - minX;
|
||||
float sizeY = maxY - minY;
|
||||
float sizeZ = maxZ - minZ;
|
||||
|
||||
size = new Vector3(sizeX, sizeY, sizeZ);
|
||||
|
||||
return offsets;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -58,16 +58,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public class Prioritizer
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
|
||||
/// viewer before child prim updates.
|
||||
/// The adjustment is added to child prims and subtracted from root prims, so the gap ends up
|
||||
/// being double. We do it both ways so that there is a still a priority delta even if the priority is already
|
||||
/// double.MinValue or double.MaxValue.
|
||||
/// </summary>
|
||||
private double m_childPrimAdjustmentFactor = 0.05;
|
||||
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
|
@ -76,17 +67,35 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_scene = scene;
|
||||
}
|
||||
|
||||
public double GetUpdatePriority(IClientAPI client, ISceneEntity entity)
|
||||
/// <summary>
|
||||
/// Returns the priority queue into which the update should be placed. Updates within a
|
||||
/// queue will be processed in arrival order. There are currently 12 priority queues
|
||||
/// implemented in PriorityQueue class in LLClientView. Queue 0 is generally retained
|
||||
/// for avatar updates. The fair queuing discipline for processing the priority queues
|
||||
/// assumes that the number of entities in each priority queues increases exponentially.
|
||||
/// So for example... if queue 1 contains all updates within 10m of the avatar or camera
|
||||
/// then queue 2 at 20m is about 3X bigger in space & about 3X bigger in total number
|
||||
/// of updates.
|
||||
/// </summary>
|
||||
public uint GetUpdatePriority(IClientAPI client, ISceneEntity entity)
|
||||
{
|
||||
double priority = 0;
|
||||
|
||||
// If entity is null we have a serious problem
|
||||
if (entity == null)
|
||||
return 100000;
|
||||
{
|
||||
m_log.WarnFormat("[PRIORITIZER] attempt to prioritize null entity");
|
||||
throw new InvalidOperationException("Prioritization entity not defined");
|
||||
}
|
||||
|
||||
// If this is an update for our own avatar give it the highest priority
|
||||
if (client.AgentId == entity.UUID)
|
||||
return 0;
|
||||
|
||||
uint priority;
|
||||
|
||||
switch (m_scene.UpdatePrioritizationScheme)
|
||||
{
|
||||
case UpdatePrioritizationSchemes.Time:
|
||||
priority = GetPriorityByTime();
|
||||
priority = GetPriorityByTime(client, entity);
|
||||
break;
|
||||
case UpdatePrioritizationSchemes.Distance:
|
||||
priority = GetPriorityByDistance(client, entity);
|
||||
|
@ -104,180 +113,115 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
|
||||
}
|
||||
|
||||
// Adjust priority so that root prims are sent to the viewer first. This is especially important for
|
||||
// attachments acting as huds, since current viewers fail to display hud child prims if their updates
|
||||
// arrive before the root one.
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart sop = ((SceneObjectPart)entity);
|
||||
|
||||
if (sop.IsRoot)
|
||||
{
|
||||
if (priority >= double.MinValue + m_childPrimAdjustmentFactor)
|
||||
priority -= m_childPrimAdjustmentFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priority <= double.MaxValue - m_childPrimAdjustmentFactor)
|
||||
priority += m_childPrimAdjustmentFactor;
|
||||
}
|
||||
}
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
private double GetPriorityByTime()
|
||||
|
||||
private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity)
|
||||
{
|
||||
return DateTime.UtcNow.ToOADate();
|
||||
return 1;
|
||||
}
|
||||
|
||||
private double GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
|
||||
private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
|
||||
{
|
||||
return ComputeDistancePriority(client,entity,false);
|
||||
}
|
||||
|
||||
private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity)
|
||||
{
|
||||
return ComputeDistancePriority(client,entity,true);
|
||||
}
|
||||
|
||||
private uint GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity)
|
||||
{
|
||||
uint pqueue = ComputeDistancePriority(client,entity,true);
|
||||
|
||||
ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
|
||||
if (presence != null)
|
||||
{
|
||||
// If this is an update for our own avatar give it the highest priority
|
||||
if (presence == entity)
|
||||
return 0.0;
|
||||
|
||||
// Use the camera position for local agents and avatar position for remote agents
|
||||
Vector3 presencePos = (presence.IsChildAgent) ?
|
||||
presence.AbsolutePosition :
|
||||
presence.CameraPosition;
|
||||
|
||||
// Use group position for child prims
|
||||
Vector3 entityPos;
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
|
||||
// before its scheduled update was triggered
|
||||
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
|
||||
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
entityPos = entity.AbsolutePosition;
|
||||
}
|
||||
|
||||
return Vector3.DistanceSquared(presencePos, entityPos);
|
||||
}
|
||||
|
||||
return double.NaN;
|
||||
}
|
||||
|
||||
private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity)
|
||||
{
|
||||
ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
|
||||
if (presence != null)
|
||||
{
|
||||
// If this is an update for our own avatar give it the highest priority
|
||||
if (presence == entity)
|
||||
return 0.0;
|
||||
|
||||
// Use group position for child prims
|
||||
Vector3 entityPos = entity.AbsolutePosition;
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
|
||||
// before its scheduled update was triggered
|
||||
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
|
||||
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
entityPos = entity.AbsolutePosition;
|
||||
}
|
||||
|
||||
if (!presence.IsChildAgent)
|
||||
{
|
||||
// Root agent. Use distance from camera and a priority decrease for objects behind us
|
||||
Vector3 camPosition = presence.CameraPosition;
|
||||
Vector3 camAtAxis = presence.CameraAtAxis;
|
||||
|
||||
// Distance
|
||||
double priority = Vector3.DistanceSquared(camPosition, entityPos);
|
||||
|
||||
// Plane equation
|
||||
float d = -Vector3.Dot(camPosition, camAtAxis);
|
||||
float p = Vector3.Dot(camAtAxis, entityPos) + d;
|
||||
if (p < 0.0f) priority *= 2.0;
|
||||
|
||||
return priority;
|
||||
}
|
||||
else
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
// Child agent. Use the normal distance method
|
||||
Vector3 presencePos = presence.AbsolutePosition;
|
||||
// Non physical prims are lower priority than physical prims
|
||||
PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
|
||||
if (physActor == null || !physActor.IsPhysical)
|
||||
pqueue++;
|
||||
|
||||
return Vector3.DistanceSquared(presencePos, entityPos);
|
||||
// Attachments are high priority,
|
||||
// MIC: shouldn't these already be in the highest priority queue already
|
||||
// since their root position is same as the avatars?
|
||||
if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
|
||||
pqueue = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return double.NaN;
|
||||
return pqueue;
|
||||
}
|
||||
|
||||
private double GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity)
|
||||
private uint ComputeDistancePriority(IClientAPI client, ISceneEntity entity, bool useFrontBack)
|
||||
{
|
||||
// If this is an update for our own avatar give it the highest priority
|
||||
if (client.AgentId == entity.UUID)
|
||||
return 0.0;
|
||||
if (entity == null)
|
||||
return double.NaN;
|
||||
// Get this agent's position
|
||||
ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
|
||||
if (presence == null)
|
||||
{
|
||||
// this shouldn't happen, it basically means that we are prioritizing
|
||||
// updates to send to a client that doesn't have a presence in the scene
|
||||
// seems like there's race condition here...
|
||||
|
||||
// Use group position for child prims
|
||||
// m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId);
|
||||
// throw new InvalidOperationException("Prioritization agent not defined");
|
||||
return Int32.MaxValue;
|
||||
}
|
||||
|
||||
// Use group position for child prims, since we are putting child prims in
|
||||
// the same queue with the root of the group, the root prim (which goes into
|
||||
// the queue first) should always be sent first, no need to adjust child prim
|
||||
// priorities
|
||||
Vector3 entityPos = entity.AbsolutePosition;
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup;
|
||||
if (group != null)
|
||||
entityPos = group.AbsolutePosition;
|
||||
else
|
||||
entityPos = entity.AbsolutePosition;
|
||||
}
|
||||
else
|
||||
entityPos = entity.AbsolutePosition;
|
||||
|
||||
ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
|
||||
if (presence != null)
|
||||
{
|
||||
if (!presence.IsChildAgent)
|
||||
{
|
||||
if (entity is ScenePresence)
|
||||
return 1.0;
|
||||
// Use the camera position for local agents and avatar position for remote agents
|
||||
Vector3 presencePos = (presence.IsChildAgent) ?
|
||||
presence.AbsolutePosition :
|
||||
presence.CameraPosition;
|
||||
|
||||
// Root agent. Use distance from camera and a priority decrease for objects behind us
|
||||
// Compute the distance...
|
||||
double distance = Vector3.Distance(presencePos, entityPos);
|
||||
|
||||
// And convert the distance to a priority queue, this computation gives queues
|
||||
// at 10, 20, 40, 80, 160, 320, 640, and 1280m
|
||||
uint pqueue = 1;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (distance < 10 * Math.Pow(2.0,i))
|
||||
break;
|
||||
pqueue++;
|
||||
}
|
||||
|
||||
// If this is a root agent, then determine front & back
|
||||
// Bump up the priority queue (drop the priority) for any objects behind the avatar
|
||||
if (useFrontBack && ! presence.IsChildAgent)
|
||||
{
|
||||
// Root agent, decrease priority for objects behind us
|
||||
Vector3 camPosition = presence.CameraPosition;
|
||||
Vector3 camAtAxis = presence.CameraAtAxis;
|
||||
|
||||
// Distance
|
||||
double priority = Vector3.DistanceSquared(camPosition, entityPos);
|
||||
|
||||
// Plane equation
|
||||
float d = -Vector3.Dot(camPosition, camAtAxis);
|
||||
float p = Vector3.Dot(camAtAxis, entityPos) + d;
|
||||
if (p < 0.0f) priority *= 2.0;
|
||||
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
|
||||
if (physActor == null || !physActor.IsPhysical)
|
||||
priority += 100;
|
||||
|
||||
if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
|
||||
priority = 1.0;
|
||||
}
|
||||
return priority;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Child agent. Use the normal distance method
|
||||
Vector3 presencePos = presence.AbsolutePosition;
|
||||
|
||||
return Vector3.DistanceSquared(presencePos, entityPos);
|
||||
}
|
||||
if (p < 0.0f)
|
||||
pqueue++;
|
||||
}
|
||||
|
||||
return pqueue;
|
||||
}
|
||||
|
||||
return double.NaN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1955,26 +1955,64 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
|
||||
bool RezSelected, bool RemoveItem, UUID fromTaskID)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[PRIM INVENTORY]: RezObject from {0} for item {1} from task id {2}",
|
||||
// remoteClient.Name, itemID, fromTaskID);
|
||||
|
||||
if (fromTaskID == UUID.Zero)
|
||||
{
|
||||
IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
|
||||
if (invAccess != null)
|
||||
invAccess.RezObject(
|
||||
remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
|
||||
RezSelected, RemoveItem, fromTaskID, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(fromTaskID);
|
||||
if (part == null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such scene object",
|
||||
remoteClient.Name, itemID, fromTaskID);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
|
||||
if (item == null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such item",
|
||||
remoteClient.Name, itemID, fromTaskID);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
|
||||
Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);
|
||||
Vector3 pos
|
||||
= GetNewRezLocation(
|
||||
RayStart, RayEnd, RayTargetID, Quaternion.Identity,
|
||||
BypassRayCast, bRayEndIsIntersection, true, scale, false);
|
||||
|
||||
RezObject(part, item, pos, null, Vector3.Zero, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rez an object into the scene from a prim's inventory.
|
||||
/// </summary>
|
||||
/// <param name="sourcePart"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="rot"></param>
|
||||
/// <param name="vel"></param>
|
||||
/// <param name="pos">The position of the rezzed object.</param>
|
||||
/// <param name="rot">The rotation of the rezzed object. If null, then the rotation stored with the object
|
||||
/// will be used if it exists.</param>
|
||||
/// <param name="vel">The velocity of the rezzed object.</param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns>
|
||||
public virtual SceneObjectGroup RezObject(
|
||||
SceneObjectPart sourcePart, TaskInventoryItem item,
|
||||
Vector3 pos, Quaternion rot, Vector3 vel, int param)
|
||||
SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param)
|
||||
{
|
||||
if (null == item)
|
||||
return null;
|
||||
|
@ -1993,7 +2031,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
|
||||
}
|
||||
|
||||
AddNewSceneObject(group, true, pos, rot, vel);
|
||||
AddNewSceneObject(group, true);
|
||||
|
||||
group.AbsolutePosition = pos;
|
||||
group.Velocity = vel;
|
||||
|
||||
if (rot != null)
|
||||
group.UpdateGroupRotationR((Quaternion)rot);
|
||||
|
||||
// We can only call this after adding the scene object, since the scene object references the scene
|
||||
// to find out if scripts should be activated at all.
|
||||
|
|
|
@ -4839,7 +4839,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public Vector3[] GetCombinedBoundingBox(List<SceneObjectGroup> objects, out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
|
||||
/// <summary>
|
||||
/// Get the volume of space that will encompass all the given objects.
|
||||
/// </summary>
|
||||
/// <param name="objects"></param>
|
||||
/// <param name="minX"></param>
|
||||
/// <param name="maxX"></param>
|
||||
/// <param name="minY"></param>
|
||||
/// <param name="maxY"></param>
|
||||
/// <param name="minZ"></param>
|
||||
/// <param name="maxZ"></param>
|
||||
/// <returns></returns>
|
||||
public static Vector3[] GetCombinedBoundingBox(
|
||||
List<SceneObjectGroup> objects,
|
||||
out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
|
||||
{
|
||||
minX = 256;
|
||||
maxX = -256;
|
||||
|
@ -4858,6 +4871,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}",
|
||||
// g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ));
|
||||
|
||||
ominX += vec.X;
|
||||
omaxX += vec.X;
|
||||
ominY += vec.Y;
|
||||
|
|
|
@ -997,6 +997,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
foreach (SceneObjectPart p in ((SceneObjectGroup)entity).Parts)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE GRAPH]: Part {0} has name {1}", p.UUID, p.Name);
|
||||
|
||||
if (p.Name == name)
|
||||
{
|
||||
sop = p;
|
||||
|
|
|
@ -81,16 +81,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an inventory item to a prim in this group.
|
||||
/// Add an inventory item from a user's inventory to a prim in this scene object.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="remoteClient">The client adding the item.</param>
|
||||
/// <param name="localID">The local ID of the part receiving the add.</param>
|
||||
/// <param name="item">The user inventory item being added.</param>
|
||||
/// <param name="copyItemID">The item UUID that should be used by the new item.</param>
|
||||
/// <returns></returns>
|
||||
public bool AddInventoryItem(IClientAPI remoteClient, uint localID,
|
||||
InventoryItemBase item, UUID copyItemID)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}",
|
||||
// item.Name, remoteClient.Name, localID);
|
||||
|
||||
UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID;
|
||||
|
||||
SceneObjectPart part = GetChildPart(localID);
|
||||
|
@ -134,6 +138,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
taskItem.Flags = item.Flags;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}",
|
||||
// taskItem.Flags, taskItem.Name, localID, remoteClient.Name);
|
||||
|
||||
// TODO: These are pending addition of those fields to TaskInventoryItem
|
||||
// taskItem.SalePrice = item.SalePrice;
|
||||
// taskItem.SaleType = item.SaleType;
|
||||
|
|
|
@ -296,20 +296,26 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
Vector3 val = value;
|
||||
|
||||
if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|
||||
|| m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
|
||||
&& !IsAttachmentCheckFull() && (!m_scene.LoadingPrims))
|
||||
if (Scene != null)
|
||||
{
|
||||
if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|
||||
|| Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
|
||||
&& !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
|
||||
{
|
||||
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (RootPart.GetStatusSandbox())
|
||||
{
|
||||
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
|
||||
{
|
||||
RootPart.ScriptSetPhysicsStatus(false);
|
||||
|
||||
if (Scene != null)
|
||||
Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
|
||||
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +332,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
||||
//}
|
||||
|
||||
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
||||
if (Scene != null)
|
||||
Scene.EventManager.TriggerParcelPrimCountTainted();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1765,10 +1772,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="part"></param>
|
||||
public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, UUID AgentID, uint RequestFlags)
|
||||
{
|
||||
remoteClient.SendObjectPropertiesFamilyData(RequestFlags, RootPart.UUID, RootPart.OwnerID, RootPart.GroupID, RootPart.BaseMask,
|
||||
RootPart.OwnerMask, RootPart.GroupMask, RootPart.EveryoneMask, RootPart.NextOwnerMask,
|
||||
RootPart.OwnershipCost, RootPart.ObjectSaleType, RootPart.SalePrice, RootPart.Category,
|
||||
RootPart.CreatorID, RootPart.Name, RootPart.Description);
|
||||
remoteClient.SendObjectPropertiesFamilyData(RootPart, RequestFlags);
|
||||
|
||||
// remoteClient.SendObjectPropertiesFamilyData(RequestFlags, RootPart.UUID, RootPart.OwnerID, RootPart.GroupID, RootPart.BaseMask,
|
||||
// RootPart.OwnerMask, RootPart.GroupMask, RootPart.EveryoneMask, RootPart.NextOwnerMask,
|
||||
// RootPart.OwnershipCost, RootPart.ObjectSaleType, RootPart.SalePrice, RootPart.Category,
|
||||
// RootPart.CreatorID, RootPart.Name, RootPart.Description);
|
||||
}
|
||||
|
||||
public void SetPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID)
|
||||
|
|
|
@ -2055,15 +2055,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void GetProperties(IClientAPI client)
|
||||
{
|
||||
//Viewer wants date in microseconds so multiply it by 1,000,000.
|
||||
client.SendObjectPropertiesReply(
|
||||
m_fromUserInventoryItemID, (ulong)_creationDate*(ulong)1e6, _creatorID, UUID.Zero, UUID.Zero,
|
||||
_groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID,
|
||||
ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description,
|
||||
ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask,
|
||||
ParentGroup.RootPart._baseMask,
|
||||
ParentGroup.RootPart.ObjectSaleType,
|
||||
ParentGroup.RootPart.SalePrice);
|
||||
client.SendObjectPropertiesReply(this);
|
||||
}
|
||||
|
||||
public UUID GetRootPartUUID()
|
||||
|
@ -2088,7 +2080,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
axPos *= parentRot;
|
||||
Vector3 translationOffsetPosition = axPos;
|
||||
return GroupPosition + translationOffsetPosition;
|
||||
|
||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name);
|
||||
|
||||
Vector3 worldPos = GroupPosition + translationOffsetPosition;
|
||||
|
||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name);
|
||||
|
||||
return worldPos;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* 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.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize and deserialize coalesced scene objects.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Deserialization not yet here.
|
||||
/// </remarks>
|
||||
public class CoalescedSceneObjectsSerializer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Serialize coalesced objects to Xml
|
||||
/// </summary>
|
||||
/// <param name="coa"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToXml(CoalescedSceneObjects coa)
|
||||
{
|
||||
using (StringWriter sw = new StringWriter())
|
||||
{
|
||||
using (XmlTextWriter writer = new XmlTextWriter(sw))
|
||||
{
|
||||
Vector3 size;
|
||||
|
||||
List<SceneObjectGroup> coaObjects = coa.Objects;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object",
|
||||
// coaObjects.Count);
|
||||
|
||||
// This is weak - we're relying on the set of coalesced objects still being identical
|
||||
Vector3[] offsets = coa.GetSizeAndOffsets(out size);
|
||||
|
||||
writer.WriteStartElement("CoalescedObject");
|
||||
|
||||
writer.WriteAttributeString("x", size.X.ToString());
|
||||
writer.WriteAttributeString("y", size.Y.ToString());
|
||||
writer.WriteAttributeString("z", size.Z.ToString());
|
||||
|
||||
// Embed the offsets into the group XML
|
||||
for (int i = 0; i < coaObjects.Count; i++)
|
||||
{
|
||||
SceneObjectGroup obj = coaObjects[i];
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}",
|
||||
// i, obj.Name);
|
||||
|
||||
writer.WriteStartElement("SceneObjectGroup");
|
||||
writer.WriteAttributeString("offsetx", offsets[i].X.ToString());
|
||||
writer.WriteAttributeString("offsety", offsets[i].Y.ToString());
|
||||
writer.WriteAttributeString("offsetz", offsets[i].Z.ToString());
|
||||
|
||||
SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true);
|
||||
|
||||
writer.WriteEndElement(); // SceneObjectGroup
|
||||
}
|
||||
|
||||
writer.WriteEndElement(); // CoalescedObject
|
||||
}
|
||||
|
||||
string output = sw.ToString();
|
||||
|
||||
// Console.WriteLine(output);
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool TryFromXml(string xml, out CoalescedSceneObjects coa)
|
||||
{
|
||||
// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
|
||||
|
||||
coa = null;
|
||||
|
||||
using (StringReader sr = new StringReader(xml))
|
||||
{
|
||||
using (XmlTextReader reader = new XmlTextReader(sr))
|
||||
{
|
||||
try
|
||||
{
|
||||
reader.Read();
|
||||
if (reader.Name != "CoalescedObject")
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false",
|
||||
// reader.Name);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
coa = new CoalescedSceneObjects(UUID.Zero);
|
||||
reader.Read();
|
||||
|
||||
while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject")
|
||||
{
|
||||
if (reader.Name == "SceneObjectGroup")
|
||||
{
|
||||
string soXml = reader.ReadOuterXml();
|
||||
coa.Add(SceneObjectSerializer.FromOriginalXmlFormat(soXml));
|
||||
}
|
||||
}
|
||||
|
||||
reader.ReadEndElement(); // CoalescedObject
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed with {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -140,17 +140,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a scene object to the original xml format
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <returns></returns>
|
||||
public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer)
|
||||
{
|
||||
ToOriginalXmlFormat(sceneObject, writer, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a scene object to the original xml format
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <param name="writer"></param>
|
||||
/// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param>
|
||||
/// <returns></returns>
|
||||
public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool noRootElement)
|
||||
{
|
||||
//m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name);
|
||||
//int time = System.Environment.TickCount;
|
||||
|
||||
if (!noRootElement)
|
||||
writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
|
||||
|
||||
writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
|
||||
ToXmlFormat(sceneObject.RootPart, writer);
|
||||
writer.WriteEndElement();
|
||||
|
@ -170,6 +185,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
|
||||
writer.WriteEndElement(); // OtherParts
|
||||
sceneObject.SaveScriptedState(writer);
|
||||
|
||||
if (!noRootElement)
|
||||
writer.WriteEndElement(); // SceneObjectGroup
|
||||
|
||||
//m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
|
||||
|
@ -1318,7 +1335,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
writer.WriteStartElement("SculptData");
|
||||
byte[] sd;
|
||||
if (shp.SculptData != null)
|
||||
sd = shp.ExtraParams;
|
||||
sd = shp.SculptData;
|
||||
else
|
||||
sd = Utils.EmptyBytes;
|
||||
writer.WriteBase64(sd, 0, sd.Length);
|
||||
|
|
|
@ -117,11 +117,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
|
||||
|
||||
|
||||
Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, "grid");
|
||||
Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010);
|
||||
SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
|
||||
sceneB.RegisterRegionWithGrid();
|
||||
|
||||
Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, "grid");
|
||||
Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000);
|
||||
SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
|
||||
sceneA.RegisterRegionWithGrid();
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Tests
|
|||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
UserAccount user1 = CreateUser(scene);
|
||||
SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID);
|
||||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
|
@ -127,7 +127,7 @@ namespace OpenSim.Region.Framework.Tests
|
|||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
UserAccount user1 = CreateUser(scene);
|
||||
SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID);
|
||||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
|
|
|
@ -47,7 +47,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
m_assetService = new MockAssetService();
|
||||
// FIXME: We don't need a full scene here - it would be enough to set up the asset service.
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
m_assetService = scene.AssetService;
|
||||
m_uuidGatherer = new UuidGatherer(m_assetService);
|
||||
}
|
||||
|
||||
|
|
|
@ -298,12 +298,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (null != objectAsset)
|
||||
{
|
||||
string xml = Utils.BytesToString(objectAsset.Data);
|
||||
|
||||
CoalescedSceneObjects coa;
|
||||
if (CoalescedSceneObjectsSerializer.TryFromXml(xml, out coa))
|
||||
{
|
||||
foreach (SceneObjectGroup sog in coa.Objects)
|
||||
GatherAssetUuids(sog, assetUuids);
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml);
|
||||
|
||||
if (null != sog)
|
||||
GatherAssetUuids(sog, assetUuids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the asset uuid associated with a gesture
|
||||
|
|
|
@ -1332,14 +1332,13 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID, uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask, uint NextOwnerMask, int OwnershipCost, byte SaleType, int SalePrice, uint Category, UUID LastOwnerID, string ObjectName, string Description)
|
||||
public void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID, UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID, UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName, string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask, uint BaseMask, byte saleType, int salePrice)
|
||||
public void SendObjectPropertiesReply(ISceneEntity entity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendAgentOffline(UUID[] agentIDs)
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
|
||||
if (serviceDll == String.Empty)
|
||||
{
|
||||
m_log.Error("[FreeSwitchVoice]: No LocalServiceModule named in section FreeSwitchVoice");
|
||||
m_log.Error("[FreeSwitchVoice]: No LocalServiceModule named in section FreeSwitchVoice. Not starting.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -143,8 +143,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
if (String.IsNullOrEmpty(m_freeSwitchRealm) ||
|
||||
String.IsNullOrEmpty(m_freeSwitchAPIPrefix))
|
||||
{
|
||||
m_log.Error("[FreeSwitchVoice] plugin mis-configured");
|
||||
m_log.Info("[FreeSwitchVoice] plugin disabled: incomplete configuration");
|
||||
m_log.Error("[FreeSwitchVoice]: Freeswitch service mis-configured. Not starting.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -164,24 +163,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
// String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
|
||||
// MainServer.Instance.AddStreamHandler(h);
|
||||
|
||||
|
||||
|
||||
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix),
|
||||
FreeSwitchSLVoiceSigninHTTPHandler);
|
||||
|
||||
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix),
|
||||
FreeSwitchSLVoiceBuddyHTTPHandler);
|
||||
|
||||
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch server {0}", m_freeSwitchRealm);
|
||||
MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_watcher.php", m_freeSwitchAPIPrefix),
|
||||
FreeSwitchSLVoiceWatcherHTTPHandler);
|
||||
|
||||
m_log.InfoFormat("[FreeSwitchVoice]: using FreeSwitch server {0}", m_freeSwitchRealm);
|
||||
|
||||
m_Enabled = true;
|
||||
|
||||
m_log.Info("[FreeSwitchVoice] plugin enabled");
|
||||
m_log.Info("[FreeSwitchVoice]: plugin enabled");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.ToString());
|
||||
m_log.ErrorFormat("[FreeSwitchVoice]: plugin initialization failed: {0} {1}", e.Message, e.StackTrace);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -240,7 +239,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
{
|
||||
if (m_Enabled)
|
||||
{
|
||||
m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
|
||||
m_log.Info("[FreeSwitchVoice]: registering IVoiceModule with the scene");
|
||||
|
||||
// register the voice interface for this module, so the script engine can call us
|
||||
scene.RegisterModuleInterface<IVoiceModule>(this);
|
||||
|
@ -302,7 +301,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
// </summary>
|
||||
public void OnRegisterCaps(Scene scene, UUID agentID, Caps caps)
|
||||
{
|
||||
m_log.DebugFormat("[FreeSwitchVoice] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
||||
m_log.DebugFormat(
|
||||
"[FreeSwitchVoice]: OnRegisterCaps() called with agentID {0} caps {1} in scene {2}",
|
||||
agentID, caps, scene.RegionInfo.RegionName);
|
||||
|
||||
string capsBase = "/CAPS/" + caps.CapsObjectPath;
|
||||
caps.RegisterHandler("ProvisionVoiceAccountRequest",
|
||||
|
@ -344,6 +345,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
public string ProvisionVoiceAccountRequest(Scene scene, string request, string path, string param,
|
||||
UUID agentID, Caps caps)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[FreeSwitchVoice][PROVISIONVOICE]: ProvisionVoiceAccountRequest() request: {0}, path: {1}, param: {2}", request, path, param);
|
||||
|
||||
ScenePresence avatar = scene.GetScenePresence(agentID);
|
||||
if (avatar == null)
|
||||
{
|
||||
|
@ -357,9 +361,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
|
||||
try
|
||||
{
|
||||
//m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
|
||||
// request, path, param);
|
||||
|
||||
//XmlElement resp;
|
||||
string agentname = "x" + Convert.ToBase64String(agentID.GetBytes());
|
||||
string password = "1234";//temp hack//new UUID(Guid.NewGuid()).ToString().Replace('-','Z').Substring(0,16);
|
||||
|
@ -390,7 +391,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
|
||||
string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
|
||||
|
||||
m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: avatar \"{0}\": {1}", avatarName, r);
|
||||
// m_log.DebugFormat("[FreeSwitchVoice][PROVISIONVOICE]: avatar \"{0}\": {1}", avatarName, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -416,6 +417,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param,
|
||||
UUID agentID, Caps caps)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}",
|
||||
// scene.RegionInfo.RegionName, agentID);
|
||||
|
||||
ScenePresence avatar = scene.GetScenePresence(agentID);
|
||||
string avatarName = avatar.Name;
|
||||
|
||||
|
@ -453,8 +458,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
|
||||
if ((land.Flags & (uint)ParcelFlags.AllowVoiceChat) == 0)
|
||||
{
|
||||
m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel",
|
||||
scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName);
|
||||
// m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": voice not enabled for parcel",
|
||||
// scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName);
|
||||
channelUri = String.Empty;
|
||||
}
|
||||
else
|
||||
|
@ -469,8 +474,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
parcelVoiceInfo = new LLSDParcelVoiceInfoResponse(scene.RegionInfo.RegionName, land.LocalID, creds);
|
||||
string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
|
||||
|
||||
m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}",
|
||||
scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r);
|
||||
// m_log.DebugFormat("[FreeSwitchVoice][PARCELVOICE]: region \"{0}\": Parcel \"{1}\" ({2}): avatar \"{3}\": {4}",
|
||||
// scene.RegionInfo.RegionName, land.Name, land.LocalID, avatarName, r);
|
||||
return r;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -502,6 +507,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
|
||||
m_log.DebugFormat("[FreeSwitchVoice][CHATSESSION]: avatar \"{0}\": request: {1}, path: {2}, param: {3}",
|
||||
avatarName, request, path, param);
|
||||
|
||||
return "<llsd>true</llsd>";
|
||||
}
|
||||
|
||||
|
@ -555,10 +561,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
return response;
|
||||
}
|
||||
|
||||
|
||||
public Hashtable FreeSwitchSLVoiceGetPreloginHTTPHandler(Hashtable request)
|
||||
{
|
||||
m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceGetPreloginHTTPHandler called");
|
||||
m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceGetPreloginHTTPHandler called");
|
||||
|
||||
Hashtable response = new Hashtable();
|
||||
response["content_type"] = "text/xml";
|
||||
|
@ -592,6 +597,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
|
||||
public Hashtable FreeSwitchSLVoiceBuddyHTTPHandler(Hashtable request)
|
||||
{
|
||||
m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceBuddyHTTPHandler called");
|
||||
|
||||
Hashtable response = new Hashtable();
|
||||
response["int_response_code"] = 200;
|
||||
response["str_response_string"] = string.Empty;
|
||||
|
@ -656,15 +663,58 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
resp.Append("</buddies><groups></groups></body></level0></response>");
|
||||
|
||||
response["str_response_string"] = resp.ToString();
|
||||
// Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
|
||||
// Regex normalizeEndLines = new Regex(@"(\r\n|\n)", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
|
||||
//
|
||||
// m_log.DebugFormat(
|
||||
// "[FREESWITCH]: FreeSwitchSLVoiceBuddyHTTPHandler() response {0}",
|
||||
// normalizeEndLines.Replace((string)response["str_response_string"],""));
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public Hashtable FreeSwitchSLVoiceWatcherHTTPHandler(Hashtable request)
|
||||
{
|
||||
m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceWatcherHTTPHandler called");
|
||||
|
||||
Hashtable response = new Hashtable();
|
||||
response["int_response_code"] = 200;
|
||||
response["content-type"] = "text/xml";
|
||||
|
||||
Hashtable requestBody = ParseRequestBody((string)request["body"]);
|
||||
|
||||
string auth_token = (string)requestBody["auth_token"];
|
||||
//string[] auth_tokenvals = auth_token.Split(':');
|
||||
//string username = auth_tokenvals[0];
|
||||
|
||||
StringBuilder resp = new StringBuilder();
|
||||
resp.Append("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?><response xmlns=\"http://www.vivox.com\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation= \"/xsd/buddy_list.xsd\">");
|
||||
|
||||
// FIXME: This is enough of a response to stop viewer 2 complaining about a login failure and get voice to work. If we don't
|
||||
// give an OK response, then viewer 2 engages in an continuous viv_signin.php, viv_buddy.php, viv_watcher.php loop
|
||||
// Viewer 1 appeared happy to ignore the lack of reply and still works with this reply.
|
||||
//
|
||||
// However, really we need to fill in whatever watcher data should be here (whatever that is).
|
||||
resp.Append(string.Format(@"<level0>
|
||||
<status>OK</status>
|
||||
<cookie_name>lib_session</cookie_name>
|
||||
<cookie>{0}</cookie>
|
||||
<auth_token>{0}</auth_token>
|
||||
<body/></level0></response>", auth_token));
|
||||
|
||||
response["str_response_string"] = resp.ToString();
|
||||
|
||||
// Regex normalizeEndLines = new Regex(@"(\r\n|\n)", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
|
||||
//
|
||||
// m_log.DebugFormat(
|
||||
// "[FREESWITCH]: FreeSwitchSLVoiceWatcherHTTPHandler() response {0}",
|
||||
// normalizeEndLines.Replace((string)response["str_response_string"],""));
|
||||
|
||||
//m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],""));
|
||||
return response;
|
||||
}
|
||||
|
||||
public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request)
|
||||
{
|
||||
m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceSigninHTTPHandler called");
|
||||
m_log.Debug("[FreeSwitchVoice]: FreeSwitchSLVoiceSigninHTTPHandler called");
|
||||
// string requestbody = (string)request["body"];
|
||||
// string uri = (string)request["uri"];
|
||||
// string contenttype = (string)request["content-type"];
|
||||
|
@ -710,6 +760,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
</response>", userid, pos, avatarName);
|
||||
|
||||
response["int_response_code"] = 200;
|
||||
|
||||
// m_log.DebugFormat("[FreeSwitchVoice]: Sending FreeSwitchSLVoiceSigninHTTPHandler response");
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -800,11 +853,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
|||
string section = (string) requestBody["section"];
|
||||
|
||||
if (section == "directory")
|
||||
{
|
||||
string eventCallingFunction = (string)requestBody["Event-Calling-Function"];
|
||||
m_log.DebugFormat(
|
||||
"[FreeSwitchVoice]: Received request for config section directory, event calling function '{0}'",
|
||||
eventCallingFunction);
|
||||
|
||||
response = m_FreeswitchService.HandleDirectoryRequest(requestBody);
|
||||
}
|
||||
else if (section == "dialplan")
|
||||
{
|
||||
m_log.DebugFormat("[FreeSwitchVoice]: Received request for config section dialplan");
|
||||
|
||||
response = m_FreeswitchService.HandleDialplanRequest(requestBody);
|
||||
}
|
||||
else
|
||||
m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
|
||||
m_log.WarnFormat("[FreeSwitchVoice]: Unknown section {0} was requested from config.", section);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
|
|
@ -786,18 +786,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
{
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID,
|
||||
uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask,
|
||||
uint NextOwnerMask, int OwnershipCost, byte SaleType, int SalePrice, uint Category,
|
||||
UUID LastOwnerID, string ObjectName, string Description)
|
||||
public void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID,
|
||||
UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID,
|
||||
UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName,
|
||||
string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask,
|
||||
uint BaseMask, byte saleType, int salePrice)
|
||||
public void SendObjectPropertiesReply(ISceneEntity entity)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -648,6 +648,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
if (pbs.ProfileHollow != 0)
|
||||
iPropertiesNotSupportedDefault++;
|
||||
|
||||
if ((pbs.PathBegin != 0) || pbs.PathEnd != 0)
|
||||
iPropertiesNotSupportedDefault++;
|
||||
|
||||
if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0))
|
||||
iPropertiesNotSupportedDefault++;
|
||||
|
||||
|
|
|
@ -84,10 +84,11 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
public Meshmerizer(IConfigSource config)
|
||||
{
|
||||
IConfig start_config = config.Configs["Startup"];
|
||||
IConfig mesh_config = config.Configs["Mesh"];
|
||||
|
||||
decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache");
|
||||
cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps);
|
||||
useMeshiesPhysicsMesh = start_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh);
|
||||
useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -62,6 +62,8 @@ namespace PrimMesher
|
|||
|
||||
bool needsScaling = false;
|
||||
|
||||
bool smallMap = bmW * bmH <= lod * lod;
|
||||
|
||||
width = bmW;
|
||||
height = bmH;
|
||||
while (width * height > numLodPixels)
|
||||
|
@ -104,9 +106,14 @@ namespace PrimMesher
|
|||
{
|
||||
for (int x = 0; x <= width; x++)
|
||||
{
|
||||
int bmY = y < height ? y * 2 : y * 2 - 1;
|
||||
int bmX = x < width ? x * 2 : x * 2 - 1;
|
||||
Color c = bm.GetPixel(bmX, bmY);
|
||||
Color c;
|
||||
|
||||
if (smallMap)
|
||||
c = bm.GetPixel(x < width ? x : x - 1,
|
||||
y < height ? y : y - 1);
|
||||
else
|
||||
c = bm.GetPixel(x < width ? x * 2 : x * 2 - 1,
|
||||
y < height ? y * 2 : y * 2 - 1);
|
||||
|
||||
redBytes[byteNdx] = c.R;
|
||||
greenBytes[byteNdx] = c.G;
|
||||
|
|
|
@ -2528,6 +2528,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
if (pbs.ProfileHollow != 0)
|
||||
iPropertiesNotSupportedDefault++;
|
||||
|
||||
if ((pbs.PathBegin != 0) || pbs.PathEnd != 0)
|
||||
iPropertiesNotSupportedDefault++;
|
||||
|
||||
if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0))
|
||||
iPropertiesNotSupportedDefault++;
|
||||
|
||||
|
|
|
@ -10289,12 +10289,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
UUID rq = UUID.Random();
|
||||
|
||||
UUID tid = AsyncCommands.
|
||||
DataserverPlugin.RegisterRequest(m_localID,
|
||||
m_itemID, rq.ToString());
|
||||
AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString());
|
||||
|
||||
AsyncCommands.
|
||||
DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id)));
|
||||
AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id)));
|
||||
|
||||
return rq.ToString();
|
||||
}
|
||||
|
@ -10308,12 +10305,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
UUID rq = UUID.Random();
|
||||
|
||||
UUID tid = AsyncCommands.
|
||||
DataserverPlugin.RegisterRequest(m_localID,
|
||||
m_itemID, rq.ToString());
|
||||
AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString());
|
||||
|
||||
AsyncCommands.
|
||||
DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id));
|
||||
AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id));
|
||||
|
||||
return rq.ToString();
|
||||
}
|
||||
|
|
|
@ -89,6 +89,8 @@ namespace OpenSim.Services.AssetService
|
|||
|
||||
public virtual AssetBase Get(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id);
|
||||
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(id, out assetID))
|
||||
|
@ -107,6 +109,8 @@ namespace OpenSim.Services.AssetService
|
|||
|
||||
public virtual AssetMetadata GetMetadata(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSET SERVICE]: Get asset metadata for {0}", id);
|
||||
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(id, out assetID))
|
||||
|
@ -121,6 +125,8 @@ namespace OpenSim.Services.AssetService
|
|||
|
||||
public virtual byte[] GetData(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSET SERVICE]: Get asset data for {0}", id);
|
||||
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(id, out assetID))
|
||||
|
@ -150,7 +156,9 @@ namespace OpenSim.Services.AssetService
|
|||
|
||||
public virtual string Store(AssetBase asset)
|
||||
{
|
||||
//m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
|
||||
// m_log.DebugFormat(
|
||||
// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length);
|
||||
|
||||
m_Database.StoreAsset(asset);
|
||||
|
||||
return asset.ID;
|
||||
|
|
|
@ -34,7 +34,6 @@ using Nini.Config;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenMetaverse;
|
||||
|
|
|
@ -33,7 +33,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
|
||||
|
|
|
@ -33,7 +33,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenMetaverse;
|
||||
|
|
|
@ -33,7 +33,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -32,7 +32,7 @@ using System.Reflection;
|
|||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
|
|
|
@ -33,7 +33,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -33,7 +33,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -34,7 +34,6 @@ using Nini.Config;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenMetaverse;
|
||||
|
|
|
@ -34,7 +34,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
using Nwc.XmlRpc;
|
||||
|
|
|
@ -36,7 +36,6 @@ using System.Text;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
|
|
@ -33,7 +33,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Server.Base;
|
||||
|
|
|
@ -33,7 +33,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
|
|
|
@ -50,13 +50,13 @@ namespace OpenSim.Services.FreeswitchService
|
|||
|
||||
public Hashtable HandleDialplanRequest(Hashtable request)
|
||||
{
|
||||
m_log.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}",request.ToString());
|
||||
m_log.DebugFormat("[FreeSwitchVoice]: HandleDialplanRequest called with {0}",request.ToString());
|
||||
|
||||
Hashtable response = new Hashtable();
|
||||
|
||||
foreach (DictionaryEntry item in request)
|
||||
{
|
||||
m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value);
|
||||
// m_log.InfoFormat("[FreeSwitchDirectory]: requestBody item {0} {1}",item.Key, item.Value);
|
||||
}
|
||||
|
||||
string requestcontext = (string) request["Hunt-Context"];
|
||||
|
@ -66,7 +66,7 @@ namespace OpenSim.Services.FreeswitchService
|
|||
|
||||
if (m_freeSwitchContext != String.Empty && m_freeSwitchContext != requestcontext)
|
||||
{
|
||||
m_log.Debug("[FreeSwitchDirectory] returning empty as it's for another context");
|
||||
m_log.Debug("[FreeSwitchDirectory]: returning empty as it's for another context");
|
||||
response["str_response_string"] = "";
|
||||
}
|
||||
else
|
||||
|
@ -116,13 +116,16 @@ namespace OpenSim.Services.FreeswitchService
|
|||
{
|
||||
Hashtable response = new Hashtable();
|
||||
string domain = (string) request["domain"];
|
||||
if (domain != m_freeSwitchRealm) {
|
||||
if (domain != m_freeSwitchRealm)
|
||||
{
|
||||
response["content_type"] = "text/xml";
|
||||
response["keepalive"] = false;
|
||||
response["int_response_code"] = 200;
|
||||
response["str_response_string"] = "";
|
||||
} else {
|
||||
m_log.DebugFormat("[FreeSwitchDirectory] HandleDirectoryRequest called with {0}",request.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[FreeSwitchDirectory]: HandleDirectoryRequest called with {0}",request.ToString());
|
||||
|
||||
// information in the request we might be interested in
|
||||
|
||||
|
@ -143,10 +146,8 @@ namespace OpenSim.Services.FreeswitchService
|
|||
//domain=9.20.151.43
|
||||
//ip=9.167.220.137 // this is the correct IP rather than sip_contact_host above when through a vpn or NAT setup
|
||||
|
||||
foreach (DictionaryEntry item in request)
|
||||
{
|
||||
m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}", item.Key, item.Value);
|
||||
}
|
||||
// foreach (DictionaryEntry item in request)
|
||||
// m_log.DebugFormat("[FreeSwitchDirectory]: requestBody item {0} {1}", item.Key, item.Value);
|
||||
|
||||
string eventCallingFunction = (string) request["Event-Calling-Function"];
|
||||
if (eventCallingFunction == null)
|
||||
|
@ -173,7 +174,7 @@ namespace OpenSim.Services.FreeswitchService
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod);
|
||||
m_log.ErrorFormat("[FreeSwitchVoice]: HandleDirectoryRequest unknown sip_auth_method {0}",sipAuthMethod);
|
||||
response["int_response_code"] = 404;
|
||||
response["content_type"] = "text/xml";
|
||||
response["str_response_string"] = "";
|
||||
|
@ -205,7 +206,7 @@ namespace OpenSim.Services.FreeswitchService
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction);
|
||||
m_log.ErrorFormat("[FreeSwitchVoice]: HandleDirectoryRequest unknown Event-Calling-Function {0}",eventCallingFunction);
|
||||
response["int_response_code"] = 404;
|
||||
response["keepalive"] = false;
|
||||
response["content_type"] = "text/xml";
|
||||
|
@ -217,7 +218,7 @@ namespace OpenSim.Services.FreeswitchService
|
|||
|
||||
private Hashtable HandleRegister(string Context, string Realm, Hashtable request)
|
||||
{
|
||||
m_log.Info("[FreeSwitchDirectory] HandleRegister called");
|
||||
m_log.Info("[FreeSwitchDirectory]: HandleRegister called");
|
||||
|
||||
// TODO the password we return needs to match that sent in the request, this is hard coded for now
|
||||
string password = "1234";
|
||||
|
@ -254,7 +255,7 @@ namespace OpenSim.Services.FreeswitchService
|
|||
|
||||
private Hashtable HandleInvite(string Context, string Realm, Hashtable request)
|
||||
{
|
||||
m_log.Info("[FreeSwitchDirectory] HandleInvite called");
|
||||
m_log.Info("[FreeSwitchDirectory]: HandleInvite called");
|
||||
|
||||
// TODO the password we return needs to match that sent in the request, this is hard coded for now
|
||||
string password = "1234";
|
||||
|
@ -301,7 +302,7 @@ namespace OpenSim.Services.FreeswitchService
|
|||
|
||||
private Hashtable HandleLocateUser(String Realm, Hashtable request)
|
||||
{
|
||||
m_log.Info("[FreeSwitchDirectory] HandleLocateUser called");
|
||||
m_log.Info("[FreeSwitchDirectory]: HandleLocateUser called");
|
||||
|
||||
// TODO the password we return needs to match that sent in the request, this is hard coded for now
|
||||
string domain = (string) request["domain"];
|
||||
|
@ -335,7 +336,7 @@ namespace OpenSim.Services.FreeswitchService
|
|||
|
||||
private Hashtable HandleConfigSofia(string Context, string Realm, Hashtable request)
|
||||
{
|
||||
m_log.Info("[FreeSwitchDirectory] HandleConfigSofia called");
|
||||
m_log.Info("[FreeSwitchDirectory]: HandleConfigSofia called.");
|
||||
|
||||
// TODO the password we return needs to match that sent in the request, this is hard coded for now
|
||||
string domain = (string) request["domain"];
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Services.FreeswitchService
|
|||
m_freeSwitchDefaultWellKnownIP = freeswitchConfig.GetString("ServerAddress", String.Empty);
|
||||
if (m_freeSwitchDefaultWellKnownIP == String.Empty)
|
||||
{
|
||||
m_log.Error("[FREESWITCH]: No FreeswitchServerAddress given, can't continue");
|
||||
m_log.Error("[FREESWITCH]: No ServerAddress given, cannot start service.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,11 @@ namespace OpenSim.Services.Interfaces
|
|||
/// <returns></returns>
|
||||
AssetMetadata GetMetadata(string id);
|
||||
|
||||
/// <summary>
|
||||
/// Get an asset's data, ignoring the metadata.
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>null if there is no such asset</returns>
|
||||
byte[] GetData(string id);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace OpenSim.Services.Interfaces
|
|||
/// Get an item, given by its UUID
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns>null if no item was found, otherwise the found item</returns>
|
||||
InventoryItemBase GetItem(InventoryItemBase item);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
* 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.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Tests.Common.Mock
|
||||
{
|
||||
public class MockAssetService : IAssetService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly Dictionary<string, AssetBase> Assets = new Dictionary<string, AssetBase>();
|
||||
|
||||
public MockAssetService() {}
|
||||
|
||||
/// <summary>
|
||||
/// This constructor is required if the asset service is being created reflectively (which is the case in some
|
||||
/// tests).
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
public MockAssetService(IConfigSource config) {}
|
||||
|
||||
public AssetBase Get(string id)
|
||||
{
|
||||
m_log.DebugFormat("[MOCK ASSET SERVICE]: Getting asset with id {0}", id);
|
||||
|
||||
AssetBase asset;
|
||||
if (Assets.ContainsKey(id))
|
||||
asset = Assets[id];
|
||||
else
|
||||
asset = null;
|
||||
|
||||
return asset;
|
||||
}
|
||||
|
||||
public AssetBase GetCached(string id)
|
||||
{
|
||||
return Get(id);
|
||||
}
|
||||
|
||||
public AssetMetadata GetMetadata(string id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public byte[] GetData(string id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Get(string id, object sender, AssetRetrieved handler)
|
||||
{
|
||||
handler(id, sender, Get(id));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public string Store(AssetBase asset)
|
||||
{
|
||||
m_log.DebugFormat("[MOCK ASSET SERVICE]: Storing asset {0}", asset.ID);
|
||||
|
||||
Assets[asset.ID] = asset;
|
||||
|
||||
return asset.ID;
|
||||
}
|
||||
|
||||
public bool UpdateContent(string id, byte[] data)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Delete(string id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,186 +0,0 @@
|
|||
/*
|
||||
* 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.Text;
|
||||
using OpenSim.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Tests.Common.Mock
|
||||
{
|
||||
public class MockInventoryService : IInventoryService
|
||||
{
|
||||
public MockInventoryService() {}
|
||||
|
||||
public MockInventoryService(IConfigSource config) {}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public bool CreateUserInventory(UUID userId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
|
||||
{
|
||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
||||
InventoryFolderBase folder = new InventoryFolderBase();
|
||||
folder.ID = UUID.Random();
|
||||
folder.Owner = userId;
|
||||
folders.Add(folder);
|
||||
return folders;
|
||||
}
|
||||
|
||||
public InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
return new InventoryFolderBase();
|
||||
}
|
||||
|
||||
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all the active gestures in a user's inventory.
|
||||
/// </summary>
|
||||
/// <param name="userId">
|
||||
/// The <see cref="UUID"/> of the user
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A flat list of the gesture items.
|
||||
/// </returns>
|
||||
public List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public InventoryCollection GetUserInventory(UUID userID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback)
|
||||
{
|
||||
}
|
||||
|
||||
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool AddFolder(InventoryFolderBase folder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool UpdateFolder(InventoryFolderBase folder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool MoveFolder(InventoryFolderBase folder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool DeleteFolders(UUID ownerID, List<UUID> ids)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool PurgeFolder(InventoryFolderBase folder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AddItem(InventoryItemBase item)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool UpdateItem(InventoryItemBase item)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool HasInventoryForUser(UUID userID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public InventoryFolderBase RequestRootFolder(UUID userID)
|
||||
{
|
||||
InventoryFolderBase root = new InventoryFolderBase();
|
||||
root.ID = UUID.Random();
|
||||
root.Owner = userID;
|
||||
root.ParentID = UUID.Zero;
|
||||
return root;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -816,18 +816,11 @@ namespace OpenSim.Tests.Common.Mock
|
|||
{
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID,
|
||||
uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask,
|
||||
uint NextOwnerMask, int OwnershipCost, byte SaleType,int SalePrice, uint Category,
|
||||
UUID LastOwnerID, string ObjectName, string Description)
|
||||
public void SendObjectPropertiesFamilyData(ISceneEntity Entity, uint RequestFlags)
|
||||
{
|
||||
}
|
||||
|
||||
public void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID,
|
||||
UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID,
|
||||
UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName,
|
||||
string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask,
|
||||
uint BaseMask, byte saleType, int salePrice)
|
||||
public void SendObjectPropertiesReply(ISceneEntity entity)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ using OpenMetaverse;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Tests.Common
|
||||
{
|
||||
|
@ -72,6 +73,35 @@ namespace OpenSim.Tests.Common
|
|||
sog.OwnerID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an asset from the given scene object.
|
||||
/// </summary>
|
||||
/// <param name="assetUuidTailZ">
|
||||
/// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
|
||||
/// will be used.
|
||||
/// </param>
|
||||
/// <param name="coa"></param>
|
||||
/// <returns></returns>
|
||||
public static AssetBase CreateAsset(int assetUuidTail, CoalescedSceneObjects coa)
|
||||
{
|
||||
return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), coa);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an asset from the given scene object.
|
||||
/// </summary>
|
||||
/// <param name="assetUuid"></param>
|
||||
/// <param name="coa"></param>
|
||||
/// <returns></returns>
|
||||
public static AssetBase CreateAsset(UUID assetUuid, CoalescedSceneObjects coa)
|
||||
{
|
||||
return CreateAsset(
|
||||
assetUuid,
|
||||
AssetType.Object,
|
||||
Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)),
|
||||
coa.CreatorId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an asset from the given data.
|
||||
/// </summary>
|
||||
|
@ -89,5 +119,11 @@ namespace OpenSim.Tests.Common
|
|||
asset.Data = data;
|
||||
return asset;
|
||||
}
|
||||
|
||||
public static string ReadAssetAsString(IAssetService assetService, UUID uuid)
|
||||
{
|
||||
byte[] assetData = assetService.GetData(uuid.ToString());
|
||||
return Encoding.ASCII.GetString(assetData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue