Merge branch 'master' of ssh://dahlia@myConnection01/var/git/opensim

mysql-performance
dahlia 2009-11-30 01:09:46 -08:00
commit 5b0bb1eff9
48 changed files with 777 additions and 928 deletions

View File

@ -1,170 +1,173 @@
The following people have contributed to OpenSim (Thank you
for your effort!)
Add your name in here if you have committed to OpenSim
= Current OpenSim Developers (in very rough order of appearance) =
These folks represent the current core team for OpenSim, and are the
people that make the day to day of OpenSim happen.
* MW (Tribal Media AB)
* Adam Frisby (DeepThink Pty Ltd)
* MingChen (DeepThink Pty Ltd)
* lbsa71 (Tribal Media AB)
* Sean Dague / sdague (IBM)
* Tedd
* justincc
* Teravus (w3z)
* Johan Berntsson (3Di)
* Ckrinke (Charles Krinke)
* chi11ken (Genkii)
* adjohn (Genkii)
* Dr Scofield aka Dirk Husemann (IBM Research - Zurich)
* dahlia
* mikem (3Di)
* Melanie Thielker
* Homer_Horwitz
* idb (Ian Brown)
* Diva (Crista Lopes, University of California, Irvine)
* nlin (3Di)
* Arthur Rodrigo S Valadares (IBM)
= Past Open Sim Developers =
These folks are alumns of the OpenSim core group, but are now
currently not active. Their great contributions helped get us to
where we are today.
* Gareth
* Andy-
* MorphW
* CW
* Babblefrog
* Danx0r
* Dalien
* Darok
* Alondria
= Additional OpenSim Contributors =
These folks have contributed code patches to OpenSim to help make it
what it is today.
* aduffy70
* A_Biondi
* alex_carnell
* Alan Webb (IBM)
* BigFootAg
* BlueWall Slade
* brianw/Sir_Ahzz
* CharlieO
* ChrisDown
* Chris Yeoh (IBM)
* coyled
* Daedius
* Dong Jun Lan (IBM)
* DoranZemlja
* daTwitch
* devalnor-#708
* dmiles (Daxtron Labs)
* dslake (Intel)
* FredoChaplin
* Gerhard
* Godfrey
* Grumly57
* Ewe Loon
* Fly-Man
* Flyte Xevious
* Imaze Rhiano
* Intimidated
* Jeremy Bongio (IBM)
* jhurliman
* John R Sohn (XenReborn)
* jonc
* Junta Kohime
* Kayne
* Kevin Cozens
* kinoc (Daxtron Labs)
* Kitto Flora
* Kurt Taylor (IBM)
* lulurun
* M.Igarashi
* maimedleech
* Mic Bowman
* Michelle Argus
* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
* Mike Osias (IBM)
* Mike Pitman (IBM)
* mikkopa/_someone - RealXtend
* Mircea Kitsune
* mpallari
* nornalbion
* Omar Vera Ustariz (IBM)
* openlifegrid.com
* otakup0pe
* ralphos
* RemedyTomm
* Richard Alimi (IBM)
* Rick Alther (IBM)
* Rob Smart (IBM)
* rtomita
* Ruud Lathorp
* SachaMagne
* Salahzar Stenvaag
* sempuki
* Snoopy
* Strawberry Fride
* tglion
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
* tyre
* Vytek
* webmage (IBM)
* Xantor
* Y. Nitta
* YZh
* Zackary Geers aka Kunnis Basiat
* Zha Ewry
= LSL Devs =
* Alondria
* CharlieO
* Tedd
* Melanie Thielker
= Testers =
* Ai Austin
* CharlieO (LSL)
* Ckrinke
* openlifegrid.com
This software uses components from the following developers:
* Sleepycat Software (Berkeley DB)
* SQLite (Public Domain)
* XmlRpcCS (http://xmlrpccs.sf.net/)
* MySQL, Inc. (MySQL Connector/NET)
* NUnit (http://www.nunit.org)
* AGEIA Inc. (PhysX)
* Russel L. Smith (ODE)
* Prebuild (http://sourceforge.net/projects/dnpb/)
* LibOpenMetaverse (http://lib.openmetaverse.org/)
* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net)
* Prototype JavaScript Framework ajax (http://www.prototypejs.org/)
* C5 GENERIC COLLECTION LIBRARY FOR C#/CLI
* Nini (http://nini.sourceforge.net/)
* log4net (http://logging.apache.org/log4net/)
* GlynnTucker.Cache (http://gtcache.sourceforge.net/)
* NDesk.Options 0.2.1 (http://www.ndesk.org/Options)
Some plugins are based on Cable Beach
Cable Beach is Copyright (c) 2008 Intel Corporation
see http://forge.opensimulator.org/gf/project/assetserver/
In addition, we would like to thank:
* The Mono Project
* The NANT Developers
* Microsoft (.NET, MSSQL-Adapters)
The following people have contributed to OpenSim (Thank you
for your effort!)
Add your name in here if you have committed to OpenSim
= Current OpenSim Developers (in very rough order of appearance) =
These folks represent the current core team for OpenSim, and are the
people that make the day to day of OpenSim happen.
* MW (Tribal Media AB)
* Adam Frisby (DeepThink Pty Ltd)
* MingChen (DeepThink Pty Ltd)
* lbsa71 (Tribal Media AB)
* Sean Dague / sdague (IBM)
* Tedd
* justincc
* Teravus (w3z)
* Johan Berntsson (3Di)
* Ckrinke (Charles Krinke)
* chi11ken (Genkii)
* adjohn (Genkii)
* Dr Scofield aka Dirk Husemann (IBM Research - Zurich)
* dahlia
* mikem (3Di)
* Melanie Thielker
* Homer_Horwitz
* idb (Ian Brown)
* Diva (Crista Lopes, University of California, Irvine)
* nlin (3Di)
* Arthur Rodrigo S Valadares (IBM)
= Past Open Sim Developers =
These folks are alumns of the OpenSim core group, but are now
currently not active. Their great contributions helped get us to
where we are today.
* Gareth
* Andy-
* MorphW
* CW
* Babblefrog
* Danx0r
* Dalien
* Darok
* Alondria
= Additional OpenSim Contributors =
These folks have contributed code patches to OpenSim to help make it
what it is today.
* aduffy70
* A_Biondi
* alex_carnell
* Alan Webb (IBM)
* BigFootAg
* BlueWall Slade
* brianw/Sir_Ahzz
* CharlieO
* ChrisDown
* Chris Yeoh (IBM)
* coyled
* Daedius
* Dong Jun Lan (IBM)
* DoranZemlja
* daTwitch
* devalnor-#708
* dmiles (Daxtron Labs)
* dslake (Intel)
* FredoChaplin
* Gerhard
* Godfrey
* Grumly57
* Ewe Loon
* Fly-Man
* Flyte Xevious
* Imaze Rhiano
* Intimidated
* Jeremy Bongio (IBM)
* jhurliman
* John R Sohn (XenReborn)
* jonc
* Junta Kohime
* Kayne
* Kevin Cozens
* kinoc (Daxtron Labs)
* Kitto Flora
* KittyLiu
* Kurt Taylor (IBM)
* lulurun
* M.Igarashi
* maimedleech
* Mic Bowman
* Michelle Argus
* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
* Mike Osias (IBM)
* Mike Pitman (IBM)
* mikkopa/_someone - RealXtend
* Misterblue (Intel)
* Mircea Kitsune
* mpallari
* nornalbion
* Omar Vera Ustariz (IBM)
* openlifegrid.com
* otakup0pe
* ralphos
* RemedyTomm
* Revolution
* Richard Alimi (IBM)
* Rick Alther (IBM)
* Rob Smart (IBM)
* rtomita
* Ruud Lathorp
* SachaMagne
* Salahzar Stenvaag
* sempuki
* Snoopy
* Strawberry Fride
* tglion
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
* tyre
* Vytek
* webmage (IBM)
* Xantor
* Y. Nitta
* YZh
* Zackary Geers aka Kunnis Basiat
* Zha Ewry
= LSL Devs =
* Alondria
* CharlieO
* Tedd
* Melanie Thielker
= Testers =
* Ai Austin
* CharlieO (LSL)
* Ckrinke
* openlifegrid.com
This software uses components from the following developers:
* Sleepycat Software (Berkeley DB)
* SQLite (Public Domain)
* XmlRpcCS (http://xmlrpccs.sf.net/)
* MySQL, Inc. (MySQL Connector/NET)
* NUnit (http://www.nunit.org)
* AGEIA Inc. (PhysX)
* Russel L. Smith (ODE)
* Prebuild (http://sourceforge.net/projects/dnpb/)
* LibOpenMetaverse (http://lib.openmetaverse.org/)
* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net)
* Prototype JavaScript Framework ajax (http://www.prototypejs.org/)
* C5 GENERIC COLLECTION LIBRARY FOR C#/CLI
* Nini (http://nini.sourceforge.net/)
* log4net (http://logging.apache.org/log4net/)
* GlynnTucker.Cache (http://gtcache.sourceforge.net/)
* NDesk.Options 0.2.1 (http://www.ndesk.org/Options)
Some plugins are based on Cable Beach
Cable Beach is Copyright (c) 2008 Intel Corporation
see http://forge.opensimulator.org/gf/project/assetserver/
In addition, we would like to thank:
* The Mono Project
* The NANT Developers
* Microsoft (.NET, MSSQL-Adapters)

View File

@ -154,13 +154,14 @@ namespace OpenSim.Data.Tests
);
}
//[Test]
// Currently fails occasionally
[Test]
public void T012_EstateSettingsRandomStorage()
{
// Letting estate store generate rows to database for us
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
new PropertyScrambler<EstateSettings>().Scramble(originalSettings);
new PropertyScrambler<EstateSettings>()
.DontScramble(x=>x.EstateID)
.Scramble(originalSettings);
// Saving settings.
db.StoreEstateSettings(originalSettings);

View File

@ -32,7 +32,6 @@ namespace OpenSim.Framework
{
public delegate void ExpectUserDelegate(AgentCircuitData agent);
public delegate bool ExpectPrimDelegate(UUID primID, string objData, int XMLMethod);
public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
@ -55,7 +54,6 @@ namespace OpenSim.Framework
public interface IRegionCommsListener
{
event ExpectUserDelegate OnExpectUser;
event ExpectPrimDelegate OnExpectPrim;
event GenericCall2 OnExpectChildAgent;
event AgentCrossing OnAvatarCrossingIntoRegion;
event PrimCrossing OnPrimCrossingIntoRegion;

View File

@ -38,6 +38,6 @@ namespace OpenSim.Framework
string ExtraToXmlString();
void ExtraFromXmlString(string xmlstr);
string GetStateSnapshot();
void SetState(string xmlstr, UUID regionID);
void SetState(string xmlstr, IScene s);
}
}

View File

@ -43,7 +43,6 @@ namespace OpenSim.Framework
private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent;
private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser
private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
@ -53,7 +52,6 @@ namespace OpenSim.Framework
#region IRegionCommsListener Members
public event ExpectUserDelegate OnExpectUser;
public event ExpectPrimDelegate OnExpectPrim;
public event GenericCall2 OnExpectChildAgent;
public event AgentCrossing OnAvatarCrossingIntoRegion;
public event PrimCrossing OnPrimCrossingIntoRegion;
@ -95,17 +93,6 @@ namespace OpenSim.Framework
}
public virtual bool TriggerExpectPrim(UUID primID, string objData, int XMLMethod)
{
handlerExpectPrim = OnExpectPrim;
if (handlerExpectPrim != null)
{
handlerExpectPrim(primID, objData, XMLMethod);
return true;
}
return false;
}
public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData)
{
handlerChildAgentUpdate = OnChildAgentUpdate;
@ -128,18 +115,6 @@ namespace OpenSim.Framework
return false;
}
public virtual bool TriggerExpectPrimCrossing(UUID primID, Vector3 position,
bool isPhysical)
{
handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
if (handlerPrimCrossingIntoRegion != null)
{
handlerPrimCrossingIntoRegion(primID, position, isPhysical);
return true;
}
return false;
}
public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID)
{
handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed;

View File

@ -442,7 +442,7 @@ namespace OpenSim.Framework.Servers
if (File.Exists(gitCommitFileName))
{
StreamReader CommitFile = File.OpenText(gitCommitFileName);
buildVersion = Environment.NewLine + "git# " + CommitFile.ReadLine();
buildVersion = CommitFile.ReadLine();
CommitFile.Close();
m_version += buildVersion ?? "";
}

View File

@ -29,7 +29,7 @@ namespace OpenSim
{
public class VersionInfo
{
private const string VERSION_NUMBER = "0.6.8";
private const string VERSION_NUMBER = "0.6.9";
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
public enum Flavour

View File

@ -1389,6 +1389,30 @@ namespace OpenSim.Framework
return null;
}
#endregion FireAndForget Threading Pattern
#endregion FireAndForget Threading Pattern
/// <summary>
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
/// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
/// for the callers.
/// This trims it to a 12 day interval so don't let your frame time get too long.
/// </summary>
/// <returns></returns>
public static Int32 EnvironmentTickCount()
{
return Environment.TickCount & EnvironmentTickCountMask;
}
const Int32 EnvironmentTickCountMask = 0x3fffffff;
/// <summary>
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
/// 'EnvironmentTickCount()') and accounts for any wrapping.
/// </summary>
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
public static Int32 EnvironmentTickCountSubtract(Int32 prevValue)
{
Int32 diff = EnvironmentTickCount() - prevValue;
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
}
}
}

View File

@ -13610,7 +13610,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerGodKickUser != null)
{
handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
gkupack.UserInfo.AgentID, (uint)0, gkupack.UserInfo.Reason);
gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason,gkupack.UserInfo);
}
}
else

View File

@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading;
using log4net;
using OpenSim.Framework;
using OpenMetaverse;
@ -429,7 +430,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Send the packet
m_udpServer.SendPacketFinal(nextPacket);
m_nextPackets[i] = null;
packetSent = true;
packetSent = true;
this.PacketsSent++;
}
}
else
@ -446,6 +448,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Send the packet
m_udpServer.SendPacketFinal(packet);
packetSent = true;
this.PacketsSent++;
}
else
{

View File

@ -138,6 +138,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// whether or not to sleep</summary>
private bool m_packetSent;
/// <summary>Environment.TickCount of the last time that packet stats were reported to the scene</summary>
private int m_elapsedMSSinceLastStatReport = 0;
/// <summary>Environment.TickCount of the last time the outgoing packet handler executed</summary>
private int m_tickLastOutgoingPacketHandler;
/// <summary>Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped</summary>
@ -246,6 +248,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Start the packet processing threads
Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
m_elapsedMSSinceLastStatReport = Environment.TickCount;
}
public new void Stop()
@ -716,6 +719,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// We don't need to do anything else with ping checks
StartPingCheckPacket startPing = (StartPingCheckPacket)packet;
CompletePing(udpClient, startPing.PingID.PingID);
if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000)
{
udpClient.SendPacketStats();
m_elapsedMSSinceLastStatReport = Environment.TickCount;
}
return;
}
else if (packet.Type == PacketType.CompletePingCheck)

View File

@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
/// <param name="godID">The person doing the kicking</param>
/// <param name="sessionID">The session of the person doing the kicking</param>
/// <param name="agentID">the person that is being kicked</param>
/// <param name="kickflags">This isn't used apparently</param>
/// <param name="kickflags">Tells what to do to the user</param>
/// <param name="reason">The message to send to the user after it's been turned into a field</param>
public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason)
{
@ -110,39 +110,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
{
if (m_scene.Permissions.IsGod(godID))
{
if (agentID == kickUserID)
if (kickflags == 0)
{
string reasonStr = Utils.BytesToString(reason);
if (agentID == kickUserID)
{
string reasonStr = Utils.BytesToString(reason);
m_scene.ForEachClient(
delegate(IClientAPI controller)
{
if (controller.AgentId != godID)
controller.Kick(reasonStr);
}
);
// This is a bit crude. It seems the client will be null before it actually stops the thread
// The thread will kill itself eventually :/
// Is there another way to make sure *all* clients get this 'inter region' message?
m_scene.ForEachScenePresence(
delegate(ScenePresence p)
{
if (p.UUID != godID && !p.IsChildAgent)
{
// Possibly this should really be p.Close() though that method doesn't send a close
// to the client
p.ControllingClient.Close();
m_scene.ForEachClient(
delegate(IClientAPI controller)
{
if (controller.AgentId != godID)
controller.Kick(reasonStr);
}
}
);
}
else
{
m_scene.SceneGraph.removeUserCount(!sp.IsChildAgent);
);
sp.ControllingClient.Kick(Utils.BytesToString(reason));
sp.ControllingClient.Close();
// This is a bit crude. It seems the client will be null before it actually stops the thread
// The thread will kill itself eventually :/
// Is there another way to make sure *all* clients get this 'inter region' message?
m_scene.ForEachScenePresence(
delegate(ScenePresence p)
{
if (p.UUID != godID && !p.IsChildAgent)
{
// Possibly this should really be p.Close() though that method doesn't send a close
// to the client
p.ControllingClient.Close();
}
}
);
}
else
{
m_scene.SceneGraph.removeUserCount(!sp.IsChildAgent);
sp.ControllingClient.Kick(Utils.BytesToString(reason));
sp.ControllingClient.Close();
}
}
if (kickflags == 1)
{
sp.AllowMovement = false;
m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
m_dialogModule.SendAlertToUser(godID, "User Frozen");
}
if (kickflags == 2)
{
sp.AllowMovement = true;
m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason));
m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
}
}
else

View File

@ -348,9 +348,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
if (UUID.Zero != ospResolvedId)
{
item.CreatorIdAsUuid = ospResolvedId;
// XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the
// database). Instead, replace with the UUID that we found.
item.CreatorId = ospResolvedId.ToString();
}
else
{
item.CreatorIdAsUuid = m_userInfo.UserProfile.ID;
}
item.Owner = m_userInfo.UserProfile.ID;

View File

@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
m_log.InfoFormat(
"[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}",
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
savePath, invPath, firstName, lastName);
Guid id = Guid.NewGuid();

View File

@ -259,9 +259,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the
// UUID, not the OSPA itself.
// Assert.That(
// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
// "Loaded item non-uuid creator doesn't match original");
Assert.That(
foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()),
"Loaded item non-uuid creator doesn't match original");
Assert.That(
foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid),
"Loaded item uuid creator doesn't match original");

View File

@ -602,9 +602,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
ListenerInfo info =
ListenerInfo.FromData(localID, itemID, hostID, item);
if (!m_listeners.ContainsKey((int)item[2]))
m_listeners.Add((int)item[2], new List<ListenerInfo>());
m_listeners[(int)item[2]].Add(info);
lock (m_listeners)
{
if (!m_listeners.ContainsKey((int)item[2]))
m_listeners.Add((int)item[2], new List<ListenerInfo>());
m_listeners[(int)item[2]].Add(info);
}
idx+=6;
}

View File

@ -263,8 +263,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{
// We need to make a local copy of the object
ISceneObject sogClone = sog.CloneForNewScene();
sogClone.SetState(sog.GetStateSnapshot(),
s.RegionInfo.RegionID);
sogClone.SetState(sog.GetStateSnapshot(), s);
return s.IncomingCreateObject(sogClone);
}
else
@ -294,15 +293,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
#region Misc
public UUID GetRegionID(ulong regionhandle)
public Scene GetScene(ulong regionhandle)
{
foreach (Scene s in m_sceneList)
{
if (s.RegionInfo.RegionHandle == regionhandle)
return s.RegionInfo.RegionID;
return s;
}
// ? weird. should not happen
return m_sceneList[0].RegionInfo.RegionID;
return m_sceneList[0];
}
public bool IsLocalRegion(ulong regionhandle)

View File

@ -641,7 +641,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
if (args["extra"] != null)
extraStr = args["extra"].AsString();
UUID regionID = m_localBackend.GetRegionID(regionhandle);
IScene s = m_localBackend.GetScene(regionhandle);
SceneObjectGroup sog = null;
try
{
@ -663,7 +663,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{
try
{
sog.SetState(stateXmlStr, regionID);
sog.SetState(stateXmlStr, s);
}
catch (Exception ex)
{
@ -695,8 +695,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
if (args["itemid"] != null)
itemID = args["itemid"].AsUUID();
//UUID regionID = m_localBackend.GetRegionID(regionhandle);
// This is the meaning of PUT object
bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID);

View File

@ -454,6 +454,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <summary>
/// Resolve path to a working FileStream
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
private Stream GetStream(string path)
{
if (File.Exists(path))
@ -500,8 +502,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
WebResponse response = request.GetResponse();
Stream file = response.GetResponseStream();
if (response.ContentType != "application/x-oar")
throw new Exception(String.Format("{0} does not identify an OAR file", uri.ToString()));
// justincc: gonna ignore the content type for now and just try anything
//if (response.ContentType != "application/x-oar")
// throw new Exception(String.Format("{0} does not identify an OAR file", uri.ToString()));
if (response.ContentLength == 0)
throw new Exception(String.Format("{0} returned an empty file", uri.ToString()));

View File

@ -800,30 +800,31 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
protected bool GenericParcelOwnerPermission(UUID user, ILandObject parcel, ulong groupPowers)
{
bool permission = false;
{
if (parcel.LandData.OwnerID == user)
{
permission = true;
// Returning immediately so that group deeded objects on group deeded land don't trigger a NRE on
// the subsequent redundant checks when using lParcelMediaCommandList()
// See http://opensimulator.org/mantis/view.php?id=3999 for more details
return true;
}
if (parcel.LandData.IsGroupOwned && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
{
permission = true;
return true;
}
if (IsEstateManager(user))
{
permission = true;
return true;
}
if (IsAdministrator(user))
{
permission = true;
return true;
}
return permission;
return false;
}
protected bool GenericParcelPermission(UUID user, Vector3 pos, ulong groupPowers)

View File

@ -184,12 +184,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns></returns>
List<UUID> GetInventoryList();
/// <summary>
/// Get the names of the assemblies associated with scripts in this inventory.
/// </summary>
/// <returns></returns>
string[] GetScriptAssemblies();
/// <summary>
/// Get the xml representing the saved states of scripts in this inventory.
/// </summary>
@ -197,7 +191,5 @@ namespace OpenSim.Region.Framework.Interfaces
/// A <see cref="Dictionary`2"/>
/// </returns>
Dictionary<UUID, string> GetScriptStates();
bool CanBeDeleted();
}
}

View File

@ -34,9 +34,8 @@ namespace OpenSim.Region.Framework.Interfaces
{
string ScriptEngineName { get; }
string GetAssemblyName(UUID itemID);
string GetXMLState(UUID itemID);
bool CanBeDeleted(UUID itemID);
void SetXMLState(UUID itemID, string xml);
bool PostScriptEvent(UUID itemID, string name, Object[] args);
bool PostObjectEvent(UUID itemID, string name, Object[] args);

View File

@ -131,11 +131,6 @@ namespace OpenSim.Region.Framework.Scenes
if (left > 0)
{
x = m_inventoryDeletes.Dequeue();
if (!x.objectGroup.CanBeDeleted())
{
m_inventoryDeletes.Enqueue(x);
return true;
}
m_log.DebugFormat(
"[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);

View File

@ -310,7 +310,7 @@ namespace OpenSim.Region.Framework.Scenes
private Thread HeartbeatThread;
private volatile bool shuttingdown;
private int m_lastUpdate = Environment.TickCount;
private int m_lastUpdate;
private bool m_firstHeartbeat = true;
private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
@ -387,6 +387,11 @@ namespace OpenSim.Region.Framework.Scenes
{
get { return StatsReporter.getLastReportedSimFPS(); }
}
public float[] SimulatorStats
{
get { return StatsReporter.getLastReportedSimStats(); }
}
public string DefaultScriptEngine
{
@ -521,6 +526,7 @@ namespace OpenSim.Region.Framework.Scenes
m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName;
m_datastore = m_regInfo.DataStore;
m_lastUpdate = Util.EnvironmentTickCount();
m_physicalPrim = physicalPrim;
m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor;
@ -618,7 +624,7 @@ namespace OpenSim.Region.Framework.Scenes
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
m_persistAfter *= 10000000;
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine");
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
IConfig packetConfig = m_config.Configs["PacketPool"];
if (packetConfig != null)
@ -730,6 +736,8 @@ namespace OpenSim.Region.Framework.Scenes
m_regInfo = regInfo;
m_eventManager = new EventManager();
m_lastUpdate = Util.EnvironmentTickCount();
}
#endregion
@ -1084,7 +1092,7 @@ namespace OpenSim.Region.Framework.Scenes
HeartbeatThread.Abort();
HeartbeatThread = null;
}
m_lastUpdate = Environment.TickCount;
m_lastUpdate = Util.EnvironmentTickCount();
HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false);
}
@ -1125,7 +1133,7 @@ namespace OpenSim.Region.Framework.Scenes
{
Update();
m_lastUpdate = Environment.TickCount;
m_lastUpdate = Util.EnvironmentTickCount();
m_firstHeartbeat = false;
}
catch (ThreadAbortException)
@ -1151,10 +1159,11 @@ namespace OpenSim.Region.Framework.Scenes
while (!shuttingdown)
{
TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
physicsFPS = 0f;
maintc = otherMS = Environment.TickCount;
physicsFPS = 0f;
maintc = Util.EnvironmentTickCount();
int tmpFrameMS = maintc;
tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
// Increment the frame counter
++m_frame;
@ -1174,74 +1183,65 @@ namespace OpenSim.Region.Framework.Scenes
if (m_frame % m_update_presences == 0)
m_sceneGraph.UpdatePresences();
int TempPhysicsMS2 = Environment.TickCount;
int tmpPhysicsMS2 = Util.EnvironmentTickCount();
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
m_sceneGraph.UpdatePreparePhysics();
TempPhysicsMS2 = Environment.TickCount - TempPhysicsMS2;
physicsMS2 = TempPhysicsMS2;
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
if (m_frame % m_update_entitymovement == 0)
m_sceneGraph.UpdateScenePresenceMovement();
int TempPhysicsMS = Environment.TickCount;
m_sceneGraph.UpdateScenePresenceMovement();
int tmpPhysicsMS = Util.EnvironmentTickCount();
if (m_frame % m_update_physics == 0)
{
if (m_physics_enabled)
physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan));
if (SynchronizeScene != null)
SynchronizeScene(this);
}
TempPhysicsMS = Environment.TickCount - TempPhysicsMS;
physicsMS = TempPhysicsMS;
}
physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
// Delete temp-on-rez stuff
if (m_frame % m_update_backup == 0)
{
int tozMS = Environment.TickCount;
CleanTempObjects();
tozMS -= Environment.TickCount;
tempOnRezMS = tozMS;
{
int tmpTempOnRezMS = Util.EnvironmentTickCount();
CleanTempObjects();
tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
}
if (RegionStatus != RegionStatus.SlaveScene)
{
if (m_frame % m_update_events == 0)
{
int evMS = Environment.TickCount;
UpdateEvents();
evMS -= Environment.TickCount;
eventMS = evMS;
{
int evMS = Util.EnvironmentTickCount();
UpdateEvents();
eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
}
if (m_frame % m_update_backup == 0)
{
int backMS = Environment.TickCount;
UpdateStorageBackup();
backMS -= Environment.TickCount;
backupMS = backMS;
{
int backMS = Util.EnvironmentTickCount();
UpdateStorageBackup();
backupMS = Util.EnvironmentTickCountSubtract(backMS);
}
if (m_frame % m_update_terrain == 0)
{
int terMS = Environment.TickCount;
UpdateTerrain();
terMS -= Environment.TickCount;
terrainMS = terMS;
{
int terMS = Util.EnvironmentTickCount();
UpdateTerrain();
terrainMS = Util.EnvironmentTickCountSubtract(terMS);
}
if (m_frame % m_update_land == 0)
{
int ldMS = Environment.TickCount;
UpdateLand();
ldMS -= Environment.TickCount;
landMS = ldMS;
}
int tickCount = Environment.TickCount;
otherMS = tickCount - otherMS;
tmpFrameMS -= tickCount;
frameMS = tmpFrameMS;
lastCompletedFrame = tickCount;
{
int ldMS = Util.EnvironmentTickCount();
UpdateLand();
landMS = Util.EnvironmentTickCountSubtract(ldMS);
}
frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
lastCompletedFrame = Util.EnvironmentTickCount();
// if (m_frame%m_update_avatars == 0)
// UpdateInWorldTime();
@ -1293,9 +1293,9 @@ namespace OpenSim.Region.Framework.Scenes
finally
{
m_lastupdate = DateTime.UtcNow;
}
maintc = Environment.TickCount - maintc;
}
maintc = Util.EnvironmentTickCountSubtract(maintc);
maintc = (int)(m_timespan * 1000) - maintc;
if ((maintc < (m_timespan * 1000)) && maintc > 0)
@ -1306,6 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void AddGroupTarget(SceneObjectGroup grp)
{
@ -2381,103 +2382,6 @@ namespace OpenSim.Region.Framework.Scenes
return successYN;
}
/// <summary>
/// Handle a scene object that is crossing into this region from another.
/// NOTE: Unused as of 2009-02-09. Soon to be deleted.
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="primID"></param>
/// <param name="objXMLData"></param>
/// <param name="XMLMethod"></param>
/// <returns></returns>
public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod)
{
if (XMLMethod == 0)
{
m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID);
SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData);
if (sceneObject.IsAttachment)
sceneObject.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom;
return AddSceneObject(sceneObject);
}
else if ((XMLMethod == 100) && m_allowScriptCrossings)
{
m_log.Warn("[INTERREGION]: Prim state data arrived from a neighbor");
XmlDocument doc = new XmlDocument();
doc.LoadXml(objXMLData);
XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
if (rootL.Count == 1)
{
XmlNode rootNode = rootL[0];
if (rootNode != null)
{
XmlNodeList partL = rootNode.ChildNodes;
foreach (XmlNode part in partL)
{
XmlNodeList nodeL = part.ChildNodes;
switch (part.Name)
{
case "Assemblies":
foreach (XmlNode asm in nodeL)
{
string fn = asm.Attributes.GetNamedItem("Filename").Value;
Byte[] filedata = Convert.FromBase64String(asm.InnerText);
string path = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
path = Path.Combine(path, fn);
if (!File.Exists(path))
{
FileStream fs = File.Create(path);
fs.Write(filedata, 0, filedata.Length);
fs.Close();
}
}
break;
case "ScriptStates":
foreach (XmlNode st in nodeL)
{
string id = st.Attributes.GetNamedItem("UUID").Value;
UUID uuid = new UUID(id);
XmlNode state = st.ChildNodes[0];
XmlDocument sdoc = new XmlDocument();
XmlNode sxmlnode = sdoc.CreateNode(
XmlNodeType.XmlDeclaration,
"", "");
sdoc.AppendChild(sxmlnode);
XmlNode newnode = sdoc.ImportNode(state, true);
sdoc.AppendChild(newnode);
string spath = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString());
spath = Path.Combine(spath, uuid.ToString());
FileStream sfs = File.Create(spath + ".state");
ASCIIEncoding enc = new ASCIIEncoding();
Byte[] buf = enc.GetBytes(sdoc.InnerXml);
sfs.Write(buf, 0, buf.Length);
sfs.Close();
}
break;
}
}
}
}
SceneObjectPart RootPrim = GetSceneObjectPart(primID);
RootPrim.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1);
return true;
}
return true;
}
public bool IncomingCreateObject(ISceneObject sog)
{
//m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
@ -2677,9 +2581,9 @@ namespace OpenSim.Region.Framework.Scenes
sp.IsChildAgent = false;
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
}
}
m_LastLogin = Environment.TickCount;
}
m_LastLogin = Util.EnvironmentTickCount();
EventManager.TriggerOnNewClient(client);
}
@ -3350,7 +3254,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
//m_eventManager.OnRegionUp += OtherRegionUp;
//m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
//m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
m_sceneGridService.KiPrimitive += SendKillObject;
@ -3374,7 +3277,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.KiPrimitive -= SendKillObject;
m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
//m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
//m_eventManager.OnRegionUp -= OtherRegionUp;
m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
@ -4492,16 +4394,6 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region Avatar Appearance Default
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
{
visualParams = AvatarAppearance.GetDefaultVisualParams();
wearables = AvatarWearable.DefaultWearables;
}
#endregion
public void RegionHandleRequest(IClientAPI client, UUID regionID)
{
ulong handle = 0;
@ -4758,16 +4650,16 @@ namespace OpenSim.Region.Framework.Scenes
// 3 = We have seen a new user enter within the past 4 minutes
// which can be seen as positive confirmation of sim health
//
int health=1; // Start at 1, means we're up
if ((Environment.TickCount - m_lastUpdate) < 1000)
int health=1; // Start at 1, means we're up
if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)
health+=1;
else
return health;
// A login in the last 4 mins? We can't be doing too badly
//
if ((Environment.TickCount - m_LastLogin) < 240000)
//
if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000)
health++;
else
return health;
@ -4963,9 +4855,9 @@ namespace OpenSim.Region.Framework.Scenes
private void CheckHeartbeat()
{
if (m_firstHeartbeat)
return;
if (System.Environment.TickCount - m_lastUpdate > 2000)
return;
if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000)
StartTimer();
}
}

View File

@ -85,7 +85,6 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// A Prim will arrive shortly
/// </summary>
public event ExpectPrimDelegate OnExpectPrim;
public event CloseAgentConnection OnCloseAgentConnection;
/// <summary>
@ -116,7 +115,6 @@ namespace OpenSim.Region.Framework.Scenes
private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
//private RegionUp handlerRegionUp = null; // OnRegionUp;
@ -147,30 +145,6 @@ namespace OpenSim.Region.Framework.Scenes
/// <exception cref="System.Exception">Thrown if region registration fails.</exception>
public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
{
//m_interregionCommsOut = comms_out;
//m_regionInfo = regionInfos;
//m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
//regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
//if (regionCommsHost != null)
//{
// //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
// regionCommsHost.debugRegionName = regionInfos.RegionName;
// regionCommsHost.OnExpectPrim += IncomingPrimCrossing;
// regionCommsHost.OnExpectUser += NewUserConnection;
// regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
// regionCommsHost.OnCloseAgentConnection += CloseConnection;
// regionCommsHost.OnRegionUp += newRegionUp;
// regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
// regionCommsHost.OnLogOffUser += GridLogOffUser;
// regionCommsHost.OnGetLandData += FetchLandData;
//}
//else
//{
// //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null");
//}
}
/// <summary>
@ -179,31 +153,6 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void Close()
{
//if (regionCommsHost != null)
//{
// regionCommsHost.OnLogOffUser -= GridLogOffUser;
// regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
// regionCommsHost.OnRegionUp -= newRegionUp;
// regionCommsHost.OnExpectUser -= NewUserConnection;
// regionCommsHost.OnExpectPrim -= IncomingPrimCrossing;
// regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
// regionCommsHost.OnCloseAgentConnection -= CloseConnection;
// regionCommsHost.OnGetLandData -= FetchLandData;
// try
// {
// m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
// }
// catch (Exception e)
// {
// m_log.ErrorFormat(
// "[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing",
// m_regionInfo.RegionName, e);
// }
// regionCommsHost = null;
//}
}
#region CommsManager Event handlers
@ -263,27 +212,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// We have a new prim from a neighbor
/// </summary>
/// <param name="primID">unique ID for the primative</param>
/// <param name="objXMLData">XML2 encoded data of the primative</param>
/// <param name="XMLMethod">An Int that represents the version of the XMLMethod</param>
/// <returns>True if the prim was accepted, false if it was not</returns>
protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod)
{
handlerExpectPrim = OnExpectPrim;
if (handlerExpectPrim != null)
{
return handlerExpectPrim(primID, objXMLData, XMLMethod);
}
else
{
return false;
}
}
protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical)
{
handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;

View File

@ -309,26 +309,15 @@ namespace OpenSim.Region.Framework.Scenes
public string GetStateSnapshot()
{
//m_log.Debug(" >>> GetStateSnapshot <<<");
List<string> assemblies = new List<string>();
Dictionary<UUID, string> states = new Dictionary<UUID, string>();
foreach (SceneObjectPart part in m_parts.Values)
{
foreach (string a in part.Inventory.GetScriptAssemblies())
{
if (a != "" && !assemblies.Contains(a))
assemblies.Add(a);
}
foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates())
{
states[s.Key] = s.Value;
}
}
if (states.Count < 1 || assemblies.Count < 1)
if (states.Count < 1)
return "";
XmlDocument xmldoc = new XmlDocument();
@ -342,104 +331,49 @@ namespace OpenSim.Region.Framework.Scenes
xmldoc.AppendChild(rootElement);
XmlElement wrapper = xmldoc.CreateElement("", "Assemblies",
"");
rootElement.AppendChild(wrapper);
foreach (string assembly in assemblies)
{
string fn = Path.GetFileName(assembly);
if (fn == String.Empty)
continue;
String filedata = String.Empty;
if (File.Exists(assembly+".text"))
{
FileInfo tfi = new FileInfo(assembly+".text");
if (tfi == null)
continue;
Byte[] tdata = new Byte[tfi.Length];
try
{
FileStream tfs = File.Open(assembly+".text", FileMode.Open, FileAccess.Read);
tfs.Read(tdata, 0, tdata.Length);
tfs.Close();
}
catch (Exception e)
{
m_log.DebugFormat("[SOG]: Unable to open script textfile {0}, reason: {1}", assembly+".text", e.Message);
}
filedata = new System.Text.ASCIIEncoding().GetString(tdata);
}
else
{
FileInfo fi = new FileInfo(assembly);
if (fi == null)
continue;
Byte[] data = new Byte[fi.Length];
try
{
FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read);
fs.Read(data, 0, data.Length);
fs.Close();
}
catch (Exception e)
{
m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message);
}
filedata = System.Convert.ToBase64String(data);
}
XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", "");
XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", "");
assemblyName.Value = fn;
assemblyData.Attributes.Append(assemblyName);
assemblyData.InnerText = filedata;
wrapper.AppendChild(assemblyData);
}
wrapper = xmldoc.CreateElement("", "ScriptStates",
XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates",
"");
rootElement.AppendChild(wrapper);
foreach (KeyValuePair<UUID, string> state in states)
{
XmlElement stateData = xmldoc.CreateElement("", "State", "");
XmlAttribute stateID = xmldoc.CreateAttribute("", "UUID", "");
stateID.Value = state.Key.ToString();
stateData.Attributes.Append(stateID);
XmlDocument sdoc = new XmlDocument();
sdoc.LoadXml(state.Value);
XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
XmlNodeList rootL = sdoc.GetElementsByTagName("State");
XmlNode rootNode = rootL[0];
XmlNode newNode = xmldoc.ImportNode(rootNode, true);
stateData.AppendChild(newNode);
wrapper.AppendChild(stateData);
wrapper.AppendChild(newNode);
}
return xmldoc.InnerXml;
}
public void SetState(string objXMLData, UUID RegionID)
public void SetState(string objXMLData, IScene ins)
{
if (!(ins is Scene))
return;
Scene s = (Scene)ins;
if (objXMLData == String.Empty)
return;
IScriptModule scriptModule = null;
foreach (IScriptModule sm in s.RequestModuleInterfaces<IScriptModule>())
{
if (sm.ScriptEngineName == s.DefaultScriptEngine)
scriptModule = sm;
else if (scriptModule == null)
scriptModule = sm;
}
if (scriptModule == null)
return;
XmlDocument doc = new XmlDocument();
try
{
@ -457,69 +391,23 @@ namespace OpenSim.Region.Framework.Scenes
}
XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
if (rootL.Count == 1)
if (rootL.Count != 1)
return;
XmlElement rootE = (XmlElement)rootL[0];
XmlNodeList dataL = rootE.GetElementsByTagName("ScriptStates");
if (dataL.Count != 1)
return;
XmlElement dataE = (XmlElement)dataL[0];
foreach (XmlNode n in dataE.ChildNodes)
{
XmlNode rootNode = rootL[0];
if (rootNode != null)
{
XmlNodeList partL = rootNode.ChildNodes;
XmlElement stateE = (XmlElement)n;
UUID itemID = new UUID(stateE.GetAttribute("UUID"));
foreach (XmlNode part in partL)
{
XmlNodeList nodeL = part.ChildNodes;
switch (part.Name)
{
case "Assemblies":
foreach (XmlNode asm in nodeL)
{
string fn = asm.Attributes.GetNamedItem("Filename").Value;
Byte[] filedata = Convert.FromBase64String(asm.InnerText);
string path = Path.Combine("ScriptEngines", RegionID.ToString());
path = Path.Combine(path, fn);
if (!File.Exists(path))
{
FileStream fs = File.Create(path);
fs.Write(filedata, 0, filedata.Length);
fs.Close();
Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText);
fs = File.Create(path+".text");
fs.Write(textbytes, 0, textbytes.Length);
fs.Close();
}
}
break;
case "ScriptStates":
foreach (XmlNode st in nodeL)
{
string id = st.Attributes.GetNamedItem("UUID").Value;
UUID uuid = new UUID(id);
XmlNode state = st.ChildNodes[0];
XmlDocument sdoc = new XmlDocument();
XmlNode sxmlnode = sdoc.CreateNode(
XmlNodeType.XmlDeclaration,
"", "");
sdoc.AppendChild(sxmlnode);
XmlNode newnode = sdoc.ImportNode(state, true);
sdoc.AppendChild(newnode);
string spath = Path.Combine("ScriptEngines", RegionID.ToString());
spath = Path.Combine(spath, uuid.ToString());
FileStream sfs = File.Create(spath + ".state");
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
Byte[] buf = enc.GetBytes(sdoc.InnerXml);
sfs.Write(buf, 0, buf.Length);
sfs.Close();
}
break;
}
}
}
scriptModule.SetXMLState(itemID, n.OuterXml);
}
}
}

View File

@ -1199,6 +1199,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!silent)
{
part.UpdateFlag = 0;
if (part == m_rootPart)
avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId);
}
@ -3341,17 +3342,6 @@ namespace OpenSim.Region.Framework.Scenes
}
#endregion
public bool CanBeDeleted()
{
foreach (SceneObjectPart part in Children.Values)
{
if (!part.CanBeDeleted())
return false;
}
return true;
}
public double GetUpdatePriority(IClientAPI client)
{
switch (Scene.UpdatePrioritizationScheme)

View File

@ -3797,10 +3797,5 @@ namespace OpenSim.Region.Framework.Scenes
Inventory.ApplyNextOwnerPermissions();
}
public bool CanBeDeleted()
{
return Inventory.CanBeDeleted();
}
}
}

View File

@ -857,36 +857,6 @@ namespace OpenSim.Region.Framework.Scenes
return ret;
}
public string[] GetScriptAssemblies()
{
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
List<string> ret = new List<string>();
if (engines == null) // No engine at all
return new string[0];
foreach (TaskInventoryItem item in m_items.Values)
{
if (item.InvType == (int)InventoryType.LSL)
{
foreach (IScriptModule e in engines)
{
if (e != null)
{
string n = e.GetAssemblyName(item.ItemID);
if (n != String.Empty)
{
if (!ret.Contains(n))
ret.Add(n);
break;
}
}
}
}
}
return ret.ToArray();
}
public Dictionary<UUID, string> GetScriptStates()
{
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
@ -916,30 +886,5 @@ namespace OpenSim.Region.Framework.Scenes
}
return ret;
}
public bool CanBeDeleted()
{
if (!ContainsScripts())
return true;
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
if (engines == null) // No engine at all
return true;
foreach (TaskInventoryItem item in m_items.Values)
{
if (item.InvType == (int)InventoryType.LSL)
{
foreach (IScriptModule e in engines)
{
if (!e.CanBeDeleted(item.ItemID))
return false;
}
}
}
return true;
}
}
}

View File

@ -755,13 +755,37 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SendPrimUpdates()
{
m_perfMonMS = Environment.TickCount;
m_perfMonMS = EnvironmentTickCount();
m_sceneViewer.SendPrimUpdates();
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
}
/// <summary>
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
/// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
/// for the callers.
/// This trims it to a 12 day interval so don't let your frame time get too long.
/// </summary>
/// <returns></returns>
const Int32 EnvironmentTickCountMask = 0x3fffffff;
private static Int32 EnvironmentTickCount() {
return Environment.TickCount & EnvironmentTickCountMask;
}
/// <summary>
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
/// 'EnvironmentTickCount()') and accounts for any wrapping.
/// </summary>
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
private static Int32 EnvironmentTickCountSubtract(Int32 prevValue) {
Int32 diff = EnvironmentTickCount() - prevValue;
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
}
#region Status Methods
/// <summary>
@ -1148,7 +1172,7 @@ namespace OpenSim.Region.Framework.Scenes
// return;
//}
m_perfMonMS = Environment.TickCount;
m_perfMonMS = EnvironmentTickCount();
++m_movementUpdateCount;
if (m_movementUpdateCount < 1)
@ -1464,7 +1488,7 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.EventManager.TriggerOnClientMovement(this);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
}
public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
@ -1924,7 +1948,7 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
m_perfMonMS = Environment.TickCount;
m_perfMonMS = EnvironmentTickCount();
Rotation = rotation;
Vector3 direc = vec * rotation;
@ -1966,7 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes
// TODO: Add the force instead of only setting it to support multiple forces per frame?
m_forceToApply = direc;
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
}
#endregion
@ -2032,7 +2056,7 @@ namespace OpenSim.Region.Framework.Scenes
// server.
if (remoteClient.IsActive)
{
m_perfMonMS = Environment.TickCount;
m_perfMonMS = EnvironmentTickCount();
PhysicsActor actor = m_physicsActor;
Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
@ -2045,7 +2069,7 @@ namespace OpenSim.Region.Framework.Scenes
remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient)));
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
m_scene.StatsReporter.AddAgentUpdates(1);
}
}
@ -2055,11 +2079,11 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SendTerseUpdateToAllClients()
{
m_perfMonMS = Environment.TickCount;
m_perfMonMS = EnvironmentTickCount();
m_scene.ForEachClient(SendTerseUpdateToClient);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
}
public void SendCoarseLocations()
@ -2079,7 +2103,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p)
{
m_perfMonMS = Environment.TickCount;
m_perfMonMS = EnvironmentTickCount();
List<Vector3> CoarseLocations = new List<Vector3>();
List<UUID> AvatarUUIDs = new List<UUID>();
@ -2115,7 +2139,7 @@ namespace OpenSim.Region.Framework.Scenes
m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
}
public void CoarseLocationChange()
@ -2152,7 +2176,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SendInitialFullUpdateToAllClients()
{
m_perfMonMS = Environment.TickCount;
m_perfMonMS = EnvironmentTickCount();
ScenePresence[] avatars = m_scene.GetScenePresences();
@ -2178,14 +2202,14 @@ namespace OpenSim.Region.Framework.Scenes
}
m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
//Animator.SendAnimPack();
}
public void SendFullUpdateToAllClients()
{
m_perfMonMS = Environment.TickCount;
m_perfMonMS = EnvironmentTickCount();
// only send update from root agents to other clients; children are only "listening posts"
List<ScenePresence> avatars = m_scene.GetAvatars();
@ -2195,7 +2219,7 @@ namespace OpenSim.Region.Framework.Scenes
}
m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
Animator.SendAnimPack();
}
@ -2237,7 +2261,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SendAppearanceToAllOtherAgents()
{
m_perfMonMS = Environment.TickCount;
m_perfMonMS = EnvironmentTickCount();
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{
@ -2247,7 +2271,7 @@ namespace OpenSim.Region.Framework.Scenes
}
});
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
}
/// <summary>

View File

@ -82,6 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
private int m_fps = 0;
// saved last reported value so there is something available for llGetRegionFPS
private float lastReportedSimFPS = 0;
private float[] lastReportedSimStats = new float[21];
private float m_pfps = 0;
private int m_agentUpdates = 0;
@ -192,6 +193,9 @@ namespace OpenSim.Region.Framework.Scenes
// / 10 divides the value by the number of times the sim heartbeat runs (10fps)
// Then we divide the whole amount by the amount of seconds pass in between stats updates.
// 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
// values to X-per-second values.
for (int i = 0; i<21;i++)
{
sb[i] = new SimStatsPacket.StatBlock();
@ -236,8 +240,8 @@ namespace OpenSim.Region.Framework.Scenes
sb[12].StatID = (uint)Stats.OtherMS;
sb[12].StatValue = m_otherMS / statsUpdateFactor;
sb[13].StatID = (uint)Stats.InPacketsPerSecond;
sb[13].StatValue = (m_inPacketsPerSecond);
sb[13].StatID = (uint)Stats.InPacketsPerSecond;
sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor);
sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor);
@ -259,6 +263,11 @@ namespace OpenSim.Region.Framework.Scenes
sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
for (int i = 0; i < 21; i++)
{
lastReportedSimStats[i] = sb[i].StatValue;
}
SimStats simStats
= new SimStats(
@ -279,8 +288,8 @@ namespace OpenSim.Region.Framework.Scenes
m_fps = 0;
m_pfps = 0;
m_agentUpdates = 0;
m_inPacketsPerSecond = 0;
m_outPacketsPerSecond = 0;
//m_inPacketsPerSecond = 0;
//m_outPacketsPerSecond = 0;
m_unAckedBytes = 0;
m_scriptLinesPerSecond = 0;
@ -367,12 +376,12 @@ namespace OpenSim.Region.Framework.Scenes
public void AddInPackets(int numPackets)
{
m_inPacketsPerSecond += numPackets;
m_inPacketsPerSecond = numPackets;
}
public void AddOutPackets(int numPackets)
{
m_outPacketsPerSecond += numPackets;
m_outPacketsPerSecond = numPackets;
}
public void AddunAckedBytes(int numBytes)
@ -438,6 +447,11 @@ namespace OpenSim.Region.Framework.Scenes
{
return lastReportedSimFPS;
}
public float[] getLastReportedSimStats()
{
return lastReportedSimStats;
}
public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes)
{

View File

@ -69,13 +69,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
m_config = config.Configs["IRC"];
if (m_config == null)
{
m_log.InfoFormat("[IRC-Bridge] module not configured");
// m_log.InfoFormat("[IRC-Bridge] module not configured");
return;
}
if (!m_config.GetBoolean("enabled", false))
{
m_log.InfoFormat("[IRC-Bridge] module disabled in configuration");
// m_log.InfoFormat("[IRC-Bridge] module disabled in configuration");
return;
}
@ -85,6 +85,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
}
m_pluginEnabled = true;
m_log.InfoFormat("[IRC-Bridge]: Module enabled");
}
public void AddRegion(Scene scene)
@ -143,7 +144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
public static XmlRpcResponse XmlRpcAdminMethod(XmlRpcRequest request, IPEndPoint remoteClient)
{
m_log.Info("[IRC-Bridge]: XML RPC Admin Entry");
m_log.Debug("[IRC-Bridge]: XML RPC Admin Entry");
XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable();
@ -188,7 +189,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
}
catch (Exception e)
{
m_log.InfoFormat("[IRC-Bridge] XML RPC Admin request failed : {0}", e.Message);
m_log.ErrorFormat("[IRC-Bridge] XML RPC Admin request failed : {0}", e.Message);
responseData["success"] = "false";
responseData["error"] = e.Message;

View File

@ -1,48 +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.Reflection;
using log4net;
namespace OpenSim.Region.Modules.Python.PythonAPI
{
class Console
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public void WriteLine(string txt)
{
m_log.Info(txt);
}
public void WriteLine(string txt, params Object[] e)
{
m_log.Info(String.Format(txt, e));
}
}
}

View File

@ -1,71 +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 System.Security.Policy;
using System.Text;
using IronPython.Hosting;
using log4net;
using Nini.Config;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Modules.Python
{
class PythonModule : IRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private PythonEngine m_python;
public void Initialise(Scene scene, IConfigSource source)
{
}
public void PostInitialise()
{
m_log.Info("[PYTHON] Initialising IronPython engine.");
m_python = new PythonEngine();
m_python.AddToPath(System.Environment.CurrentDirectory + System.IO.Path.DirectorySeparatorChar + "Python");
}
public void Close()
{
}
public string Name
{
get { return "PythonModule"; }
}
public bool IsSharedModule
{
get { return true; }
}
}
}

View File

@ -62,7 +62,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
public void Initialise(IConfigSource config)
{
m_log.Info("[RegionReady] Initialising");
//m_log.Info("[RegionReady] Initialising");
m_config = config.Configs["RegionReady"];
if (m_config != null)
@ -74,8 +74,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
}
}
if (!m_enabled)
m_log.Info("[RegionReady] disabled.");
// if (!m_enabled)
// m_log.Info("[RegionReady] disabled.");
}
public void AddRegion(Scene scene)
@ -92,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
m_log.InfoFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName);
m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName);
}
public void RemoveRegion(Scene scene)
@ -120,7 +120,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
}
#endregion
void OnEmptyScriptCompileQueue(int numScriptsFailed, string message)
{

View File

@ -2099,7 +2099,10 @@ Console.WriteLine(" JointCreateFixed");
// Re creates body on size.
// EnableBody also does setMass()
enableBody();
d.BodyEnable(Body);
if (Body != IntPtr.Zero)
{
d.BodyEnable(Body);
}
}
_parent_scene.geom_name_map[prim_geom] = oldname;

View File

@ -96,7 +96,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
UUID GetDetectID(int idx);
void SaveState(string assembly);
void DestroyScriptInstance();
bool CanBeDeleted();
IScriptApi GetApi(string name);

View File

@ -236,7 +236,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
iHttpReq.StopHttpRequest(localID, itemID);
IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
comms.DeleteListener(itemID);
if (comms != null)
comms.DeleteListener(itemID);
IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>();
xmlrpc.DeleteChannels(itemID);

View File

@ -734,7 +734,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ChatTypeEnum.Whisper, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text);
if (wComm != null)
wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text);
}
public void llSay(int channelID, string text)
@ -754,7 +755,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ChatTypeEnum.Say, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text);
if (wComm != null)
wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text);
}
}
@ -769,7 +771,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ChatTypeEnum.Shout, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
wComm.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text);
if (wComm != null)
wComm.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text);
}
public void llRegionSay(int channelID, string text)
@ -786,7 +789,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text);
if (wComm != null)
wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text);
}
public LSL_Integer llListen(int channelID, string name, string ID, string msg)
@ -795,21 +799,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID keyID;
UUID.TryParse(ID, out keyID);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, keyID, msg);
if (wComm != null)
return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, keyID, msg);
else
return -1;
}
public void llListenControl(int number, int active)
{
m_host.AddScriptLPS(1);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
wComm.ListenControl(m_itemID, number, active);
if (wComm != null)
wComm.ListenControl(m_itemID, number, active);
}
public void llListenRemove(int number)
{
m_host.AddScriptLPS(1);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
wComm.ListenRemove(m_itemID, number);
if (wComm != null)
wComm.ListenRemove(m_itemID, number);
}
public void llSensor(string name, string id, int type, double range, double arc)
@ -1037,7 +1046,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return detectedParams.TouchUV;
}
public void llDie()
public virtual void llDie()
{
m_host.AddScriptLPS(1);
throw new SelfDeleteException();
@ -1987,6 +1996,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type
// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
// So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line
// is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt
// It's perfectly okay when the object is not an active physical body though.
// So, part.ParentGroup.ResetChildPrimPhysicsPositions(); does the thing that Kitto is warning against
// but only if the object is not physial and active. This is important for rotating doors.
// without the absoluteposition = absoluteposition happening, the doors do not move in the physics
// scene
if (part.PhysActor != null && !part.PhysActor.IsPhysical)
{
part.ParentGroup.ResetChildPrimPhysicsPositions();
}
}
/// <summary>
@ -5772,6 +5793,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
return World.SimulatorFPS;
}
/* particle system rules should be coming into this routine as doubles, that is
rule[0] should be an integer from this list and rule[1] should be the arg

View File

@ -1948,5 +1948,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return key.ToString();
}
/// <summary>
/// Return information regarding various simulator statistics (sim fps, physics fps, time
/// dilation, total number of prims, total number of active scripts, script lps, various
/// timing data, packets in/out, etc. Basically much the information that's shown in the
/// client's Statistics Bar (Ctrl-Shift-1)
/// </summary>
/// <returns>List of floats</returns>
public LSL_List osGetRegionStats()
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetRegionStats");
m_host.AddScriptLPS(1);
LSL_List ret = new LSL_List();
float[] stats = World.SimulatorStats;
for (int i = 0; i < 21; i++)
{
ret.Add(new LSL_Float( stats[i] ));
}
return ret;
}
}
}

View File

@ -166,7 +166,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
ts.next = DateTime.Now.Ticks + (long)data[idx+1];
idx += 2;
Timers.Add(MakeTimerKey(localID,itemID), ts);
lock (TimerListLock)
{
Timers.Add(MakeTimerKey(localID, itemID), ts);
}
}
}
}

View File

@ -162,5 +162,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
key osGetMapTexture();
key osGetRegionMapTexture(string regionName);
LSL_List osGetRegionStats();
}
}

View File

@ -515,6 +515,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f";
public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903";
public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361";
// Constants for osGetRegionStats
public const int STATS_TIME_DILATION = 0;
public const int STATS_SIM_FPS = 1;
public const int STATS_PHYSICS_FPS = 2;
public const int STATS_AGENT_UPDATES = 3;
public const int STATS_ROOT_AGENTS = 4;
public const int STATS_CHILD_AGENTS = 5;
public const int STATS_TOTAL_PRIMS = 6;
public const int STATS_ACTIVE_PRIMS = 7;
public const int STATS_FRAME_MS = 8;
public const int STATS_NET_MS = 9;
public const int STATS_PHYSICS_MS = 10;
public const int STATS_IMAGE_MS = 11;
public const int STATS_OTHER_MS = 12;
public const int STATS_IN_PACKETS_PER_SECOND = 13;
public const int STATS_OUT_PACKETS_PER_SECOND = 14;
public const int STATS_UNACKED_BYTES = 15;
public const int STATS_AGENT_MS = 16;
public const int STATS_PENDING_DOWNLOADS = 17;
public const int STATS_PENDING_UPLOADS = 18;
public const int STATS_ACTIVE_SCRIPTS = 19;
public const int STATS_SCRIPT_LPS = 20;
}
}

View File

@ -632,5 +632,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osGetRegionMapTexture(regionName);
}
public LSL_List osGetRegionStats()
{
return m_OSSL_Functions.osGetRegionStats();
}
}
}

View File

@ -1011,10 +1011,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
get { return m_RegionID; }
}
public bool CanBeDeleted()
{
return true;
}
}
}

View File

@ -1245,34 +1245,219 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
}
public string GetAssemblyName(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return "";
return instance.GetAssemblyName();
}
public string GetXMLState(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return "";
return instance.GetXMLState();
}
string xml = instance.GetXMLState();
public bool CanBeDeleted(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return true;
XmlDocument sdoc = new XmlDocument();
sdoc.LoadXml(xml);
XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
XmlNode rootNode = rootL[0];
return instance.CanBeDeleted();
// Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
XmlDocument doc = new XmlDocument();
XmlElement stateData = doc.CreateElement("", "State", "");
XmlAttribute stateID = doc.CreateAttribute("", "UUID", "");
stateID.Value = itemID.ToString();
stateData.Attributes.Append(stateID);
XmlAttribute assetID = doc.CreateAttribute("", "Asset", "");
assetID.Value = instance.AssetID.ToString();
stateData.Attributes.Append(assetID);
doc.AppendChild(stateData);
// Add <ScriptState>...</ScriptState>
XmlNode xmlstate = doc.ImportNode(rootNode, true);
stateData.AppendChild(xmlstate);
string assemName = instance.GetAssemblyName();
string fn = Path.GetFileName(assemName);
string assem = String.Empty;
if (File.Exists(assemName + ".text"))
{
FileInfo tfi = new FileInfo(assemName + ".text");
if (tfi != null)
{
Byte[] tdata = new Byte[tfi.Length];
try
{
FileStream tfs = File.Open(assemName + ".text",
FileMode.Open, FileAccess.Read);
tfs.Read(tdata, 0, tdata.Length);
tfs.Close();
assem = new System.Text.ASCIIEncoding().GetString(tdata);
}
catch (Exception e)
{
m_log.DebugFormat("[XEngine]: Unable to open script textfile {0}, reason: {1}", assemName+".text", e.Message);
}
}
}
else
{
FileInfo fi = new FileInfo(assemName);
if (fi != null)
{
Byte[] data = new Byte[fi.Length];
try
{
FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read);
fs.Read(data, 0, data.Length);
fs.Close();
assem = System.Convert.ToBase64String(data);
}
catch (Exception e)
{
m_log.DebugFormat("[XEngine]: Unable to open script assembly {0}, reason: {1}", assemName, e.Message);
}
}
}
string map = String.Empty;
if (File.Exists(fn + ".map"))
{
FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read);
StreamReader msr = new StreamReader(mfs);
map = msr.ReadToEnd();
msr.Close();
mfs.Close();
}
XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", "");
assemblyName.Value = fn;
assemblyData.Attributes.Append(assemblyName);
assemblyData.InnerText = assem;
stateData.AppendChild(assemblyData);
XmlElement mapData = doc.CreateElement("", "LineMap", "");
XmlAttribute mapName = doc.CreateAttribute("", "Filename", "");
mapName.Value = fn + ".map";
mapData.Attributes.Append(mapName);
mapData.InnerText = map;
stateData.AppendChild(mapData);
return doc.InnerXml;
}
private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled)
{
return false;
}
public void SetXMLState(UUID itemID, string xml)
{
if (xml == String.Empty)
return;
XmlDocument doc = new XmlDocument();
try
{
doc.LoadXml(xml);
}
catch (Exception)
{
m_log.Error("[XEngine]: Exception decoding XML data from region transfer");
return;
}
XmlNodeList rootL = doc.GetElementsByTagName("State");
if (rootL.Count < 1)
return;
XmlElement rootE = (XmlElement)rootL[0];
if (rootE.GetAttribute("UUID") != itemID.ToString())
return;
// string assetID = rootE.GetAttribute("Asset");
XmlNodeList stateL = rootE.GetElementsByTagName("ScriptState");
if (stateL.Count != 1)
return;
XmlElement stateE = (XmlElement)stateL[0];
if (World.m_trustBinaries)
{
XmlNodeList assemL = rootE.GetElementsByTagName("Assembly");
if (assemL.Count != 1)
return;
XmlElement assemE = (XmlElement)assemL[0];
string fn = assemE.GetAttribute("Filename");
string base64 = assemE.InnerText;
string path = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
path = Path.Combine(path, fn);
if (!File.Exists(path))
{
Byte[] filedata = Convert.FromBase64String(base64);
FileStream fs = File.Create(path);
fs.Write(filedata, 0, filedata.Length);
fs.Close();
fs = File.Create(path + ".text");
StreamWriter sw = new StreamWriter(fs);
sw.Write(base64);
sw.Close();
fs.Close();
}
}
string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
statepath = Path.Combine(statepath, itemID.ToString() + ".state");
FileStream sfs = File.Create(statepath);
StreamWriter ssw = new StreamWriter(sfs);
ssw.Write(stateE.OuterXml);
ssw.Close();
sfs.Close();
XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
XmlElement mapE = (XmlElement)mapL[0];
string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
FileStream mfs = File.Create(mappath);
StreamWriter msw = new StreamWriter(mfs);
msw.Write(mapE.InnerText);
msw.Close();
mfs.Close();
}
}
}

View File

@ -38,10 +38,10 @@ namespace OpenSim.Tests.Common.Mock
/// mono addin plugin system starts co-operating with the unit test system. Currently no locking since unit
/// tests are single threaded.
/// </summary>
public class TestAssetDataPlugin : BaseAssetRepository, IAssetDataPlugin
public class MockAssetDataPlugin : BaseAssetRepository, IAssetDataPlugin
{
public string Version { get { return "0"; } }
public string Name { get { return "TestAssetDataPlugin"; } }
public string Name { get { return "MockAssetDataPlugin"; } }
public void Initialise() {}
public void Initialise(string connect) {}

View File

@ -1684,8 +1684,6 @@
<Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.StructuredData.dll"/>
<Reference name="OpenMetaverse.dll"/>
<Reference name="IronPython.dll"/>
<Reference name="IronMath.dll"/>
<Reference name="PumaCode.SvnDotNet.dll"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/>