Compare commits

...

88 Commits

Author SHA1 Message Date
Melanie
80148bf784 Merge branch 'bigmerge' of ssh://3dhosting.de/var/git/careminster into bigmerge 2011-11-28 11:21:15 +01:00
Melanie
dc612d0f08 Merge branch 'master' into bigmerge
Conflicts:
	OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
2011-11-28 11:06:38 +00:00
BlueWall
19c10c892a Merge branch 'master' of ssh://opensimulator.org/var/git/opensim 2011-11-26 17:20:20 -05:00
BlueWall
ea0fc7b12c Add missing property to llGetLinkPrimitiveParams 2011-11-26 17:06:28 -05:00
Justin Clark-Casey (justincc)
4efd9a3b7b When removing an LSL sensor for a script (e.g. through llResetScript() or state change), don't also remove sensors for other scripts in the same prim.
Hopefully fixes http://opensimulator.org/mantis/view.php?id=4448 and http://opensimulator.org/mantis/view.php?id=4452
2011-11-26 01:55:36 +00:00
Justin Clark-Casey (justincc)
86cc00aaa8 minor: formatting changes in Scene.PacketHandlers.cs 2011-11-26 01:52:12 +00:00
Justin Clark-Casey (justincc)
46e1bcb6b6 minor: remove mono compiler warning 2011-11-26 01:40:46 +00:00
Justin Clark-Casey (justincc)
bafea2282a Rip out unused Scene.HandleFetchInventoryDescendentsCAPS().
This has been handled by WebFetchInvDescHandler.Fetch() for some time.
2011-11-26 01:39:23 +00:00
Justin Clark-Casey (justincc)
11c19b0d2e Use the same web fetch handler for every request from every avatar, since it contains no instance code 2011-11-26 00:29:01 +00:00
Justin Clark-Casey (justincc)
c5b636469d Stop locking the requests coming in to WebFetchInvDecHandler.
There's no technical reason for this as the methods are thread safe.  However, it might have served to slow down requests.
2011-11-26 00:13:04 +00:00
Justin Clark-Casey (justincc)
95a686dbf5 Fix config so that you can have both WebFetchInventoryDescendents and FetchInvnetoryDescendents2 caps active at once 2011-11-25 23:45:29 +00:00
Justin Clark-Casey (justincc)
5b4fe23f7f Resolve error where an unknown asset type would cause the fetch inventory descendents cap to fail.
Introduced just a few commits ago in 0688861
2011-11-25 23:43:57 +00:00
Justin Clark-Casey (justincc)
676d32974a Implement the FetchInventoryDescendents2 capability using the same code as WebFetchInventoryDescendents.
Enabling this by setting Cap_FetchInventoryDescendents2 = "localhost" in the [ClientStack.LindenCaps] section of OpenSim.ini downloads inventory via http rather than udp in later viewers.
2011-11-25 22:46:42 +00:00
Justin Clark-Casey (justincc)
b785f204ce remove some mono compiler warnings 2011-11-25 22:19:57 +00:00
Justin Clark-Casey (justincc)
0688861aa7 Use the more extensive Utils.AssetTypeToString()/InventoryTypeToString() conversion rather than the arrays in TaskInventoryItem 2011-11-25 22:15:29 +00:00
Justin Clark-Casey (justincc)
8c82ff16ad Fix WebFetchInventoryDescendents cap to use Utils.AssetTypeTostring/InventoryTypeToString to convert types to strings
These cover a wider range of types.
2011-11-25 21:54:31 +00:00
Justin Clark-Casey (justincc)
0a0aa77cfd Adding missing CrossBehaviour.cs file to fix build 2011-11-24 22:46:43 +00:00
Justin Clark-Casey (justincc)
8e32ce85a7 Remove bizarre call to PhysicsScene.Simulate(0) in Scene.GetNearestAllowedPosition()
At least on ODE, this wasn't doing any harm but there wasn't any point to it either
2011-11-24 22:45:29 +00:00
Justin Clark-Casey (justincc)
2ae5b40ca6 On pCampBot, add bot as a property on behaviours instead of passing it in every time 2011-11-24 22:36:45 +00:00
Justin Clark-Casey (justincc)
cbbd992df4 minor: remove mono compiler warning 2011-11-24 22:11:54 +00:00
Justin Clark-Casey (justincc)
a58f5b2f66 When setting packet level logging via "debug packet", apply to all clients, not just root ones.
Also adds scene name and client type (root|child) to logged information.
2011-11-24 22:08:34 +00:00
Justin Clark-Casey (justincc)
0a60e9537f comment out a noisy log line I accidentally left in from the last commit 2011-11-24 21:30:40 +00:00
Justin Clark-Casey (justincc)
63c137820b Stop passing a request handler to the initial caps.RegisterHandler in EventQueueGetModule since this is immediatley replaced by a poll server handler.
This allows us to comment out a bunch of code and simplify the codebase and readability.
2011-11-24 21:27:35 +00:00
Justin Clark-Casey (justincc)
0174e326e3 Add a "debug eq" console command for debugging.
This will log outgoing event queue message names if turned on.
2011-11-24 20:27:11 +00:00
Justin Clark-Casey (justincc)
decabe1181 Merge branch 'master' of ssh://opensimulator.org/var/git/opensim 2011-11-24 20:22:17 +00:00
Justin Clark-Casey (justincc)
bdcfd6afee Add disabled CrossBehaviour to pCampBot, which is designed to cross test bots between neighbouring regions.
Not yet enabled since there is a bug where the initial cross will work but all subsequent movements on the receiving simulator appear to fail.
2011-11-24 17:35:33 +00:00
Melanie
a8270cb48c Merge branch 'master' into bigmerge 2011-11-24 01:16:37 +00:00
Dan Lake
89b2fb2ff4 Append asset ID to URL for storage requests to allow caching proxies to work with Simian 2011-11-23 16:41:30 -08:00
Dan Lake
5485e3da46 Merge branch 'master' of git://opensimulator.org/git/opensim 2011-11-23 16:11:17 -08:00
Dan Lake
0cb33a5398 Line endings 2011-11-23 16:09:11 -08:00
Melanie
11dfd7711b Merge branch 'bigmerge' of ssh://3dhosting.de/var/git/careminster into bigmerge 2011-11-24 00:54:52 +01:00
Justin Clark-Casey (justincc)
ed7ddeecf2 Print out what behaviours are active when pCampBot starts up 2011-11-23 22:18:10 +00:00
Justin Clark-Casey (justincc)
d145750e87 Add teleport behaviour to pCampBot
This teleports the bot to any other regions +/- 5 on the x or y axis.
Quite aggressive at the moment since teleports keep occuring at a 1-10secs random interval.
No checking yet to see if teleport was successful.
2011-11-23 22:05:11 +00:00
Justin Clark-Casey (justincc)
1126efdcd0 In pCampbot, change "show status" command to "show bots" 2011-11-23 21:33:54 +00:00
Justin Clark-Casey (justincc)
9ae0641871 Rename Bot.BotManager to Manager 2011-11-23 21:33:10 +00:00
Justin Clark-Casey (justincc)
e9f2a9bddb get pCampBot to extract nearby and store nearby region information 2011-11-23 21:19:10 +00:00
Justin Clark-Casey (justincc)
617f139aac Merge branch 'master' of ssh://opensimulator.org/var/git/opensim 2011-11-23 21:10:50 +00:00
Justin Clark-Casey (justincc)
e394f83df0 Change random number generator property name in pCampbot 2011-11-23 18:00:41 +00:00
BlueWall
0738fc43e4 Merge branch 'master' of ssh://opensimulator.org/var/git/opensim 2011-11-23 10:50:29 -05:00
BlueWall
d4e3a7fe81 Shell Environment Variables in config
Adding updated Nini and support to use shell environment variables in OpenSimulator configuration.

  Nini @ https://github.com/BlueWall/Nini-Dev
2011-11-23 10:11:47 -05:00
Justin Clark-Casey (justincc)
b56410285b Log error if we attempt to add/remove an OdeCharacter from the _characters list inappropriately 2011-11-22 22:46:25 +00:00
Justin Clark-Casey (justincc)
ace4324e75 Stop removing actor from the hash maps in OdeScene.RemoveCharacter() since this is now being down in OdeCharacter.DestroyOdeStructures() 2011-11-22 22:37:06 +00:00
Justin Clark-Casey (justincc)
af90b52731 Comment out uncalled OdeScene.UnCombine() 2011-11-22 22:28:46 +00:00
Justin Clark-Casey (justincc)
fcb066cb5f Comment out unimplemented and uncalled RegionCombinerModule.UnCombineRegion() 2011-11-22 22:23:52 +00:00
Justin Clark-Casey (justincc)
d639f7fdf3 minor: remove mono compiler warning 2011-11-22 22:16:09 +00:00
Justin Clark-Casey (justincc)
b0fe0464af Stop an exception being thrown and a teleport/border cross failing if the desintation sim has no active script engines.
This involves getting IScene.RequestModuleInterfaces() to return an empty array (as was stated in the method doc) rather than an array containing one null entry.
Callers adjusted to stop checking for the list reference being null (which never happened anyway)
2011-11-22 22:13:57 +00:00
Justin Clark-Casey (justincc)
daf99f8c0a slightly simplify OdeScene.Simulate() by removing bool processtaints, since we can inspect count of taint lists instead.
also groups OdeCharacter.CreateOdeStructures() and DestroyOdeStructures() together
2011-11-22 21:51:00 +00:00
Justin Clark-Casey (justincc)
b89c48b1be Improve the error messages returned if the HelloNeighbour call fails.
This is the message a region sends to its neighbours when it comes up
2011-11-21 22:06:43 +00:00
Justin Clark-Casey (justincc)
c4e4a29478 Slightly improve "Unable to space collide" logging message, though I don't think I've ever seen this. 2011-11-21 21:31:26 +00:00
Justin Clark-Casey (justincc)
4ddff7eb0f Get rid of OdeCharacter != null checks since OdeScene._characters can never contain a null character.
Ignoring the ancient code glyphs not to do this....
2011-11-21 21:29:56 +00:00
Justin Clark-Casey (justincc)
82dc7886fc remove unnecessary OdeScene._activeprims locking. Code is single-threaded 2011-11-21 21:15:15 +00:00
Justin Clark-Casey (justincc)
7480f2fd0e Restore defects list. In hindsight, the reason for this is becuase we can't remove the character whilst iterating over the list.
This commit also removes locking on OdeScene._characters since code is single threaded
2011-11-21 21:04:24 +00:00
Justin Clark-Casey (justincc)
546259b2ff simplify operation of OdeScene._perloopContact 2011-11-21 20:30:37 +00:00
Justin Clark-Casey (justincc)
25d9001de1 don't bother locking OdeScene._perloopContact in single threaded code 2011-11-21 20:17:36 +00:00
Justin Clark-Casey (justincc)
e33b0fa35b don't lock OdeScene.contacts since only ever accessed by a single thread 2011-11-21 20:12:04 +00:00
Justin Clark-Casey (justincc)
e67ba0ad06 rename ODECharacter.AvatarGeomAndBodyCreation() -> CreateOdeStructures() to match existing DestroyOdeStructures() 2011-11-21 20:01:34 +00:00
Justin Clark-Casey (justincc)
063f0f5d97 refactor: Eliminate one line ODECharacter.doForce() method for code clarity 2011-11-21 19:58:37 +00:00
Justin Clark-Casey (justincc)
225b925f4e Comment out calls to OdeScene.waitForSpaceUnlock() since that method does nothing right now 2011-11-21 19:48:31 +00:00
Justin Clark-Casey (justincc)
54789706f4 Reduce complexity of OdeScene.Simulate() by fully removing bad characters at point of detection rather than later on. 2011-11-21 19:45:22 +00:00
Justin Clark-Casey (justincc)
3becda919e move geom/actor map maintenance into DestroyODEStructures()/AvatarGeomAndBodyCreation().
This saves us having to do it separately when a character capsule size is changed
2011-11-21 19:31:29 +00:00
Justin Clark-Casey (justincc)
4faac1f090 When changing avatar size in ODE, remove the old actor from the name and actor maps 2011-11-21 19:06:53 +00:00
Justin Clark-Casey (justincc)
898904d83d When an ODECharacter is removed (e.g. when an avatar leaves a scene), remove the actor reference in OdeScene.actor_name_map rather than leaving it dangling.
This also largely centralizes adds/removes in OdeScene.AddCharacter()/RemoveCharacter()
2011-11-21 18:27:41 +00:00
Justin Clark-Casey (justincc)
cead87005b Have ODECharacter and ODEPrim both use PhysicsActor.Name instead of maintaining their own properties 2011-11-21 18:06:04 +00:00
Justin Clark-Casey (justincc)
4fdcfd79e4 Actually remove PhysicsActor.SOPDescription this time 2011-11-21 17:55:54 +00:00
Justin Clark-Casey (justincc)
39c1ae2408 Chain SOP constructors together rather than having copy/paste code 2011-11-21 17:55:10 +00:00
Justin Clark-Casey (justincc)
58a1147870 refactor: Make SOP.Description an automatic property 2011-11-21 17:51:38 +00:00
Justin Clark-Casey (justincc)
e0887944a0 Remove unused PhysicsActor.SOPDescription 2011-11-21 17:47:30 +00:00
Justin Clark-Casey (justincc)
4485007fce Instead of generating a new list for bad characters on every physics pass, keep reusing the same list. 2011-11-21 17:04:54 +00:00
Justin Clark-Casey (justincc)
a94ce3f1df Move DeleteScriptsOnStartup switch from [Startup] to [XEngine] in OpenSim.ini.example.
If anybody was changing this and wondering why there was no effect, this is why.
2011-11-21 15:30:00 +00:00
Melanie
bdb5ac96d9 Merge branch 'master' into bigmerge
Conflicts:
	OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
	OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
2011-11-19 22:39:15 +00:00
Melanie
dec8b9c98d Merge branch 'bigmerge' of ssh://3dhosting.de/var/git/careminster into bigmerge 2011-11-19 22:26:41 +01:00
Justin Clark-Casey (justincc)
2206e2fc96 Remove the "[LOCAL SIMULATION CONNECTOR]: Did not find region {0} for SendCreateChildAgent" message
This is misleading since a simulator will call this method before successfully trying remote regions.
Also comments out spammy "[SIMULATION]: Stream handler called" AgentHandlers messages for now.
2011-11-19 01:32:21 +00:00
Justin Clark-Casey (justincc)
726ca72c47 minor: Make HelloNeighbour messages more informative 2011-11-19 01:27:06 +00:00
Justin Clark-Casey (justincc)
10a23a823e Get rid of the spurious [WEB UTIL] couldn't decode <OpenSim agent 57956c4b-ff2e-4fc1-9995-613c6256cc98>: Invalid character 'O' in input string messages
These are just the result of an attempt to canonicalize received messages - it's not important that we constantly log them.
Also finally get the deregister grid service message working properly
2011-11-19 01:16:07 +00:00
Justin Clark-Casey (justincc)
21353de9b7 Enable v2/v3 map tile url setting on robust as default in config
This is necessary to see map tiles on v2/v3 viewers and appears to work fine
2011-11-19 00:34:56 +00:00
Justin Clark-Casey (justincc)
b89534ad0a Remove mono compiler warnings. Fix problem with co-ordinate given in deregister region message 2011-11-19 00:34:13 +00:00
Justin Clark-Casey (justincc)
d05d065d85 Improve some grid region log messages to express regions at co-ordinate (e.g. 1000, 1000) rather than meter positions (256000, 256000) 2011-11-19 00:29:52 +00:00
Justin Clark-Casey (justincc)
7a18078177 improve region deregistration log message 2011-11-19 00:10:29 +00:00
Justin Clark-Casey (justincc)
01ae916bad Don't register a region twice on both official registration and maptile regeneration.
Maptile storage appears orthogonal to region registration
2011-11-19 00:07:34 +00:00
justincc
f72c4bdba5 Replace HttpServer_OpenSim.dll with Oren Hurvitz's patch applied.
This will hopefully address mantis 5471, 5694 and 5718.
This code is now in opensim-libs, along with Diva's slightly older patches (which were already applied to the DLLs in the opensim tree).
Thanks Oren!
2011-11-18 22:52:59 +00:00
Justin Clark-Casey (justincc)
9d458fdd7f Turn the [RegionReady] module on by default and login_disable = true while scripts are loading.
From field experience, we know that simulators can be unstable if a user logs in before the scripts have finished loading.
This commit turns login_disable = true in [RegionReady] on by default which prevents this from happening.
If you want the old behaviour, please copy these section from OpenSimDefaults.ini into OpenSim.ini and set login_disable = false
2011-11-18 21:31:23 +00:00
Justin Clark-Casey (justincc)
169387b390 Turn SellEnabled in the [EconomyModule] on by default.
This only provides enough functionality to allow operations for no money (e.g. sell for $0).
2011-11-17 23:53:25 +00:00
justincc
6dbe793112 Fix Windows build break 2011-11-17 23:10:58 +00:00
Justin Clark-Casey (justincc)
9c928e9dc6 For TerrainModule.SaveToFile(), don't bother throwing the exception onwards after printing out the error, since this method is invoked by users.
Still throwing the exception on the stream method since this invoked programatically
2011-11-17 22:15:46 +00:00
Justin Clark-Casey (justincc)
352672eaf2 Make "terrain save" more friendly by telling the user if we have saved and putting out a useful complaint message if we haven't for some reason 2011-11-17 22:13:32 +00:00
Justin Clark-Casey (justincc)
cacc028835 If the entire simulator is shutting down then don't bother to unload the scripts from the appdomain in XEngine.
All the other actions (script state save, etc.) still occur.
This makes shutdown where there are many scripts vastly quicker.
2011-11-17 21:03:08 +00:00
Melanie
d1c80efd41 Merge branch 'bigmerge' of ssh://3dhosting.de/var/git/careminster into bigmerge 2011-11-17 19:15:41 +01:00
Melanie
e9c386f6a6 Force a sim exit when hearbeat isn't restarting successfully 2011-11-17 19:15:11 +01:00
69 changed files with 7221 additions and 6677 deletions

View File

@@ -98,14 +98,17 @@ namespace OpenSim.Framework.Capabilities
{
get { return m_httpListener.UseSSL; }
}
public string SSLCommonName
{
get { return m_httpListener.SSLCommonName; }
}
public CapsHandlers CapsHandlers
{
get { return m_capsHandlers; }
}
public Dictionary<string, string> ExternalCapsHandlers
{
get { return m_externalCapsHandlers; }
@@ -157,11 +160,7 @@ namespace OpenSim.Framework.Capabilities
/// <summary>
/// Remove all CAPS service handlers.
///
/// </summary>
/// <param name="httpListener"></param>
/// <param name="path"></param>
/// <param name="restMethod"></param>
public void DeregisterHandlers()
{
if (m_capsHandlers != null)

View File

@@ -42,7 +42,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers
{
public class WebFetchInvDescHandler
{
private static readonly ILog m_log =
@@ -50,7 +49,7 @@ namespace OpenSim.Capabilities.Handlers
private IInventoryService m_InventoryService;
private ILibraryService m_LibraryService;
private object m_fetchLock = new Object();
// private object m_fetchLock = new Object();
public WebFetchInvDescHandler(IInventoryService invService, ILibraryService libService)
{
@@ -60,37 +59,40 @@ namespace OpenSim.Capabilities.Handlers
public string FetchInventoryDescendentsRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
// nasty temporary hack here, the linden client falsely
// identifies the uuid 00000000-0000-0000-0000-000000000000
// as a string which breaks us
//
// correctly mark it as a uuid
//
request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
// lock (m_fetchLock)
// {
// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request {0}", request);
// nasty temporary hack here, the linden client falsely
// identifies the uuid 00000000-0000-0000-0000-000000000000
// as a string which breaks us
//
// correctly mark it as a uuid
//
request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
// another hack <integer>1</integer> results in a
// System.ArgumentException: Object type System.Int32 cannot
// be converted to target type: System.Boolean
//
request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
Hashtable hash = new Hashtable();
try
{
hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
}
catch (LLSD.LLSDParseException e)
{
m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
m_log.Error("Request: " + request);
}
ArrayList foldersrequested = (ArrayList)hash["folders"];
string response = "";
// another hack <integer>1</integer> results in a
// System.ArgumentException: Object type System.Int32 cannot
// be converted to target type: System.Boolean
//
request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
Hashtable hash = new Hashtable();
try
{
hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
}
catch (LLSD.LLSDParseException pe)
{
m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message);
m_log.Error("Request: " + request.ToString());
}
ArrayList foldersrequested = (ArrayList)hash["folders"];
string response = "";
lock (m_fetchLock)
{
for (int i = 0; i < foldersrequested.Count; i++)
{
string inventoryitemstr = "";
@@ -104,7 +106,7 @@ namespace OpenSim.Capabilities.Handlers
}
catch (Exception e)
{
m_log.Debug("[CAPS]: caught exception doing OSD deserialize" + e);
m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e);
}
LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest);
@@ -115,7 +117,6 @@ namespace OpenSim.Capabilities.Handlers
response += inventoryitemstr;
}
if (response.Length == 0)
{
// Ter-guess: If requests fail a lot, the client seems to stop requesting descendants.
@@ -129,11 +130,12 @@ namespace OpenSim.Capabilities.Handlers
response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
}
//m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml");
//m_log.Debug("[CAPS] "+response);
// m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request");
//m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response);
}
return response;
return response;
// }
}
/// <summary>
@@ -155,7 +157,10 @@ namespace OpenSim.Capabilities.Handlers
inv.Items = new List<InventoryItemBase>();
int version = 0;
inv = Fetch(invFetch.owner_id, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
inv
= Fetch(
invFetch.owner_id, invFetch.folder_id, invFetch.owner_id,
invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
if (inv.Folders != null)
{
@@ -179,16 +184,31 @@ namespace OpenSim.Capabilities.Handlers
return reply;
}
public InventoryCollection Fetch(UUID agentID, UUID folderID, UUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder, out int version)
/// <summary>
/// Handle the caps inventory descendents fetch.
/// </summary>
/// <param name="agentID"></param>
/// <param name="folderID"></param>
/// <param name="ownerID"></param>
/// <param name="fetchFolders"></param>
/// <param name="fetchItems"></param>
/// <param name="sortOrder"></param>
/// <param name="version"></param>
/// <returns>An empty InventoryCollection if the inventory look up failed</returns>
public InventoryCollection Fetch(
UUID agentID, UUID folderID, UUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder, out int version)
{
m_log.DebugFormat(
"[WEBFETCHINVENTORYDESCENDANTS]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
fetchFolders, fetchItems, folderID, agentID);
// m_log.DebugFormat(
// "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
// fetchFolders, fetchItems, folderID, agentID);
// FIXME MAYBE: We're not handling sortOrder!
version = 0;
InventoryFolderImpl fold;
if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner)
{
if ((fold = m_LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
{
InventoryCollection ret = new InventoryCollection();
@@ -197,6 +217,7 @@ namespace OpenSim.Capabilities.Handlers
return ret;
}
}
InventoryCollection contents = new InventoryCollection();
@@ -212,7 +233,7 @@ namespace OpenSim.Capabilities.Handlers
}
else
{
// Lost itemsm don't really need a version
// Lost items don't really need a version
version = 1;
}
@@ -230,10 +251,11 @@ namespace OpenSim.Capabilities.Handlers
llsdFolder.folder_id = invFolder.ID;
llsdFolder.parent_id = invFolder.ParentID;
llsdFolder.name = invFolder.Name;
if (invFolder.Type < 0 || invFolder.Type >= TaskInventoryItem.Types.Length)
if (invFolder.Type == (short)AssetType.Unknown || !Enum.IsDefined(typeof(AssetType), (sbyte)invFolder.Type))
llsdFolder.type = "-1";
else
llsdFolder.type = TaskInventoryItem.Types[invFolder.Type];
llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type);
llsdFolder.preferred_type = "-1";
return llsdFolder;
@@ -254,16 +276,19 @@ namespace OpenSim.Capabilities.Handlers
llsdItem.item_id = invItem.ID;
llsdItem.name = invItem.Name;
llsdItem.parent_id = invItem.Folder;
try
{
// TODO reevaluate after upgrade to libomv >= r2566. Probably should use UtilsConversions.
llsdItem.type = TaskInventoryItem.Types[invItem.AssetType];
llsdItem.inv_type = TaskInventoryItem.InvTypes[invItem.InvType];
llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType);
llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType);
}
catch (Exception e)
{
m_log.ErrorFormat("[CAPS]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}", invItem.AssetType, invItem.InvType, invItem.Name, e.Message);
m_log.ErrorFormat(
"[WEB FETCH INV DESC HANDLER]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}",
invItem.AssetType, invItem.InvType, invItem.Name, e.Message);
}
llsdItem.permissions = new LLSDPermissions();
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
@@ -294,6 +319,5 @@ namespace OpenSim.Capabilities.Handlers
return llsdItem;
}
}
}
}

View File

@@ -37,10 +37,30 @@ namespace OpenSim.Data
public UUID RegionID;
public UUID ScopeID;
public string RegionName;
/// <summary>
/// The position in meters of this region.
/// </summary>
public int posX;
/// <summary>
/// The position in meters of this region.
/// </summary>
public int posY;
public int sizeX;
public int sizeY;
/// <summary>
/// Return the x-coordinate of this region.
/// </summary>
public int coordX { get { return posX / (int)Constants.RegionSize; } }
/// <summary>
/// Return the y-coordinate of this region.
/// </summary>
public int coordY { get { return posY / (int)Constants.RegionSize; } }
public Dictionary<string, object> Data;
}

View File

@@ -565,7 +565,7 @@ namespace OpenSim.Framework.Console
/// </summary>
public class CommandConsole : ConsoleBase, ICommandConsole
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public ICommands Commands { get; private set; }

View File

@@ -102,12 +102,28 @@ namespace OpenSim.Framework
bool TryGetScenePresence(UUID agentID, out object scenePresence);
T RequestModuleInterface<T>();
T[] RequestModuleInterfaces<T>();
/// <summary>
/// Register an interface to a region module. This allows module methods to be called directly as
/// well as via events. If there is already a module registered for this interface, it is not replaced
/// (is this the best behaviour?)
/// </summary>
/// <param name="mod"></param>
void RegisterModuleInterface<M>(M mod);
void StackModuleInterface<M>(M mod);
/// <summary>
/// For the given interface, retrieve the region module which implements it.
/// </summary>
/// <returns>null if there is no registered module implementing that interface</returns>
T RequestModuleInterface<T>();
/// <summary>
/// For the given interface, retrieve an array of region modules that implement it.
/// </summary>
/// <returns>an empty array if there are no registered modules implementing that interface</returns>
T[] RequestModuleInterfaces<T>();
// void AddCommand(object module, string command, string shorthelp, string longhelp, CommandDelegate callback);
ISceneObject DeserializeObject(string representation);

View File

@@ -40,63 +40,6 @@ namespace OpenSim.Framework
/// </summary>
private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647;
/// <summary>
/// Inventory types
/// </summary>
public static string[] InvTypes = new string[]
{
"texture",
"sound",
"calling_card",
"landmark",
String.Empty,
String.Empty,
"object",
"notecard",
String.Empty,
String.Empty,
"lsl_text",
String.Empty,
String.Empty,
"bodypart",
String.Empty,
"snapshot",
String.Empty,
String.Empty,
"wearable",
"animation",
"gesture"
};
/// <summary>
/// Asset types
/// </summary>
public static string[] Types = new string[]
{
"texture",
"sound",
"callcard",
"landmark",
"clothing", // Deprecated
"clothing",
"object",
"notecard",
"category",
"root",
"lsltext",
"lslbyte",
"txtr_tga",
"bodypart",
"trash",
"snapshot",
"lstndfnd",
"snd_wav",
"img_tga",
"jpeg",
"animatn",
"gesture"
};
private UUID _assetID = UUID.Zero;
private uint _baseMask = FULL_MASK_PERMISSIONS_GENERAL;

View File

@@ -295,10 +295,10 @@ namespace OpenSim.Framework
return result;
}
}
catch (Exception e)
catch
{
// don't need to treat this as an error... we're just guessing anyway
m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message);
// m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message);
}
return result;

View File

@@ -70,7 +70,7 @@ namespace OpenSim
/// <param name="networkInfo"></param>
/// <returns>A configuration that gets passed to modules</returns>
public OpenSimConfigSource LoadConfigSettings(
IConfigSource argvSource, out ConfigSettings configSettings,
IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings,
out NetworkServersInfo networkInfo)
{
m_configSettings = configSettings = new ConfigSettings();
@@ -195,6 +195,24 @@ namespace OpenSim
// Make sure command line options take precedence
m_config.Source.Merge(argvSource);
IConfig enVars = m_config.Source.Configs["Environment"];
if( enVars != null )
{
string[] env_keys = enVars.GetKeys();
foreach ( string key in env_keys )
{
envConfigSource.AddEnv(key, string.Empty);
}
envConfigSource.LoadEnv();
m_config.Source.Merge(envConfigSource);
m_config.Source.ExpandKeyValues();
}
ReadConfigSettings();
return m_config;

View File

@@ -112,6 +112,13 @@ namespace OpenSim
get { return m_clientServers; }
}
protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource();
public EnvConfigSource envConfigSource
{
get { return m_EnvConfigSource; }
}
protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
public uint HttpServerPort
@@ -146,7 +153,7 @@ namespace OpenSim
protected virtual void LoadConfigSettings(IConfigSource configSource)
{
m_configLoader = new ConfigurationLoader();
m_config = m_configLoader.LoadConfigSettings(configSource, out m_configSettings, out m_networkServersInfo);
m_config = m_configLoader.LoadConfigSettings(configSource, envConfigSource, out m_configSettings, out m_networkServersInfo);
ReadExtraConfigSettings();
}

View File

@@ -134,7 +134,6 @@ namespace OpenSim.Region.ClientStack.Linden
AddNewInventoryItem = m_Scene.AddUploadedInventoryItem;
ItemUpdatedCall = m_Scene.CapsUpdateInventoryItemAsset;
TaskScriptUpdatedCall = m_Scene.CapsUpdateTaskInventoryScriptAsset;
CAPSFetchInventoryDescendents = m_Scene.HandleFetchInventoryDescendentsCAPS;
GetClient = m_Scene.SceneGraph.GetControllingClient;
}

View File

@@ -39,6 +39,7 @@ using OpenMetaverse.Messages.Linden;
using OpenMetaverse.Packets;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
@@ -58,9 +59,15 @@ namespace OpenSim.Region.ClientStack.Linden
public class EventQueueGetModule : IEventQueue, IRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Scene m_scene = null;
/// <value>
/// Debug level.
/// </value>
public int DebugLevel { get; set; }
protected Scene m_scene;
private IConfigSource m_gConfig;
bool enabledYN = false;
bool enabledYN;
private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
@@ -97,6 +104,15 @@ namespace OpenSim.Region.ClientStack.Linden
scene.EventManager.OnClientClosed += ClientClosed;
scene.EventManager.OnMakeChildAgent += MakeChildAgent;
scene.EventManager.OnRegisterCaps += OnRegisterCaps;
MainConsole.Instance.Commands.AddCommand(
"event queue",
false,
"debug eq",
"debug eq [0|1]",
"debug eq 1 will turn on event queue debugging. This will log all outgoing event queue messages to clients.\n"
+ "debug eq 1 will turn off event queue debugging.",
HandleDebugEq);
}
else
{
@@ -128,6 +144,22 @@ namespace OpenSim.Region.ClientStack.Linden
}
#endregion
protected void HandleDebugEq(string module, string[] args)
{
int debugLevel;
if (!(args.Length == 3 && int.TryParse(args[2], out debugLevel)))
{
MainConsole.Instance.OutputFormat("Usage: debug eq [0|1]");
}
else
{
DebugLevel = debugLevel;
MainConsole.Instance.OutputFormat(
"Set event queue debug level to {0} in {1}", DebugLevel, m_scene.RegionInfo.RegionName);
}
}
/// <summary>
/// Always returns a valid queue
/// </summary>
@@ -314,16 +346,22 @@ namespace OpenSim.Region.ClientStack.Linden
}
// Register this as a caps handler
// FIXME: Confusingly, we need to register separate as a capability so that the client is told about
// EventQueueGet when it receive capability information, but then we replace the rest handler immediately
// afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but
// really it should be possible to directly register the poll handler as a capability.
caps.RegisterHandler("EventQueueGet",
new RestHTTPHandler("POST", capsBase + EventQueueGetUUID.ToString() + "/",
delegate(Hashtable m_dhttpMethod)
{
return ProcessQueue(m_dhttpMethod, agentID, caps);
}));
new RestHTTPHandler("POST", capsBase + EventQueueGetUUID.ToString() + "/", null));
// delegate(Hashtable m_dhttpMethod)
// {
// return ProcessQueue(m_dhttpMethod, agentID, caps);
// }));
// This will persist this beyond the expiry of the caps handlers
MainServer.Instance.AddPollServiceHTTPHandler(
capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePoll, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID));
capsBase + EventQueueGetUUID.ToString() + "/",
EventQueuePoll,
new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID));
Random rnd = new Random(Environment.TickCount);
lock (m_ids)
@@ -348,6 +386,8 @@ namespace OpenSim.Region.ClientStack.Linden
public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request)
{
// m_log.DebugFormat("[EVENT QUEUE GET MODULE]: Invoked GetEvents() for {0}", pAgentId);
Queue<OSD> queue = TryGetQueue(pAgentId);
OSD element;
lock (queue)
@@ -370,12 +410,31 @@ namespace OpenSim.Region.ClientStack.Linden
}
else
{
if (DebugLevel > 0 && element is OSDMap)
{
OSDMap ev = (OSDMap)element;
m_log.DebugFormat(
"[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
ev["message"], m_scene.GetScenePresence(pAgentId).Name);
}
array.Add(element);
lock (queue)
{
while (queue.Count > 0)
{
array.Add(queue.Dequeue());
element = queue.Dequeue();
if (DebugLevel > 0 && element is OSDMap)
{
OSDMap ev = (OSDMap)element;
m_log.DebugFormat(
"[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
ev["message"], m_scene.GetScenePresence(pAgentId).Name);
}
array.Add(element);
thisID++;
}
}
@@ -412,148 +471,166 @@ namespace OpenSim.Region.ClientStack.Linden
return responsedata;
}
public Hashtable ProcessQueue(Hashtable request, UUID agentID, Caps caps)
{
// TODO: this has to be redone to not busy-wait (and block the thread),
// TODO: as soon as we have a non-blocking way to handle HTTP-requests.
// if (m_log.IsDebugEnabled)
// {
// String debug = "[EVENTQUEUE]: Got request for agent {0} in region {1} from thread {2}: [ ";
// foreach (object key in request.Keys)
// public Hashtable ProcessQueue(Hashtable request, UUID agentID, Caps caps)
// {
// // TODO: this has to be redone to not busy-wait (and block the thread),
// // TODO: as soon as we have a non-blocking way to handle HTTP-requests.
//
//// if (m_log.IsDebugEnabled)
//// {
//// String debug = "[EVENTQUEUE]: Got request for agent {0} in region {1} from thread {2}: [ ";
//// foreach (object key in request.Keys)
//// {
//// debug += key.ToString() + "=" + request[key].ToString() + " ";
//// }
//// m_log.DebugFormat(debug + " ]", agentID, m_scene.RegionInfo.RegionName, System.Threading.Thread.CurrentThread.Name);
//// }
//
// Queue<OSD> queue = TryGetQueue(agentID);
// OSD element;
//
// lock (queue)
// element = queue.Dequeue(); // 15s timeout
//
// Hashtable responsedata = new Hashtable();
//
// int thisID = 0;
// lock (m_ids)
// thisID = m_ids[agentID];
//
// if (element == null)
// {
// //m_log.ErrorFormat("[EVENTQUEUE]: Nothing to process in " + m_scene.RegionInfo.RegionName);
// if (thisID == -1) // close-request
// {
// debug += key.ToString() + "=" + request[key].ToString() + " ";
// m_log.ErrorFormat("[EVENTQUEUE]: 404 in " + m_scene.RegionInfo.RegionName);
// responsedata["int_response_code"] = 404; //501; //410; //404;
// responsedata["content_type"] = "text/plain";
// responsedata["keepalive"] = false;
// responsedata["str_response_string"] = "Closed EQG";
// return responsedata;
// }
// m_log.DebugFormat(debug + " ]", agentID, m_scene.RegionInfo.RegionName, System.Threading.Thread.CurrentThread.Name);
// responsedata["int_response_code"] = 502;
// responsedata["content_type"] = "text/plain";
// responsedata["keepalive"] = false;
// responsedata["str_response_string"] = "Upstream error: ";
// responsedata["error_status_text"] = "Upstream error:";
// responsedata["http_protocol_version"] = "HTTP/1.0";
// return responsedata;
// }
Queue<OSD> queue = TryGetQueue(agentID);
OSD element;
lock (queue)
element = queue.Dequeue(); // 15s timeout
Hashtable responsedata = new Hashtable();
int thisID = 0;
lock (m_ids)
thisID = m_ids[agentID];
if (element == null)
{
//m_log.ErrorFormat("[EVENTQUEUE]: Nothing to process in " + m_scene.RegionInfo.RegionName);
if (thisID == -1) // close-request
{
m_log.ErrorFormat("[EVENTQUEUE]: 404 in " + m_scene.RegionInfo.RegionName);
responsedata["int_response_code"] = 404; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Closed EQG";
return responsedata;
}
responsedata["int_response_code"] = 502;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Upstream error: ";
responsedata["error_status_text"] = "Upstream error:";
responsedata["http_protocol_version"] = "HTTP/1.0";
return responsedata;
}
OSDArray array = new OSDArray();
if (element == null) // didn't have an event in 15s
{
// Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
array.Add(EventQueueHelper.KeepAliveEvent());
//m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
}
else
{
array.Add(element);
lock (queue)
{
while (queue.Count > 0)
{
array.Add(queue.Dequeue());
thisID++;
}
}
}
OSDMap events = new OSDMap();
events.Add("events", array);
events.Add("id", new OSDInteger(thisID));
lock (m_ids)
{
m_ids[agentID] = thisID + 1;
}
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "application/xml";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
return responsedata;
}
//
// OSDArray array = new OSDArray();
// if (element == null) // didn't have an event in 15s
// {
// // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
// array.Add(EventQueueHelper.KeepAliveEvent());
// //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
// }
// else
// {
// array.Add(element);
//
// if (element is OSDMap)
// {
// OSDMap ev = (OSDMap)element;
// m_log.DebugFormat(
// "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
// ev["message"], m_scene.GetScenePresence(agentID).Name);
// }
//
// lock (queue)
// {
// while (queue.Count > 0)
// {
// element = queue.Dequeue();
//
// if (element is OSDMap)
// {
// OSDMap ev = (OSDMap)element;
// m_log.DebugFormat(
// "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
// ev["message"], m_scene.GetScenePresence(agentID).Name);
// }
//
// array.Add(element);
// thisID++;
// }
// }
// }
//
// OSDMap events = new OSDMap();
// events.Add("events", array);
//
// events.Add("id", new OSDInteger(thisID));
// lock (m_ids)
// {
// m_ids[agentID] = thisID + 1;
// }
//
// responsedata["int_response_code"] = 200;
// responsedata["content_type"] = "application/xml";
// responsedata["keepalive"] = false;
// responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
//
// m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
//
// return responsedata;
// }
public Hashtable EventQueuePoll(Hashtable request)
{
return new Hashtable();
}
public Hashtable EventQueuePath2(Hashtable request)
{
string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/","");
// pull off the last "/" in the path.
Hashtable responsedata = new Hashtable();
capuuid = capuuid.Substring(0, capuuid.Length - 1);
capuuid = capuuid.Replace("/CAPS/EQG/", "");
UUID AvatarID = UUID.Zero;
UUID capUUID = UUID.Zero;
// parse the path and search for the avatar with it registered
if (UUID.TryParse(capuuid, out capUUID))
{
lock (m_QueueUUIDAvatarMapping)
{
if (m_QueueUUIDAvatarMapping.ContainsKey(capUUID))
{
AvatarID = m_QueueUUIDAvatarMapping[capUUID];
}
}
if (AvatarID != UUID.Zero)
{
return ProcessQueue(request, AvatarID, m_scene.CapsModule.GetCapsForUser(AvatarID));
}
else
{
responsedata["int_response_code"] = 404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Not Found";
responsedata["error_status_text"] = "Not Found";
responsedata["http_protocol_version"] = "HTTP/1.0";
return responsedata;
// return 404
}
}
else
{
responsedata["int_response_code"] = 404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "Not Found";
responsedata["error_status_text"] = "Not Found";
responsedata["http_protocol_version"] = "HTTP/1.0";
return responsedata;
// return 404
}
}
// public Hashtable EventQueuePath2(Hashtable request)
// {
// string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/","");
// // pull off the last "/" in the path.
// Hashtable responsedata = new Hashtable();
// capuuid = capuuid.Substring(0, capuuid.Length - 1);
// capuuid = capuuid.Replace("/CAPS/EQG/", "");
// UUID AvatarID = UUID.Zero;
// UUID capUUID = UUID.Zero;
//
// // parse the path and search for the avatar with it registered
// if (UUID.TryParse(capuuid, out capUUID))
// {
// lock (m_QueueUUIDAvatarMapping)
// {
// if (m_QueueUUIDAvatarMapping.ContainsKey(capUUID))
// {
// AvatarID = m_QueueUUIDAvatarMapping[capUUID];
// }
// }
//
// if (AvatarID != UUID.Zero)
// {
// return ProcessQueue(request, AvatarID, m_scene.CapsModule.GetCapsForUser(AvatarID));
// }
// else
// {
// responsedata["int_response_code"] = 404;
// responsedata["content_type"] = "text/plain";
// responsedata["keepalive"] = false;
// responsedata["str_response_string"] = "Not Found";
// responsedata["error_status_text"] = "Not Found";
// responsedata["http_protocol_version"] = "HTTP/1.0";
// return responsedata;
// // return 404
// }
// }
// else
// {
// responsedata["int_response_code"] = 404;
// responsedata["content_type"] = "text/plain";
// responsedata["keepalive"] = false;
// responsedata["str_response_string"] = "Not Found";
// responsedata["error_status_text"] = "Not Found";
// responsedata["http_protocol_version"] = "HTTP/1.0";
// return responsedata;
// // return 404
// }
// }
public OSD EventQueueFallBack(string path, OSD request, string endpoint)
{
@@ -717,6 +794,7 @@ namespace OpenSim.Region.ClientStack.Linden
OSD item = EventQueueHelper.GroupMembership(groupUpdate);
Enqueue(item, avatarID);
}
public void QueryReply(PlacesReplyPacket groupUpdate, UUID avatarID)
{
OSD item = EventQueueHelper.PlacesQuery(groupUpdate);

View File

@@ -42,18 +42,25 @@ using OpenSim.Capabilities.Handlers;
namespace OpenSim.Region.ClientStack.Linden
{
/// <summary>
/// This module implements both WebFetchInventoryDescendents and FetchInventoryDescendents2 capabilities.
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class WebFetchInvDescModule : INonSharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene;
private IInventoryService m_InventoryService;
private ILibraryService m_LibraryService;
private bool m_Enabled = false;
private string m_URL;
private bool m_Enabled;
private string m_fetchInventoryDescendents2Url;
private string m_webFetchInventoryDescendentsUrl;
private WebFetchInvDescHandler m_webFetchHandler;
#region ISharedRegionModule Members
@@ -63,10 +70,13 @@ namespace OpenSim.Region.ClientStack.Linden
if (config == null)
return;
m_URL = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty);
// Cap doesn't exist
if (m_URL != string.Empty)
m_fetchInventoryDescendents2Url = config.GetString("Cap_FetchInventoryDescendents2", string.Empty);
m_webFetchInventoryDescendentsUrl = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty);
if (m_fetchInventoryDescendents2Url != string.Empty || m_webFetchInventoryDescendentsUrl != string.Empty)
{
m_Enabled = true;
}
}
public void AddRegion(Scene s)
@@ -91,8 +101,13 @@ namespace OpenSim.Region.ClientStack.Linden
if (!m_Enabled)
return;
m_InventoryService = m_scene.InventoryService; ;
m_InventoryService = m_scene.InventoryService;
m_LibraryService = m_scene.LibraryService;
// We'll reuse the same handler for all requests.
if (m_fetchInventoryDescendents2Url == "localhost" || m_webFetchInventoryDescendentsUrl == "localhost")
m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
}
@@ -111,24 +126,38 @@ namespace OpenSim.Region.ClientStack.Linden
#endregion
public void RegisterCaps(UUID agentID, Caps caps)
private void RegisterCaps(UUID agentID, Caps caps)
{
UUID capID = UUID.Random();
if (m_webFetchInventoryDescendentsUrl != "")
RegisterFetchCap(agentID, caps, "WebFetchInventoryDescendents", m_webFetchInventoryDescendentsUrl);
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
if (m_URL == "localhost")
if (m_fetchInventoryDescendents2Url != "")
RegisterFetchCap(agentID, caps, "FetchInventoryDescendents2", m_fetchInventoryDescendents2Url);
}
private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url)
{
string capUrl;
if (url == "localhost")
{
m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), webFetchHandler.FetchInventoryDescendentsRequest);
caps.RegisterHandler("WebFetchInventoryDescendents", reqHandler);
capUrl = "/CAPS/" + UUID.Random();
IRequestHandler reqHandler
= new RestStreamHandler("POST", capUrl, m_webFetchHandler.FetchInventoryDescendentsRequest);
caps.RegisterHandler(capName, reqHandler);
}
else
{
m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
caps.RegisterHandler("WebFetchInventoryDescendents", m_URL);
}
}
capUrl = url;
caps.RegisterHandler(capName, capUrl);
}
// m_log.DebugFormat(
// "[WEB FETCH INV DESC MODULE]: Registered capability {0} at {1} in region {2} for {3}",
// capName, capUrl, m_scene.RegionInfo.RegionName, agentID);
}
}
}

View File

@@ -11730,7 +11730,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
logPacket = false;
if (logPacket)
m_log.DebugFormat("[CLIENT]: Packet OUT {0} to {1}", packet.Type, Name);
m_log.DebugFormat(
"[CLIENT]: PACKET OUT to {0} ({1}) in {2} - {3}",
Name, ChildAgentStatus() ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type);
}
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting, method);
@@ -11773,19 +11775,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (DebugPacketLevel > 0)
{
bool outputPacket = true;
bool logPacket = true;
if (DebugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate)
outputPacket = false;
logPacket = false;
if (DebugPacketLevel <= 200 && packet.Type == PacketType.RequestImage)
outputPacket = false;
logPacket = false;
if (DebugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
outputPacket = false;
logPacket = false;
if (outputPacket)
m_log.DebugFormat("[CLIENT]: Packet IN {0} from {1}", packet.Type, Name);
if (logPacket)
m_log.DebugFormat(
"[CLIENT]: PACKET IN from {0} ({1}) in {2} - {3}",
Name, ChildAgentStatus() ? "child" : "root ", m_scene.RegionInfo.RegionName, packet.Type);
}
if (!ProcessPacketMethod(packet))

View File

@@ -25,11 +25,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using log4net;
using Nini.Config;
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Server.Base;
using OpenSim.Region.Framework.Interfaces;
@@ -119,10 +120,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
#region INeighbourService
public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
public OpenSim.Services.Interfaces.GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
{
m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}.",
thisRegion.RegionName, regionHandle);
uint x, y;
Utils.LongToUInts(regionHandle, out x, out y);
m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from region {0} to region at {1}-{2}",
thisRegion.RegionName, x / Constants.RegionSize, y / Constants.RegionSize);
foreach (Scene s in m_Scenes)
{
if (s.RegionInfo.RegionHandle == regionHandle)

View File

@@ -196,7 +196,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
}
}
m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Did not find region {0} for SendCreateChildAgent", destination.RegionName);
reason = "Did not find region " + destination.RegionName;
return false;
}

View File

@@ -86,6 +86,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
private volatile bool m_tainted;
private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
/// <summary>
/// Human readable list of terrain file extensions that are supported.
/// </summary>
private string m_supportedFileExtensions = "";
#region ICommandableModule Members
public ICommander CommandInterface
@@ -135,6 +140,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
InstallDefaultEffects();
LoadPlugins();
// Generate user-readable extensions list
string supportedFilesSeparator = "";
foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
{
m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")";
supportedFilesSeparator = ", ";
}
}
public void RegionLoaded(Scene scene)
@@ -251,20 +265,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
if (filename.EndsWith(loader.Key))
{
loader.Value.SaveFile(filename, m_channel);
m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename);
return;
}
}
}
catch (NotImplementedException)
{
m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented.");
throw new TerrainException(String.Format("Unable to save heightmap: saving of this file format not implemented"));
}
catch (IOException ioe)
{
m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message));
throw new TerrainException(String.Format("Unable to save heightmap: {0}", ioe.Message));
}
m_log.ErrorFormat(
"[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
}
/// <summary>
@@ -345,6 +358,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
float duration = 0.25f;
if (action == 0)
duration = 4.0f;
client_OnModifyTerrain(user, (float)pos.Z, duration, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId);
}
@@ -534,6 +548,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
m_channel = channel;
UpdateRevertMap();
}
return;
}
}
@@ -566,10 +581,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
fileWidth, fileHeight,
(int)Constants.RegionSize,
(int)Constants.RegionSize);
m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename);
}
return;
}
}
m_log.ErrorFormat(
"[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
}
}
@@ -1126,32 +1148,23 @@ namespace OpenSim.Region.CoreModules.World.Terrain
private void InstallInterfaces()
{
// Load / Save
string supportedFileExtensions = "";
string supportedFilesSeparator = "";
foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
{
supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")";
supportedFilesSeparator = ", ";
}
Command loadFromFileCommand =
new Command("load", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadFile, "Loads a terrain from a specified file.");
loadFromFileCommand.AddArgument("filename",
"The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " +
supportedFileExtensions, "String");
m_supportedFileExtensions, "String");
Command saveToFileCommand =
new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveFile, "Saves the current heightmap to a specified file.");
saveToFileCommand.AddArgument("filename",
"The destination filename for your heightmap, the file extension determines the format to save in. Supported extensions include: " +
supportedFileExtensions, "String");
m_supportedFileExtensions, "String");
Command loadFromTileCommand =
new Command("load-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadTileFile, "Loads a terrain from a section of a larger file.");
loadFromTileCommand.AddArgument("filename",
"The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " +
supportedFileExtensions, "String");
m_supportedFileExtensions, "String");
loadFromTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer");
loadFromTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer");
loadFromTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file",
@@ -1163,7 +1176,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
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");
m_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",

View File

@@ -92,7 +92,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
return;
}
m_log.DebugFormat("MAP NAME=({0})", mapName);
//m_log.DebugFormat("MAP NAME=({0})", mapName);
// try to fetch from GridServer
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);

View File

@@ -102,9 +102,10 @@ namespace OpenSim.Region.Framework.Scenes
public event OnPluginConsoleDelegate OnPluginConsole;
public delegate void OnShutdownDelegate();
public event OnShutdownDelegate OnShutdown;
/// <summary>
/// Triggered when the entire simulator is shutdown.
/// </summary>
public event Action OnShutdown;
public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
public delegate void ScriptResetDelegate(uint localID, UUID itemID);
@@ -117,9 +118,14 @@ namespace OpenSim.Region.Framework.Scenes
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public delegate void SceneShuttingDownDelegate(Scene scene);
public event SceneShuttingDownDelegate OnSceneShuttingDown;
/// <summary>
/// Triggered when an individual scene is shutdown.
/// </summary>
/// <remarks>
/// This does not automatically mean that the entire simulator is shutting down. Listen to OnShutdown for that
/// notification.
/// </remarks>
public event Action<Scene> OnSceneShuttingDown;
/// <summary>
/// Fired when an object is touched/grabbed.
@@ -893,10 +899,10 @@ namespace OpenSim.Region.Framework.Scenes
public void TriggerShutdown()
{
OnShutdownDelegate handlerShutdown = OnShutdown;
Action handlerShutdown = OnShutdown;
if (handlerShutdown != null)
{
foreach (OnShutdownDelegate d in handlerShutdown.GetInvocationList())
foreach (Action d in handlerShutdown.GetInvocationList())
{
try
{
@@ -2236,10 +2242,10 @@ namespace OpenSim.Region.Framework.Scenes
public void TriggerSceneShuttingDown(Scene s)
{
SceneShuttingDownDelegate handler = OnSceneShuttingDown;
Action<Scene> handler = OnSceneShuttingDown;
if (handler != null)
{
foreach (SceneShuttingDownDelegate d in handler.GetInvocationList())
foreach (Action<Scene> d in handler.GetInvocationList())
{
try
{

View File

@@ -82,16 +82,9 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
if (engines != null)
{
foreach (IScriptModule engine in engines)
{
if (engine != null)
{
engine.StartProcessing();
}
}
}
foreach (IScriptModule engine in engines)
engine.StartProcessing();
}
public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)

View File

@@ -330,7 +330,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
}
}
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{
@@ -487,6 +487,7 @@ namespace OpenSim.Region.Framework.Scenes
// can be handled transparently).
InventoryFolderImpl fold = null;
if (LibraryService != null && LibraryService.LibraryRootFolder != null)
{
if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
{
remoteClient.SendInventoryFolderDetails(
@@ -494,6 +495,7 @@ namespace OpenSim.Region.Framework.Scenes
fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems);
return;
}
}
// We're going to send the reply async, because there may be
// an enormous quantity of packets -- basically the entire inventory!
@@ -514,64 +516,6 @@ namespace OpenSim.Region.Framework.Scenes
SendInventoryDelegate d = (SendInventoryDelegate)iar.AsyncState;
d.EndInvoke(iar);
}
/// <summary>
/// Handle the caps inventory descendents fetch.
///
/// Since the folder structure is sent to the client on login, I believe we only need to handle items.
/// Diva comment 8/13/2009: what if someone gave us a folder in the meantime??
/// </summary>
/// <param name="agentID"></param>
/// <param name="folderID"></param>
/// <param name="ownerID"></param>
/// <param name="fetchFolders"></param>
/// <param name="fetchItems"></param>
/// <param name="sortOrder"></param>
/// <returns>null if the inventory look up failed</returns>
public InventoryCollection HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder, out int version)
{
m_log.DebugFormat(
"[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
fetchFolders, fetchItems, folderID, agentID);
// FIXME MAYBE: We're not handling sortOrder!
// TODO: This code for looking in the folder for the library should be folded back into the
// CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
// can be handled transparently).
InventoryFolderImpl fold;
if (LibraryService != null && LibraryService.LibraryRootFolder != null)
if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
{
version = 0;
InventoryCollection ret = new InventoryCollection();
ret.Folders = new List<InventoryFolderBase>();
ret.Items = fold.RequestListOfItems();
return ret;
}
InventoryCollection contents = new InventoryCollection();
if (folderID != UUID.Zero)
{
contents = InventoryService.GetFolderContent(agentID, folderID);
InventoryFolderBase containingFolder = new InventoryFolderBase();
containingFolder.ID = folderID;
containingFolder.Owner = agentID;
containingFolder = InventoryService.GetFolder(containingFolder);
version = containingFolder.Version;
}
else
{
// Lost itemsm don't really need a version
version = 1;
}
return contents;
}
/// <summary>
/// Handle an inventory folder creation request from the client.
@@ -646,14 +590,13 @@ namespace OpenSim.Region.Framework.Scenes
}
}
delegate void PurgeFolderDelegate(UUID userID, UUID folder);
/// <summary>
/// This should delete all the items and folders in the given directory.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="folderID"></param>
delegate void PurgeFolderDelegate(UUID userID, UUID folder);
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
{
PurgeFolderDelegate d = PurgeFolderAsync;
@@ -667,7 +610,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
private void PurgeFolderAsync(UUID userID, UUID folderID)
{
InventoryFolderBase folder = new InventoryFolderBase(folderID, userID);

View File

@@ -215,6 +215,7 @@ namespace OpenSim.Region.Framework.Scenes
private int m_lastIncoming;
private int m_lastOutgoing;
private bool m_firstHeartbeat = true;
private int m_hbRestarts = 0;
private object m_deleting_scene_object = new object();
@@ -1166,6 +1167,9 @@ namespace OpenSim.Region.Framework.Scenes
//m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
if (HeartbeatThread != null)
{
m_hbRestarts++;
if(m_hbRestarts > 10)
Environment.Exit(1);
m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName);
HeartbeatThread.Abort();
Watchdog.AbortThread(HeartbeatThread.ManagedThreadId);
@@ -4834,9 +4838,6 @@ namespace OpenSim.Region.Framework.Scenes
public Vector3? GetNearestAllowedPosition(ScenePresence avatar)
{
//simulate to make sure we have pretty up to date positions
PhysicsScene.Simulate(0);
ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (nearestParcel != null)
@@ -4863,12 +4864,13 @@ namespace OpenSim.Region.Framework.Scenes
//Ultimate backup if we have no idea where they are
Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString());
return avatar.lastKnownAllowedPosition;
}
//Go to the edge, this happens in teleporting to a region with no available parcels
Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar);
//Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
return nearestRegionEdgePoint;
}
@@ -5218,18 +5220,16 @@ namespace OpenSim.Region.Framework.Scenes
return offsets.ToArray();
}
/// <summary>
/// Regenerate the maptile for this scene.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void RegenerateMaptile(object sender, ElapsedEventArgs e)
{
IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>();
if (mapModule != null)
{
mapModule.GenerateMaptile();
string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo));
if (error != String.Empty)
throw new Exception(error);
}
}
// public void CleanDroppedAttachments()

View File

@@ -451,7 +451,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
return new T[] { default(T) };
return new T[] {};
}
}

View File

@@ -174,7 +174,6 @@ namespace OpenSim.Region.Framework.Scenes
{
// We're ignoring a collection was modified error because this data gets old and outdated fast.
}
}
public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle);
@@ -185,13 +184,12 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
protected void SendCloseChildAgentAsync(UUID agentID, ulong regionHandle)
{
//m_log.Debug("[INTERGRID]: Sending close agent to " + regionHandle);
// let's do our best, but there's not much we can do if the neighbour doesn't accept.
//m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
uint x = 0, y = 0;
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y);
m_scene.SimulationService.CloseChildAgent(destination, agentID);
}

View File

@@ -448,29 +448,25 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
/// Set the debug packet level on the current scene. This level governs which packets are printed out to the
/// Set the debug packet level on each current scene. This level governs which packets are printed out to the
/// console.
/// </summary>
/// <param name="newDebug"></param>
/// <param name="name">Name of avatar to debug</param>
public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name)
{
ForEachCurrentScene(
delegate(Scene scene)
ForEachCurrentScene(scene =>
scene.ForEachScenePresence(sp =>
{
scene.ForEachRootClient(delegate(IClientAPI client)
if (name == null || sp.Name == name)
{
if (name == null || client.Name == name)
{
m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
client.FirstName,
client.LastName,
newDebug);
m_log.DebugFormat(
"Packet debug for {0} ({1}) set to {2}",
sp.Name, sp.IsChildAgent ? "child" : "root", newDebug);
client.DebugPacketLevel = newDebug;
}
});
}
sp.ControllingClient.DebugPacketLevel = newDebug;
}
})
);
}

View File

@@ -252,7 +252,6 @@ namespace OpenSim.Region.Framework.Scenes
private byte[] m_TextureAnimation;
private byte m_clickAction;
private Color m_color = Color.Black;
private string m_description = String.Empty;
private readonly List<uint> m_lastColliders = new List<uint>();
private int m_linkNum;
@@ -331,11 +330,14 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public SceneObjectPart()
{
// It's not necessary to persist this
m_TextureAnimation = Utils.EmptyBytes;
m_particleSystem = Utils.EmptyBytes;
Rezzed = DateTime.UtcNow;
Description = String.Empty;
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
// the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
m_inventory = new SceneObjectPartInventory(this);
}
@@ -349,11 +351,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="offsetPosition"></param>
public SceneObjectPart(
UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
Quaternion rotationOffset, Vector3 offsetPosition)
Quaternion rotationOffset, Vector3 offsetPosition) : this()
{
m_name = "Object";
Rezzed = DateTime.UtcNow;
CreationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
LastOwnerID = CreatorID = OwnerID = ownerID;
UUID = UUID.Random();
@@ -368,19 +369,10 @@ namespace OpenSim.Region.Framework.Scenes
Velocity = Vector3.Zero;
AngularVelocity = Vector3.Zero;
Acceleration = Vector3.Zero;
m_TextureAnimation = Utils.EmptyBytes;
m_particleSystem = Utils.EmptyBytes;
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
// the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
Flags = 0;
CreateSelected = true;
TrimPermissions();
m_inventory = new SceneObjectPartInventory(this);
}
#endregion Constructors
@@ -938,19 +930,7 @@ namespace OpenSim.Region.Framework.Scenes
set { m_acceleration = value; }
}
public string Description
{
get { return m_description; }
set
{
m_description = value;
PhysicsActor actor = PhysActor;
if (actor != null)
{
actor.SOPDescription = value;
}
}
}
public string Description { get; set; }
/// <value>
/// Text color.
@@ -1595,8 +1575,7 @@ namespace OpenSim.Region.Framework.Scenes
// Basic Physics returns null.. joy joy joy.
if (PhysActor != null)
{
PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info
PhysActor.SOPDescription = this.Description;
PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info
PhysActor.SetMaterial(Material);
DoPhysicsPropertyUpdate(RigidBody, true);
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);

View File

@@ -282,8 +282,6 @@ namespace OpenSim.Region.Framework.Scenes
ArrayList ret = new ArrayList();
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
if (engines == null) // No engine at all
return ret;
foreach (IScriptModule e in engines)
{
@@ -397,7 +395,7 @@ namespace OpenSim.Region.Framework.Scenes
private void RestoreSavedScriptState(UUID oldID, UUID newID)
{
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
if (engines == null) // No engine at all
if (engines.Length == 0) // No engine at all
return;
if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID))
@@ -437,6 +435,7 @@ namespace OpenSim.Region.Framework.Scenes
m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml;
}
foreach (IScriptModule e in engines)
{
if (e != null)
@@ -445,6 +444,7 @@ namespace OpenSim.Region.Framework.Scenes
break;
}
}
m_part.ParentGroup.m_savedScriptState.Remove(oldID);
}
}
@@ -1085,8 +1085,8 @@ namespace OpenSim.Region.Framework.Scenes
invString.AddNameValueLine("asset_id", item.AssetID.ToString());
else
invString.AddNameValueLine("asset_id", UUID.Zero.ToString());
invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
invString.AddNameValueLine("type", Utils.AssetTypeToString((AssetType)item.Type));
invString.AddNameValueLine("inv_type", Utils.InventoryTypeToString((InventoryType)item.InvType));
invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
invString.AddSaleStart();
@@ -1327,7 +1327,7 @@ namespace OpenSim.Region.Framework.Scenes
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
if (engines == null) // No engine at all
if (engines.Length == 0) // No engine at all
return ret;
Items.LockItemsForRead(true);
@@ -1365,7 +1365,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ResumeScripts()
{
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
if (engines == null)
if (engines.Length == 0)
return;

View File

@@ -3535,23 +3535,23 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="args">The arguments for the event</param>
public void SendScriptEventToAttachments(string eventName, Object[] args)
{
if (m_scriptEngines != null)
{
lock (m_attachments)
{
foreach (SceneObjectGroup grp in m_attachments)
{
// 16384 is CHANGED_ANIMATION
//
// Send this to all attachment root prims
//
foreach (IScriptModule m in m_scriptEngines)
{
if (m == null) // No script engine loaded
continue;
if (m_scriptEngines.Length == 0)
return;
m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION });
}
lock (m_attachments)
{
foreach (SceneObjectGroup grp in m_attachments)
{
// 16384 is CHANGED_ANIMATION
//
// Send this to all attachment root prims
//
foreach (IScriptModule m in m_scriptEngines)
{
if (m == null) // No script engine loaded
continue;
m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION });
}
}
}

View File

@@ -48,7 +48,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
public class PhysicsParameters : ISharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static string LogHeader = "[PHYSICS PARAMETERS]";
// private static string LogHeader = "[PHYSICS PARAMETERS]";
private List<Scene> m_scenes = new List<Scene>();
private static bool m_commandsLoaded = false;

View File

@@ -160,8 +160,19 @@ namespace OpenSim.Region.Physics.Manager
public abstract bool Selected { set; }
/// <summary>
/// Name of this actor.
/// </summary>
/// <remarks>
/// XXX: Bizarrely, this cannot be "Terrain" or "Water" right now unless it really is simulating terrain or
/// water. This is not a problem due to the formatting of names given by prims and avatars.
/// </remarks>
public string Name { get; protected set; }
/// <summary>
/// This is being used by ODE joint code.
/// </summary>
public string SOPName;
public string SOPDescription;
public abstract void CrossingFailure();

View File

@@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.Manager
public abstract class PhysicsScene
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Name of this scene. Useful in debug messages to distinguish one OdeScene instance from another.
@@ -224,15 +224,9 @@ namespace OpenSim.Region.Physics.Manager
return false;
}
public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
{
return;
}
public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {}
public virtual void UnCombine(PhysicsScene pScene)
{
}
public virtual void UnCombine(PhysicsScene pScene) {}
/// <summary>
/// Queue a raycast against the physics scene.

View File

@@ -70,7 +70,6 @@ namespace OpenSim.Region.Physics.OdePlugin
private Vector3 _position;
private d.Vector3 _zeroPosition;
// private d.Matrix3 m_StandUpRotation;
private bool _zeroFlag = false;
private bool m_lastUpdateSent = false;
private Vector3 _velocity;
@@ -87,7 +86,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private float CAPSULE_RADIUS = 0.37f;
private float CAPSULE_LENGTH = 2.140599f;
private float m_tensor = 3800000f;
private float heightFudgeFactor = 0.52f;
// private float heightFudgeFactor = 0.52f;
private float walkDivisor = 1.3f;
private float runDivisor = 0.8f;
private bool flying = false;
@@ -123,9 +122,6 @@ namespace OpenSim.Region.Physics.OdePlugin
private float m_buoyancy = 0f;
// private CollisionLocker ode;
private string m_name = String.Empty;
private bool[] m_colliderarr = new bool[11];
private bool[] m_colliderGroundarr = new bool[11];
@@ -153,7 +149,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public OdeCharacter(
String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p,
float capsule_radius, float tensor, float density, float height_fudge_factor,
float capsule_radius, float tensor, float density,
float walk_divisor, float rundivisor)
{
m_uuid = UUID.Random();
@@ -181,7 +177,7 @@ namespace OpenSim.Region.Physics.OdePlugin
parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f);
m_taintPosition = _position;
m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
m_log.WarnFormat("[ODE CHARACTER]: Got NaN Position on Character Create for {0}", avName);
}
_parent_scene = parent_scene;
@@ -191,7 +187,7 @@ namespace OpenSim.Region.Physics.OdePlugin
CAPSULE_RADIUS = capsule_radius;
m_tensor = tensor;
m_density = density;
heightFudgeFactor = height_fudge_factor;
// heightFudgeFactor = height_fudge_factor;
walkDivisor = walk_divisor;
runDivisor = rundivisor;
@@ -204,7 +200,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_colliderarr[i] = false;
}
CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
//m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH.ToString());
m_tainted_CAPSULE_LENGTH = CAPSULE_LENGTH;
m_isPhysical = false; // current status: no ODE information exists
@@ -212,7 +208,7 @@ namespace OpenSim.Region.Physics.OdePlugin
_parent_scene.AddPhysicsActorTaint(this);
m_name = avName;
Name = avName;
}
public override int PhysicsActorType
@@ -269,7 +265,7 @@ namespace OpenSim.Region.Physics.OdePlugin
set
{
flying = value;
// m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying);
// m_log.DebugFormat("[ODE CHARACTER]: Set OdeCharacter Flying to {0}", flying);
}
}
@@ -440,7 +436,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_log.Warn("[PHYSICS]: Got a NaN Position from Scene on a Character");
m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Position from Scene on character {0}", Name);
}
}
}
@@ -467,7 +463,7 @@ namespace OpenSim.Region.Physics.OdePlugin
Vector3 SetSize = value;
m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
// m_log.Info("[SIZE]: " + CAPSULE_LENGTH);
// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH);
// If we reset velocity here, then an avatar stalls when it crosses a border for the first time
// (as the height of the new root agent is set).
@@ -477,7 +473,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_log.Warn("[PHYSICS]: Got a NaN Size from Scene on a Character");
m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size from Scene on {0}", Name);
}
}
}
@@ -529,7 +525,6 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
// movementVector.Z is zero
// calculate tilt components based on desired amount of tilt and current (snapped) heading.
@@ -537,7 +532,7 @@ namespace OpenSim.Region.Physics.OdePlugin
float xTiltComponent = -movementVector.X * m_tiltMagnitudeWhenProjectedOnXYPlane;
float yTiltComponent = -movementVector.Y * m_tiltMagnitudeWhenProjectedOnXYPlane;
//m_log.Debug("[PHYSICS] changing avatar tilt");
//m_log.Debug("[ODE CHARACTER]: changing avatar tilt");
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, xTiltComponent);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, xTiltComponent); // must be same as lowstop, else a different, spurious tilt is introduced
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, yTiltComponent);
@@ -546,124 +541,6 @@ namespace OpenSim.Region.Physics.OdePlugin
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
}
/// <summary>
/// This creates the Avatar's physical Surrogate at the position supplied
/// </summary>
/// <param name="npositionX"></param>
/// <param name="npositionY"></param>
/// <param name="npositionZ"></param>
// WARNING: This MUST NOT be called outside of ProcessTaints, else we can have unsynchronized access
// to ODE internals. ProcessTaints is called from within thread-locked Simulate(), so it is the only
// place that is safe to call this routine AvatarGeomAndBodyCreation.
private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ, float tensor)
{
//CAPSULE_LENGTH = -5;
//CAPSULE_RADIUS = -5;
int dAMotorEuler = 1;
_parent_scene.waitForSpaceUnlock(_parent_scene.space);
if (CAPSULE_LENGTH <= 0)
{
m_log.Warn("[PHYSICS]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
CAPSULE_LENGTH = 0.01f;
}
if (CAPSULE_RADIUS <= 0)
{
m_log.Warn("[PHYSICS]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
CAPSULE_RADIUS = 0.01f;
}
Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
d.GeomSetCollideBits(Shell, (int)m_collisionFlags);
d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
Body = d.BodyCreate(_parent_scene.world);
d.BodySetPosition(Body, npositionX, npositionY, npositionZ);
_position.X = npositionX;
_position.Y = npositionY;
_position.Z = npositionZ;
m_taintPosition = _position;
d.BodySetMass(Body, ref ShellMass);
d.Matrix3 m_caprot;
// 90 Stand up on the cap of the capped cyllinder
if (_parent_scene.IsAvCapsuleTilted)
{
d.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2));
}
else
{
d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2));
}
d.GeomSetRotation(Shell, ref m_caprot);
d.BodySetRotation(Body, ref m_caprot);
d.GeomSetBody(Shell, Body);
// The purpose of the AMotor here is to keep the avatar's physical
// surrogate from rotating while moving
Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
d.JointAttach(Amotor, Body, IntPtr.Zero);
d.JointSetAMotorMode(Amotor, dAMotorEuler);
d.JointSetAMotorNumAxes(Amotor, 3);
d.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0);
d.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0);
d.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1);
d.JointSetAMotorAngle(Amotor, 0, 0);
d.JointSetAMotorAngle(Amotor, 1, 0);
d.JointSetAMotorAngle(Amotor, 2, 0);
// These lowstops and high stops are effectively (no wiggle room)
if (_parent_scene.IsAvCapsuleTilted)
{
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
}
else
{
#region Documentation of capsule motor LowStop and HighStop parameters
// Intentionally introduce some tilt into the capsule by setting
// the motor stops to small epsilon values. This small tilt prevents
// the capsule from falling into the terrain; a straight-up capsule
// (with -0..0 motor stops) falls into the terrain for reasons yet
// to be comprehended in their entirety.
#endregion
AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero);
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop
}
// Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the
// capped cyllinder will fall over
d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
d.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor);
//d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
//d.QfromR(
//d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068,
//
//m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
//standupStraight();
}
//
/// <summary>
/// Uses the capped cyllinder volume formula to calculate the avatar's mass.
/// This may be used in calculations in the scene/scenepresence
@@ -774,7 +651,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character");
m_log.WarnFormat("[ODE CHARACTER]: Got a NaN velocity from Scene for {0}", Name);
}
// m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", m_taintTargetVelocity);
@@ -836,7 +713,6 @@ namespace OpenSim.Region.Physics.OdePlugin
m_taintForce += force;
_parent_scene.AddPhysicsActorTaint(this);
//doForce(force);
// If uncommented, things get pushed off world
//
// m_log.Debug("Push!");
@@ -852,7 +728,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_log.Warn("[PHYSICS]: Got a NaN force applied to a Character");
m_log.WarnFormat("[ODE CHARACTER]: Got a NaN force applied to {0}", Name);
}
//m_lastUpdateSent = false;
}
@@ -861,15 +737,6 @@ namespace OpenSim.Region.Physics.OdePlugin
{
}
/// <summary>
/// After all of the forces add up with 'add force' we apply them with doForce
/// </summary>
/// <param name="force"></param>
public void doForce(Vector3 force)
{
d.BodyAddForce(Body, force.X, force.Y, force.Z);
}
public override void SetMomentum(Vector3 momentum)
{
}
@@ -878,9 +745,8 @@ namespace OpenSim.Region.Physics.OdePlugin
/// Called from Simulate
/// This is the avatar's movement control + PID Controller
/// </summary>
/// <param name="defects">
/// If there is something wrong with the character (e.g. its position is non-finite)
/// then it is added to this list. The ODE structures associated with it are also destroyed.
/// <param name="defects">The character will be added to this list if there is something wrong (non-finite
/// position or velocity).
/// </param>
internal void Move(List<OdeCharacter> defects)
{
@@ -903,12 +769,11 @@ namespace OpenSim.Region.Physics.OdePlugin
if (!localPos.IsFinite())
{
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
m_log.WarnFormat(
"[ODE CHARACTER]: Avatar position of {0} for {1} is non-finite! Removing from physics scene.",
localPos, Name);
defects.Add(this);
// _parent_scene.RemoveCharacter(this);
DestroyOdeStructures();
return;
}
@@ -1035,26 +900,31 @@ namespace OpenSim.Region.Physics.OdePlugin
if (vec.IsFinite())
{
doForce(vec);
// Apply the total force acting on this avatar
d.BodyAddForce(Body, vec.X, vec.Y, vec.Z);
if (!_zeroFlag)
AlignAvatarTiltWithCurrentDirectionOfMovement(vec);
}
else
{
m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()");
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
defects.Add(this);
// _parent_scene.RemoveCharacter(this);
m_log.WarnFormat(
"[ODE CHARACTER]: Got a NaN force vector {0} in Move() for {1}. Removing character from physics scene.",
vec, Name);
DestroyOdeStructures();
defects.Add(this);
return;
}
}
/// <summary>
/// Updates the reported position and velocity. This essentially sends the data up to ScenePresence.
/// </summary>
internal void UpdatePositionAndVelocity()
/// <param name="defects">The character will be added to this list if there is something wrong (non-finite
/// position or velocity).
/// </param>
internal void UpdatePositionAndVelocity(List<OdeCharacter> defects)
{
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
d.Vector3 newPos;
@@ -1065,10 +935,12 @@ namespace OpenSim.Region.Physics.OdePlugin
catch (NullReferenceException)
{
bad = true;
_parent_scene.BadCharacter(this);
defects.Add(this);
newPos = new d.Vector3(_position.X, _position.Y, _position.Z);
base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar {0}, physical actor {1}", m_name, m_uuid);
m_log.WarnFormat("[ODE CHARACTER]: Avatar Null reference for Avatar {0}, physical actor {1}", Name, m_uuid);
return;
}
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
@@ -1136,6 +1008,123 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
/// <summary>
/// This creates the Avatar's physical Surrogate in ODE at the position supplied
/// </summary>
/// <remarks>
/// WARNING: This MUST NOT be called outside of ProcessTaints, else we can have unsynchronized access
/// to ODE internals. ProcessTaints is called from within thread-locked Simulate(), so it is the only
/// place that is safe to call this routine AvatarGeomAndBodyCreation.
/// </remarks>
/// <param name="npositionX"></param>
/// <param name="npositionY"></param>
/// <param name="npositionZ"></param>
/// <param name="tensor"></param>
private void CreateOdeStructures(float npositionX, float npositionY, float npositionZ, float tensor)
{
int dAMotorEuler = 1;
// _parent_scene.waitForSpaceUnlock(_parent_scene.space);
if (CAPSULE_LENGTH <= 0)
{
m_log.Warn("[ODE CHARACTER]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
CAPSULE_LENGTH = 0.01f;
}
if (CAPSULE_RADIUS <= 0)
{
m_log.Warn("[ODE CHARACTER]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
CAPSULE_RADIUS = 0.01f;
}
Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
d.GeomSetCollideBits(Shell, (int)m_collisionFlags);
d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
Body = d.BodyCreate(_parent_scene.world);
d.BodySetPosition(Body, npositionX, npositionY, npositionZ);
_position.X = npositionX;
_position.Y = npositionY;
_position.Z = npositionZ;
m_taintPosition = _position;
d.BodySetMass(Body, ref ShellMass);
d.Matrix3 m_caprot;
// 90 Stand up on the cap of the capped cyllinder
if (_parent_scene.IsAvCapsuleTilted)
{
d.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2));
}
else
{
d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2));
}
d.GeomSetRotation(Shell, ref m_caprot);
d.BodySetRotation(Body, ref m_caprot);
d.GeomSetBody(Shell, Body);
// The purpose of the AMotor here is to keep the avatar's physical
// surrogate from rotating while moving
Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
d.JointAttach(Amotor, Body, IntPtr.Zero);
d.JointSetAMotorMode(Amotor, dAMotorEuler);
d.JointSetAMotorNumAxes(Amotor, 3);
d.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0);
d.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0);
d.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1);
d.JointSetAMotorAngle(Amotor, 0, 0);
d.JointSetAMotorAngle(Amotor, 1, 0);
d.JointSetAMotorAngle(Amotor, 2, 0);
// These lowstops and high stops are effectively (no wiggle room)
if (_parent_scene.IsAvCapsuleTilted)
{
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
}
else
{
#region Documentation of capsule motor LowStop and HighStop parameters
// Intentionally introduce some tilt into the capsule by setting
// the motor stops to small epsilon values. This small tilt prevents
// the capsule from falling into the terrain; a straight-up capsule
// (with -0..0 motor stops) falls into the terrain for reasons yet
// to be comprehended in their entirety.
#endregion
AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero);
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop
}
// Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the
// capped cyllinder will fall over
d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
d.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor);
//d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
//d.QfromR(
//d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068,
//
//m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
//standupStraight();
_parent_scene.geom_name_map[Shell] = Name;
_parent_scene.actor_name_map[Shell] = this;
}
/// <summary>
/// Cleanup the things we use in the scene.
/// </summary>
@@ -1148,7 +1137,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <summary>
/// Used internally to destroy the ODE structures associated with this character.
/// </summary>
private void DestroyOdeStructures()
internal void DestroyOdeStructures()
{
// destroy avatar capsule and related ODE data
if (Amotor != IntPtr.Zero)
@@ -1159,13 +1148,12 @@ namespace OpenSim.Region.Physics.OdePlugin
}
//kill the Geometry
_parent_scene.waitForSpaceUnlock(_parent_scene.space);
// _parent_scene.waitForSpaceUnlock(_parent_scene.space);
if (Body != IntPtr.Zero)
{
//kill the body
d.BodyDestroy(Body);
Body = IntPtr.Zero;
}
@@ -1173,6 +1161,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{
d.GeomDestroy(Shell);
_parent_scene.geom_name_map.Remove(Shell);
_parent_scene.actor_name_map.Remove(Shell);
Shell = IntPtr.Zero;
}
}
@@ -1261,7 +1251,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// FIXME: This is not a good solution since it's subject to a race condition if a force is another
// thread sets a new force while we're in this loop (since it could be obliterated by
// m_taintForce = Vector3.Zero. Need to lock ProcessTaints() when we set a new tainted force.
doForce(m_taintForce);
d.BodyAddForce(Body, m_taintForce.X, m_taintForce.Y, m_taintForce.Z);
}
m_taintForce = Vector3.Zero;
@@ -1277,15 +1267,13 @@ namespace OpenSim.Region.Physics.OdePlugin
// Create avatar capsule and related ODE data
if (!(Shell == IntPtr.Zero && Body == IntPtr.Zero && Amotor == IntPtr.Zero))
{
m_log.Warn("[PHYSICS]: re-creating the following avatar ODE data, even though it already exists - "
m_log.Warn("[ODE CHARACTER]: re-creating the following avatar ODE data for " + Name + ", even though it already exists - "
+ (Shell!=IntPtr.Zero ? "Shell ":"")
+ (Body!=IntPtr.Zero ? "Body ":"")
+ (Amotor!=IntPtr.Zero ? "Amotor ":""));
}
AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor);
_parent_scene.geom_name_map[Shell] = m_name;
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
CreateOdeStructures(_position.X, _position.Y, _position.Z, m_tensor);
_parent_scene.AddCharacter(this);
}
else
@@ -1301,17 +1289,19 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (Shell != IntPtr.Zero && Body != IntPtr.Zero && Amotor != IntPtr.Zero)
{
// m_log.DebugFormat("[PHYSICS]: Changing capsule size");
// m_log.DebugFormat(
// "[ODE CHARACTER]: Changing capsule size from {0} to {1} for {2}",
// CAPSULE_LENGTH, m_tainted_CAPSULE_LENGTH, Name);
m_pidControllerActive = true;
// no lock needed on _parent_scene.OdeLock because we are called from within the thread lock in OdePlugin's simulate()
d.JointDestroy(Amotor);
DestroyOdeStructures();
float prevCapsule = CAPSULE_LENGTH;
CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH;
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
d.BodyDestroy(Body);
d.GeomDestroy(Shell);
AvatarGeomAndBodyCreation(
CreateOdeStructures(
_position.X,
_position.Y,
_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
@@ -1319,13 +1309,10 @@ namespace OpenSim.Region.Physics.OdePlugin
// As with Size, we reset velocity. However, this isn't strictly necessary since it doesn't
// appear to stall initial region crossings when done here. Being done for consistency.
// Velocity = Vector3.Zero;
_parent_scene.geom_name_map[Shell] = m_name;
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
}
else
{
m_log.Warn("[PHYSICS]: trying to change capsule size, but the following ODE data is missing - "
m_log.Warn("[ODE CHARACTER]: trying to change capsule size for " + Name + ", but the following ODE data is missing - "
+ (Shell==IntPtr.Zero ? "Shell ":"")
+ (Body==IntPtr.Zero ? "Body ":"")
+ (Amotor==IntPtr.Zero ? "Amotor ":""));

View File

@@ -184,7 +184,6 @@ namespace OpenSim.Region.Physics.OdePlugin
private bool m_lastUpdateSent;
public IntPtr Body = IntPtr.Zero;
public String Name { get; private set; }
private Vector3 _target_velocity;
private d.Mass pMass;
@@ -273,7 +272,6 @@ namespace OpenSim.Region.Physics.OdePlugin
m_taintadd = true;
_parent_scene.AddPhysicsActorTaint(this);
// don't do .add() here; old geoms get recycled with the same hash
}
public override int PhysicsActorType
@@ -857,7 +855,7 @@ namespace OpenSim.Region.Physics.OdePlugin
m_MeshToTriMeshMap[mesh] = _triMeshData;
}
_parent_scene.waitForSpaceUnlock(m_targetSpace);
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
if (prim_geom == IntPtr.Zero)
@@ -1380,7 +1378,7 @@ Console.WriteLine("CreateGeom:");
{
if (((_size.X / 2f) > 0f))
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
//Console.WriteLine(" CreateGeom 1");
@@ -1394,7 +1392,7 @@ Console.WriteLine("CreateGeom:");
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
//Console.WriteLine(" CreateGeom 2");
@@ -1409,7 +1407,7 @@ Console.WriteLine("CreateGeom:");
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
//Console.WriteLine(" CreateGeom 3");
@@ -1424,7 +1422,7 @@ Console.WriteLine("CreateGeom:");
}
else
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
try
{
//Console.WriteLine(" CreateGeom 4");
@@ -1577,17 +1575,17 @@ Console.WriteLine(" JointCreateFixed");
{
// string primScenAvatarIn = _parent_scene.whichspaceamIin(_position);
// int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
_parent_scene.waitForSpaceUnlock(m_targetSpace);
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
IntPtr tempspace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace);
m_targetSpace = tempspace;
_parent_scene.waitForSpaceUnlock(m_targetSpace);
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
if (prim_geom != IntPtr.Zero)
{
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
_parent_scene.waitForSpaceUnlock(m_targetSpace);
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
d.SpaceAdd(m_targetSpace, prim_geom);
}
}
@@ -1978,7 +1976,7 @@ Console.WriteLine(" JointCreateFixed");
if (d.SpaceQuery(m_targetSpace, prim_geom))
{
_parent_scene.waitForSpaceUnlock(m_targetSpace);
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
d.SpaceRemove(m_targetSpace, prim_geom);
}

File diff suppressed because it is too large Load Diff

View File

@@ -759,33 +759,33 @@ namespace OpenSim.Region.RegionCombinerModule
{
}
/// <summary>
/// TODO:
/// </summary>
/// <param name="rdata"></param>
public void UnCombineRegion(RegionData rdata)
{
lock (m_regions)
{
if (m_regions.ContainsKey(rdata.RegionId))
{
// uncombine root region and virtual regions
}
else
{
foreach (RegionConnections r in m_regions.Values)
{
foreach (RegionData rd in r.ConnectedRegions)
{
if (rd.RegionId == rdata.RegionId)
{
// uncombine virtual region
}
}
}
}
}
}
// /// <summary>
// /// TODO:
// /// </summary>
// /// <param name="rdata"></param>
// public void UnCombineRegion(RegionData rdata)
// {
// lock (m_regions)
// {
// if (m_regions.ContainsKey(rdata.RegionId))
// {
// // uncombine root region and virtual regions
// }
// else
// {
// foreach (RegionConnections r in m_regions.Values)
// {
// foreach (RegionData rd in r.ConnectedRegions)
// {
// if (rd.RegionId == rdata.RegionId)
// {
// // uncombine virtual region
// }
// }
// }
// }
// }
// }
// Create a set of infinite borders around the whole aabb of the combined island.
private void AdjustLargeRegionBounds()

View File

@@ -8695,6 +8695,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W));
break;
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
res.Add(new LSL_Vector(GetPartLocalPos(part)));
break;
}
}
return res;

View File

@@ -140,7 +140,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
List<SenseRepeatClass> NewSensors = new List<SenseRepeatClass>();
foreach (SenseRepeatClass ts in SenseRepeaters)
{
if (ts.localID != m_localID && ts.itemID != m_itemID)
if (ts.localID != m_localID || ts.itemID != m_itemID)
{
NewSensors.Add(ts);
}

View File

@@ -323,6 +323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_DESC = 28;
public const int PRIM_ROT_LOCAL = 29;
public const int PRIM_OMEGA = 32;
public const int PRIM_POS_LOCAL = 33;
public const int PRIM_LINK_TARGET = 34;
public const int PRIM_TEXGEN_DEFAULT = 0;
public const int PRIM_TEXGEN_PLANAR = 1;

View File

@@ -91,6 +91,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private bool m_KillTimedOutScripts;
private string m_ScriptEnginesPath = null;
/// <summary>
/// Is the entire simulator in the process of shutting down?
/// </summary>
private bool m_SimulatorShuttingDown;
private static List<XEngine> m_ScriptEngines =
new List<XEngine>();
@@ -537,12 +542,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// Must be done explicitly because they have infinite
// lifetime
//
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
if (m_DomainScripts[instance.AppDomain].Count == 0)
if (!m_SimulatorShuttingDown)
{
m_DomainScripts.Remove(instance.AppDomain);
UnloadAppDomain(instance.AppDomain);
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
if (m_DomainScripts[instance.AppDomain].Count == 0)
{
m_DomainScripts.Remove(instance.AppDomain);
UnloadAppDomain(instance.AppDomain);
}
}
m_Scripts.Clear();
m_PrimObjects.Clear();
m_Assemblies.Clear();
m_DomainScripts.Clear();
}
lockScriptsForRead(false);
lockScriptsForWrite(true);
@@ -1512,6 +1525,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public void OnShutdown()
{
m_SimulatorShuttingDown = true;
List<IScriptInstance> instances = new List<IScriptInstance>();
lockScriptsForRead(true);
@@ -1907,4 +1922,4 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return true;
}
}
}
}

View File

@@ -99,7 +99,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
}
return FailureResult();
}
#region Method-specific handlers
@@ -127,7 +126,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
return FailureResult();
}
string perms = "0";
FriendInfo[] friendsInfo = m_FriendsService.GetFriends(principalID);
foreach (FriendInfo finfo in friendsInfo)
{

View File

@@ -79,7 +79,7 @@ namespace OpenSim.Server.Handlers.MapImage
public override byte[] Handle(string path, Stream requestData, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
@@ -97,9 +97,14 @@ namespace OpenSim.Server.Handlers.MapImage
int x = 0, y = 0;
Int32.TryParse(request["X"].ToString(), out x);
Int32.TryParse(request["Y"].ToString(), out y);
string type = "image/jpeg";
if (request.ContainsKey("TYPE"))
type = request["TYPE"].ToString();
m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y);
// string type = "image/jpeg";
//
// if (request.ContainsKey("TYPE"))
// type = request["TYPE"].ToString();
byte[] data = Convert.FromBase64String(request["DATA"].ToString());
string reason = string.Empty;
@@ -117,7 +122,6 @@ namespace OpenSim.Server.Handlers.MapImage
}
return FailureResult("Unexpected server error");
}
private byte[] SuccessResult()

View File

@@ -42,7 +42,8 @@ namespace OpenSim.Server.Handlers.MapImage
{
public class MapGetServiceConnector : ServiceConnector
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IMapImageService m_MapService;
private string m_ConfigName = "MapImageService";
@@ -69,7 +70,8 @@ namespace OpenSim.Server.Handlers.MapImage
class MapServerGetHandler : BaseStreamHandler
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IMapImageService m_MapService;
public MapServerGetHandler(IMapImageService service) :

View File

@@ -243,14 +243,13 @@ namespace OpenSim.Server.Handlers.Simulation
responsedata["int_response_code"] = HttpStatusCode.OK;
responsedata["str_response_string"] = "OpenSim agent " + id.ToString();
m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted.");
m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID);
}
protected virtual void ReleaseAgent(UUID regionID, UUID id)
{
m_SimulationService.ReleaseAgent(regionID, id, "");
}
}
public class AgentPostHandler : BaseStreamHandler
@@ -275,7 +274,7 @@ namespace OpenSim.Server.Handlers.Simulation
public override byte[] Handle(string path, Stream request,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
m_log.DebugFormat("[SIMULATION]: Stream handler called");
// m_log.DebugFormat("[SIMULATION]: Stream handler called");
Hashtable keysvals = new Hashtable();
Hashtable headervals = new Hashtable();
@@ -462,7 +461,7 @@ namespace OpenSim.Server.Handlers.Simulation
public override byte[] Handle(string path, Stream request,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
m_log.DebugFormat("[SIMULATION]: Stream handler called");
// m_log.DebugFormat("[SIMULATION]: Stream handler called");
Hashtable keysvals = new Hashtable();
Hashtable headervals = new Hashtable();

View File

@@ -129,7 +129,9 @@ namespace OpenSim.Services.Connectors
}
else
m_log.DebugFormat("[MAP IMAGE CONNECTOR]: RegisterRegion received null reply");
{
m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply");
}
}
catch (Exception e)
{

View File

@@ -87,12 +87,26 @@ namespace OpenSim.Services.Connectors
public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
{
string uri = region.ServerURI + "region/" + thisRegion.RegionID + "/";
//m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
// m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
WebRequest HelloNeighbourRequest = WebRequest.Create(uri);
HelloNeighbourRequest.Method = "POST";
HelloNeighbourRequest.ContentType = "application/json";
HelloNeighbourRequest.Timeout = 10000;
WebRequest helloNeighbourRequest;
try
{
helloNeighbourRequest = WebRequest.Create(uri);
}
catch (Exception e)
{
m_log.WarnFormat(
"[NEIGHBOUR SERVICE CONNCTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception {3}{4}",
uri, thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
return false;
}
helloNeighbourRequest.Method = "POST";
helloNeighbourRequest.ContentType = "application/json";
helloNeighbourRequest.Timeout = 10000;
// Fill it in
OSDMap args = null;
@@ -102,38 +116,48 @@ namespace OpenSim.Services.Connectors
}
catch (Exception e)
{
m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message);
m_log.WarnFormat(
"[NEIGHBOUR SERVICE CONNCTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception {2}{3}",
thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
return false;
}
// Add the regionhandle of the destination region
args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString());
string strBuffer = "";
byte[] buffer = new byte[1];
try
{
strBuffer = OSDParser.SerializeJsonString(args);
UTF8Encoding str = new UTF8Encoding();
buffer = str.GetBytes(strBuffer);
}
catch (Exception e)
{
m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message);
m_log.WarnFormat(
"[NEIGHBOUR SERVICE CONNCTOR]: Exception thrown on serialization of HelloNeighbour from {0} to {1}. Exception {2}{3}",
thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
return false;
}
Stream os = null;
try
{ // send the Post
HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send
os = HelloNeighbourRequest.GetRequestStream();
helloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send
os = helloNeighbourRequest.GetRequestStream();
os.Write(buffer, 0, strBuffer.Length); //Send it
//m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri);
}
catch (Exception ex)
catch (Exception e)
{
m_log.InfoFormat("[REST COMMS]: Unable to send HelloNeighbour to {0}: {1}", region.RegionName, ex.Message);
m_log.WarnFormat(
"[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}",
thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
return false;
}
finally
@@ -148,10 +172,12 @@ namespace OpenSim.Services.Connectors
StreamReader sr = null;
try
{
WebResponse webResponse = HelloNeighbourRequest.GetResponse();
WebResponse webResponse = helloNeighbourRequest.GetResponse();
if (webResponse == null)
{
m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post");
m_log.DebugFormat(
"[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}",
thisRegion.RegionName, region.RegionName);
}
sr = new StreamReader(webResponse.GetResponseStream());
@@ -160,9 +186,12 @@ namespace OpenSim.Services.Connectors
//m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply);
}
catch (Exception ex)
catch (Exception e)
{
m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message);
m_log.WarnFormat(
"[NEIGHBOUR SERVICE CONNCTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception {2}{3}",
region.RegionName, thisRegion.RegionName, e.Message, e.StackTrace);
return false;
}
finally
@@ -172,8 +201,6 @@ namespace OpenSim.Services.Connectors
}
return true;
}
}
}
}

View File

@@ -334,7 +334,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
// Make the remote storage request
try
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl);
// Simian does not require the asset ID to be in the URL because it's in the post data.
// By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString());
HttpWebResponse response = MultipartForm.Post(request, postParameters);
using (Stream responseStream = response.GetResponseStream())

View File

@@ -371,7 +371,7 @@ namespace OpenSim.Services.Connectors.Simulation
private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
{
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start");
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start");
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";

View File

@@ -156,6 +156,7 @@ namespace OpenSim.Services.GridService
regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
return "Region overlaps another region";
}
if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
{
@@ -236,18 +237,21 @@ namespace OpenSim.Services.GridService
}
m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}",
regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY);
return String.Empty;
}
public bool DeregisterRegion(UUID regionID)
{
m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID);
RegionData region = m_Database.Get(regionID, UUID.Zero);
if (region == null)
return false;
m_log.DebugFormat(
"[GRID SERVICE]: Deregistering region {0} ({1}) at {2}-{3}",
region.RegionName, region.RegionID, region.coordX, region.coordY);
int flags = Convert.ToInt32(region.Data["flags"]);
if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0)
@@ -292,7 +296,7 @@ namespace OpenSim.Services.GridService
}
}
m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count);
// m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count);
}
else
{

View File

@@ -103,9 +103,8 @@ namespace OpenSim.Services.Interfaces
int GetRegionFlags(UUID scopeID, UUID regionID);
}
public class GridRegion : Object
public class GridRegion
{
/// <summary>
/// The port by which http communication occurs with the region
/// </summary>
@@ -149,6 +148,19 @@ namespace OpenSim.Services.Interfaces
protected IPEndPoint m_internalEndPoint;
/// <summary>
/// The co-ordinate of this region.
/// </summary>
public int RegionCoordX { get { return RegionLocX / (int)Constants.RegionSize; } }
/// <summary>
/// The co-ordinate of this region
/// </summary>
public int RegionCoordY { get { return RegionLocY / (int)Constants.RegionSize; } }
/// <summary>
/// The location of this region in meters.
/// </summary>
public int RegionLocX
{
get { return m_regionLocX; }
@@ -156,6 +168,9 @@ namespace OpenSim.Services.Interfaces
}
protected int m_regionLocX;
/// <summary>
/// The location of this region in meters.
/// </summary>
public int RegionLocY
{
get { return m_regionLocY; }
@@ -417,8 +432,6 @@ namespace OpenSim.Services.Interfaces
if (kvp.ContainsKey("Token"))
Token = kvp["Token"].ToString();
}
}
}

View File

@@ -81,7 +81,7 @@ namespace OpenSim.Services.LLLoginService
protected string m_DeniedClients;
IConfig m_LoginServerConfig;
IConfig m_ClientsConfig;
// IConfig m_ClientsConfig;
public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
{

View File

@@ -138,6 +138,8 @@ namespace OpenSim.Services.MapImageService
public byte[] GetMapTile(string fileName, out string format)
{
// m_log.DebugFormat("[MAP IMAGE SERVICE]: Getting map tile {0}", fileName);
format = ".jpg";
string fullName = Path.Combine(m_TilesStoragePath, fileName);
if (File.Exists(fullName))
@@ -206,7 +208,7 @@ namespace OpenSim.Services.MapImageService
private bool CreateTile(uint zoomLevel, int x, int y)
{
m_log.DebugFormat("[MAP IMAGE SERVICE]: Create tile for {0} {1}, zoom {2}", x, y, zoomLevel);
// m_log.DebugFormat("[MAP IMAGE SERVICE]: Create tile for {0} {1}, zoom {2}", x, y, zoomLevel);
int prevWidth = (int)Math.Pow(2, (double)zoomLevel - 2);
int thisWidth = (int)Math.Pow(2, (double)zoomLevel - 1);

View File

@@ -109,11 +109,13 @@ namespace OpenSim.Tests
// Prepare call to ConfigurationLoader.LoadConfigSettings()
ConfigurationLoader cl = new ConfigurationLoader();
IConfigSource argvSource = new IniConfigSource();
EnvConfigSource envConfigSource = new EnvConfigSource();
argvSource.AddConfig("Startup").Set("inifile", mainIniFile);
ConfigSettings configSettings;
NetworkServersInfo networkInfo;
OpenSimConfigSource source = cl.LoadConfigSettings(argvSource, out configSettings, out networkInfo);
OpenSimConfigSource source = cl.LoadConfigSettings(argvSource, envConfigSource,
out configSettings, out networkInfo);
// Remove default config
config = source.Source.Configs["Startup"];

View File

@@ -0,0 +1,49 @@
/*
* 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 OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Linq;
using pCampBot.Interfaces;
namespace pCampBot
{
public class AbstractBehaviour : IBehaviour
{
public string Name { get; protected set; }
public Bot Bot { get; protected set; }
public virtual void Action() {}
public virtual void Initialize(Bot bot)
{
Bot = bot;
}
}
}

View File

@@ -0,0 +1,169 @@
/*
* 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.Threading;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using pCampBot.Interfaces;
namespace pCampBot
{
/// <summary>
/// Get the bot to make a region crossing.
/// </summary>
public class CrossBehaviour : AbstractBehaviour
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public AutoResetEvent m_regionCrossedMutex = new AutoResetEvent(false);
public const int m_regionCrossingTimeout = 1000 * 60;
public CrossBehaviour() { Name = "Cross"; }
public override void Action()
{
GridClient client = Bot.Client;
// // Fly to make the border cross easier.
// client.Self.Movement.Fly = true;
// client.Self.Movement.Fly = false;
// Seek out neighbouring region
Simulator currentSim = client.Network.CurrentSim;
ulong currentHandle = currentSim.Handle;
uint currentX, currentY;
Utils.LongToUInts(currentHandle, out currentX, out currentY);
List<GridRegion> candidateRegions = new List<GridRegion>();
TryAddRegion(Utils.UIntsToLong(Math.Max(0, currentX - Constants.RegionSize), currentY), candidateRegions); // West
TryAddRegion(Utils.UIntsToLong(currentX + Constants.RegionSize, currentY), candidateRegions); // East
TryAddRegion(Utils.UIntsToLong(currentX, Math.Max(0, currentY - Constants.RegionSize)), candidateRegions); // South
TryAddRegion(Utils.UIntsToLong(currentX, currentY + Constants.RegionSize), candidateRegions); // North
if (candidateRegions.Count != 0)
{
GridRegion destRegion = candidateRegions[Bot.Manager.Rng.Next(candidateRegions.Count)];
uint targetX, targetY;
Utils.LongToUInts(destRegion.RegionHandle, out targetX, out targetY);
Vector3 pos = client.Self.SimPosition;
if (targetX < currentX)
pos.X = -1;
else if (targetX > currentX)
pos.X = Constants.RegionSize + 1;
if (targetY < currentY)
pos.Y = -1;
else if (targetY > currentY)
pos.Y = Constants.RegionSize + 1;
m_log.DebugFormat(
"[CROSS BEHAVIOUR]: {0} moving to cross from {1} into {2}, target {3}",
Bot.Name, currentSim.Name, destRegion.Name, pos);
// Face in the direction of the candidate region
client.Self.Movement.TurnToward(pos);
// Listen for event so that we know when we've crossed the region boundary
Bot.Client.Self.RegionCrossed += Self_RegionCrossed;
// Start moving
Bot.Client.Self.Movement.AtPos = true;
// Stop when reach region target or border cross detected
if (!m_regionCrossedMutex.WaitOne(m_regionCrossingTimeout))
{
m_log.ErrorFormat(
"[CROSS BEHAVIOUR]: {0} failed to cross from {1} into {2} with {3}ms",
Bot.Name, currentSim.Name, destRegion.Name, m_regionCrossingTimeout);
}
else
{
m_log.DebugFormat(
"[CROSS BEHAVIOUR]: {0} crossed from {1} into {2}",
Bot.Name, currentSim.Name, destRegion.Name);
}
Bot.Client.Self.RegionCrossed -= Self_RegionCrossed;
// We will hackishly carry on travelling into the region for a little bit.
Thread.Sleep(6000);
m_log.DebugFormat(
"[CROSS BEHAVIOUR]: {0} stopped moving after cross from {1} into {2}",
Bot.Name, currentSim.Name, destRegion.Name);
Bot.Client.Self.Movement.AtPos = false;
}
else
{
m_log.DebugFormat(
"[CROSS BEHAVIOUR]: No candidate region for {0} to cross into from {1}. Ignoring.",
Bot.Name, currentSim.Name);
}
}
private bool TryAddRegion(ulong handle, List<GridRegion> regions)
{
Dictionary<ulong, GridRegion> knownRegions = Bot.Manager.RegionsKnown;
lock (knownRegions)
{
if (knownRegions.Count == 0)
return false;
m_log.DebugFormat("[CROSS BEHAVIOUR]: Looking for region with handle {0} in known regions", handle);
if (knownRegions.ContainsKey(handle))
{
GridRegion region = knownRegions[handle];
m_log.DebugFormat(
"[CROSS BEHAVIOUR]: Adding region {0} to crossing candidates for {1}", region.Name, Bot.Name);
regions.Add(region);
return true;
}
else
{
return false;
}
}
}
internal void Self_RegionCrossed(object o, RegionCrossedEventArgs args)
{
m_regionCrossedMutex.Set();
}
}
}

View File

@@ -39,18 +39,20 @@ namespace pCampBot
/// <remarks>
/// The viewer itself does not give the option of grabbing objects that haven't been signalled as grabbable.
/// </remarks>
public class GrabbingBehaviour : IBehaviour
public class GrabbingBehaviour : AbstractBehaviour
{
public void Action(Bot bot)
{
Dictionary<UUID, Primitive> objects = bot.Objects;
public GrabbingBehaviour() { Name = "Grabbing"; }
Primitive prim = objects.ElementAt(bot.Random.Next(0, objects.Count)).Value;
public override void Action()
{
Dictionary<UUID, Primitive> objects = Bot.Objects;
Primitive prim = objects.ElementAt(Bot.Random.Next(0, objects.Count)).Value;
// This appears to be a typical message sent when a viewer user clicks a clickable object
bot.Client.Self.Grab(prim.LocalID);
bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero);
bot.Client.Self.DeGrab(prim.LocalID);
Bot.Client.Self.Grab(prim.LocalID);
Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero);
Bot.Client.Self.DeGrab(prim.LocalID);
}
}
}

View File

@@ -40,41 +40,41 @@ namespace pCampBot
/// <remarks>
/// TODO: talkarray should be in a separate behaviour.
/// </remarks>
public class PhysicsBehaviour : IBehaviour
public class PhysicsBehaviour : AbstractBehaviour
{
private string[] talkarray;
public PhysicsBehaviour()
{
Name = "Physics";
talkarray = readexcuses();
}
public void Action(Bot bot)
public override void Action()
{
int walkorrun = bot.Random.Next(4); // Randomize between walking and running. The greater this number,
int walkorrun = Bot.Random.Next(4); // Randomize between walking and running. The greater this number,
// the greater the bot's chances to walk instead of run.
bot.Client.Self.Jump(false);
Bot.Client.Self.Jump(false);
if (walkorrun == 0)
{
bot.Client.Self.Movement.AlwaysRun = true;
Bot.Client.Self.Movement.AlwaysRun = true;
}
else
{
bot.Client.Self.Movement.AlwaysRun = false;
Bot.Client.Self.Movement.AlwaysRun = false;
}
// TODO: unused: Vector3 pos = client.Self.SimPosition;
Vector3 newpos = new Vector3(bot.Random.Next(1, 254), bot.Random.Next(1, 254), bot.Random.Next(1, 254));
bot.Client.Self.Movement.TurnToward(newpos);
Vector3 newpos = new Vector3(Bot.Random.Next(1, 254), Bot.Random.Next(1, 254), Bot.Random.Next(1, 254));
Bot.Client.Self.Movement.TurnToward(newpos);
bot.Client.Self.Movement.AtPos = true;
Thread.Sleep(bot.Random.Next(3000, 13000));
bot.Client.Self.Movement.AtPos = false;
bot.Client.Self.Jump(true);
string randomf = talkarray[bot.Random.Next(talkarray.Length)];
Bot.Client.Self.Movement.AtPos = true;
Thread.Sleep(Bot.Random.Next(3000, 13000));
Bot.Client.Self.Movement.AtPos = false;
Bot.Client.Self.Jump(true);
string randomf = talkarray[Bot.Random.Next(talkarray.Length)];
if (talkarray.Length > 1 && randomf.Length > 1)
bot.Client.Self.Chat(randomf, 0, ChatType.Normal);
Bot.Client.Self.Chat(randomf, 0, ChatType.Normal);
}
private string[] readexcuses()

View File

@@ -0,0 +1,75 @@
/*
* 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 System.Reflection;
using log4net;
using OpenMetaverse;
using pCampBot.Interfaces;
namespace pCampBot
{
/// <summary>
/// Teleport to a random region on the grid.
/// </summary>
public class TeleportBehaviour : AbstractBehaviour
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public TeleportBehaviour() { Name = "Teleport"; }
public override void Action()
{
Random rng = Bot.Manager.Rng;
GridRegion[] knownRegions;
lock (Bot.Manager.RegionsKnown)
{
if (Bot.Manager.RegionsKnown.Count == 0)
{
m_log.DebugFormat(
"[TELEPORT BEHAVIOUR]: Ignoring teleport action for {0} since no regions are known yet", Bot.Name);
return;
}
knownRegions = Bot.Manager.RegionsKnown.Values.ToArray();
}
Simulator sourceRegion = Bot.Client.Network.CurrentSim;
GridRegion destRegion = knownRegions[rng.Next(knownRegions.Length)];
Vector3 destPosition = new Vector3(rng.Next(255), rng.Next(255), 50);
m_log.DebugFormat(
"[TELEPORT BEHAVIOUR]: Teleporting {0} from {1} {2} to {3} {4}",
Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition);
Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition);
}
}
}

View File

@@ -49,8 +49,15 @@ namespace pCampBot
public delegate void AnEvent(Bot callbot, EventType someevent); // event delegate for bot events
public BotManager BotManager { get; private set; }
private IConfig startupConfig; // bot config, passed from BotManager
/// <summary>
/// Bot manager.
/// </summary>
public BotManager Manager { get; private set; }
/// <summary>
/// Bot config, passed from BotManager.
/// </summary>
private IConfig startupConfig;
/// <summary>
/// Behaviours implemented by this bot.
@@ -123,6 +130,8 @@ namespace pCampBot
BotManager bm, List<IBehaviour> behaviours,
string firstName, string lastName, string password, string loginUri)
{
behaviours.ForEach(b => b.Initialize(this));
Client = new GridClient();
Random = new Random(Environment.TickCount);// We do stuff randomly here
@@ -132,7 +141,7 @@ namespace pCampBot
Password = password;
LoginUri = loginUri;
BotManager = bm;
Manager = bm;
startupConfig = bm.Config;
readconfig();
@@ -149,7 +158,7 @@ namespace pCampBot
b =>
{
// m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
b.Action(this);
b.Action();
Thread.Sleep(Random.Next(1000, 10000));
}
@@ -218,7 +227,17 @@ namespace pCampBot
{
MakeDefaultAppearance(wear);
}
Client.Self.Jump(true);
// Extract nearby region information.
Client.Grid.GridRegion += Manager.Grid_GridRegion;
uint xUint, yUint;
Utils.LongToUInts(Client.Network.CurrentSim.Handle, out xUint, out yUint);
ushort minX, minY, maxX, maxY;
minX = (ushort)Math.Min(0, xUint - 5);
minY = (ushort)Math.Min(0, yUint - 5);
maxX = (ushort)(xUint + 5);
maxY = (ushort)(yUint + 5);
Client.Grid.RequestMapBlocks(GridLayerType.Terrain, minX, minY, maxX, maxY, false);
}
else
{
@@ -472,13 +491,13 @@ namespace pCampBot
private void GetTexture(UUID textureID)
{
lock (BotManager.AssetsReceived)
lock (Manager.AssetsReceived)
{
// Don't request assets more than once.
if (BotManager.AssetsReceived.ContainsKey(textureID))
if (Manager.AssetsReceived.ContainsKey(textureID))
return;
BotManager.AssetsReceived[textureID] = false;
Manager.AssetsReceived[textureID] = false;
Client.Assets.RequestImage(textureID, ImageType.Normal, Asset_TextureCallback_Texture);
}
}
@@ -490,8 +509,8 @@ namespace pCampBot
public void Asset_ReceivedCallback(AssetDownload transfer, Asset asset)
{
lock (BotManager.AssetsReceived)
BotManager.AssetsReceived[asset.AssetID] = true;
lock (Manager.AssetsReceived)
Manager.AssetsReceived[asset.AssetID] = true;
// if (wear == "save")
// {

View File

@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using OpenMetaverse;
@@ -48,9 +49,24 @@ namespace pCampBot
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Command console
/// </summary>
protected CommandConsole m_console;
/// <summary>
/// Created bots, whether active or inactive.
/// </summary>
protected List<Bot> m_lBot;
protected Random somthing = new Random(Environment.TickCount);
/// <summary>
/// Random number generator.
/// </summary>
public Random Rng { get; private set; }
/// <summary>
/// Overall configuration.
/// </summary>
public IConfig Config { get; private set; }
/// <summary>
@@ -58,12 +74,19 @@ namespace pCampBot
/// </summary>
public Dictionary<UUID, bool> AssetsReceived { get; private set; }
/// <summary>
/// The regions that we know about.
/// </summary>
public Dictionary<ulong, GridRegion> RegionsKnown { get; private set; }
/// <summary>
/// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
/// </summary>
public BotManager()
{
Rng = new Random(Environment.TickCount);
AssetsReceived = new Dictionary<UUID, bool>();
RegionsKnown = new Dictionary<ulong, GridRegion>();
m_console = CreateConsole();
MainConsole.Instance = m_console;
@@ -93,8 +116,13 @@ namespace pCampBot
"Shutdown bots and exit",
HandleShutdown);
m_console.Commands.AddCommand("bot", false, "show status",
"show status",
m_console.Commands.AddCommand("bot", false, "show regions",
"show regions",
"Show regions known to bots",
HandleShowRegions);
m_console.Commands.AddCommand("bot", false, "show bots",
"show bots",
"Shows the status of all bots",
HandleShowStatus);
@@ -128,13 +156,23 @@ namespace pCampBot
string lastName = string.Format("{0}_{1}", lastNameStem, i);
List<IBehaviour> behaviours = new List<IBehaviour>();
// Hard-coded for now
if (behaviourSwitches.Contains("p"))
behaviours.Add(new PhysicsBehaviour());
if (behaviourSwitches.Contains("g"))
behaviours.Add(new GrabbingBehaviour());
if (behaviourSwitches.Contains("t"))
behaviours.Add(new TeleportBehaviour());
if (behaviourSwitches.Contains("c"))
behaviours.Add(new CrossBehaviour());
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Bot {0} {1} configured for behaviours {2}",
firstName, lastName, string.Join(",", behaviours.ConvertAll<string>(b => b.Name).ToArray()));
StartBot(this, behaviours, firstName, lastName, password, loginUri);
}
@@ -240,17 +278,33 @@ namespace pCampBot
});
}
private void HandleShowRegions(string module, string[] cmd)
{
string outputFormat = "{0,-30} {1, -20} {2, -5} {3, -5}";
MainConsole.Instance.OutputFormat(outputFormat, "Name", "Handle", "X", "Y");
lock (RegionsKnown)
{
foreach (GridRegion region in RegionsKnown.Values)
{
MainConsole.Instance.OutputFormat(
outputFormat, region.Name, region.RegionHandle, region.X, region.Y);
}
}
}
private void HandleShowStatus(string module, string[] cmd)
{
string outputFormat = "{0,-30} {1,-14}";
MainConsole.Instance.OutputFormat(outputFormat, "Name", "Status");
string outputFormat = "{0,-30} {1, -30} {2,-14}";
MainConsole.Instance.OutputFormat(outputFormat, "Name", "Region", "Status");
lock (m_lBot)
{
foreach (Bot pb in m_lBot)
{
MainConsole.Instance.OutputFormat(
outputFormat, pb.Name, (pb.IsConnected ? "Connected" : "Disconnected"));
outputFormat,
pb.Name, pb.Client.Network.CurrentSim.Name, pb.IsConnected ? "Connected" : "Disconnected");
}
}
}
@@ -274,5 +328,24 @@ namespace pCampBot
// if (newbots > 0)
// addbots(newbots);
// }
internal void Grid_GridRegion(object o, GridRegionEventArgs args)
{
lock (RegionsKnown)
{
GridRegion newRegion = args.Region;
if (RegionsKnown.ContainsKey(newRegion.RegionHandle))
{
return;
}
else
{
m_log.DebugFormat(
"[BOT MANAGER]: Adding {0} {1} to known regions", newRegion.Name, newRegion.RegionHandle);
RegionsKnown[newRegion.RegionHandle] = newRegion;
}
}
}
}
}

View File

@@ -31,6 +31,24 @@ namespace pCampBot.Interfaces
{
public interface IBehaviour
{
void Action(Bot bot);
/// <summary>
/// Name of this behaviour.
/// </summary>
string Name { get; }
/// <summary>
/// Initialize the behaviour for this bot.
/// </summary>
/// <remarks>
/// This must be invoked before Action() is called.
/// </remarks>
/// <param name="bot"></param>
void Initialize(Bot bot);
/// <summary>
/// Action to take when this behaviour is invoked.
/// </summary>
/// <param name="bot"></param>
void Action();
}
}

View File

@@ -104,17 +104,21 @@ namespace pCampBot
// name, to load an specific folder, or save, to save an avatar with some already existing wearables
// worn to the folder MyAppearance/FirstName_LastName, and the load it.
Console.WriteLine(
"usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" +
"Spawns a set of bots to test an OpenSim region\n\n" +
" -l, -loginuri loginuri for sim to log into (required)\n" +
" -n, -botcount number of bots to start (default: 1)\n" +
" -firstname first name for the bots\n" +
" -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" +
" -password password for the bots\n" +
" -b, behaviours behaviours for bots. Current options p (physics), g (grab). Comma separated, e.g. p,g. Default is p",
" -wear set appearance folder to load from (default: no)\n" +
" -h, -help show this message"
);
"usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" +
"Spawns a set of bots to test an OpenSim region\n\n" +
" -l, -loginuri loginuri for sim to log into (required)\n" +
" -n, -botcount number of bots to start (default: 1)\n" +
" -firstname first name for the bots\n" +
" -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" +
" -password password for the bots\n" +
" -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n",
" current options are:" +
" p (physics)" +
" g (grab)" +
" t (teleport)" +
// " c (cross)" +
" -wear set appearance folder to load from (default: no)\n" +
" -h, -help show this message");
}
}
}

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -231,13 +231,6 @@
;; server to send mail through.
; emailmodule = DefaultEmailModule
;# {DeleteScriptsOnStartup} {} {Delete previously compiled script DLLs on startup?} (true false) true
;; Controls whether previously compiled scripts DLLs are deleted on sim restart. If you set this to false
;; then startup will be considerably faster since scripts won't need to be recompiled. However, then it becomes your responsibility to delete the
;; compiled scripts if you're recompiling OpenSim from source code and internal interfaces used
;; by scripts have changed.
; DeleteScriptsOnStartup = true
[SMTP]
;; The SMTP server enabled the email module to send email to external
;; destinations.
@@ -532,19 +525,17 @@
[Economy]
;; The economy module is not enabled by default and there is no easy,
;; menu controlled way to do this. To enabled this module, insert
;; economymodule = BetaGridLikeMoneyModule
;; into the startup section (at the top of this file).
;; Then configure the options below as needed.
; The default economy module only implements just enough to allow free actions (transfer of objects, etc).
; There is no intention to implement anything further in core OpenSimulator.
; This functionality has to be provided by third party modules.
;; Enables selling things for $0
; SellEnabled = "false"
;; Enables selling things for $0. Default is true.
; SellEnabled = true
;; Money Unit fee to upload textures, animations etc
;; Money Unit fee to upload textures, animations etc. Default is 0.
; PriceUpload = 0
;; Money Unit fee to create groups
;; Money Unit fee to create groups. Default is 0.
; PriceGroupCreate = 0
@@ -573,6 +564,13 @@
;; Stack size per thread created
; ThreadStackSize = 262144
;# {DeleteScriptsOnStartup} {} {Delete previously compiled script DLLs on startup?} (true false) true
;; Controls whether previously compiled scripts DLLs are deleted on sim restart. If you set this to false
;; then startup will be considerably faster since scripts won't need to be recompiled. However, then it becomes your responsibility to delete the
;; compiled scripts if you're recompiling OpenSim from source code and internal interfaces used
;; by scripts have changed.
; DeleteScriptsOnStartup = true
;; Set this to true (the default) to load each script into a separate
;; AppDomain. Setting this to false will load all script assemblies into the
;; current AppDomain, which will reduce the per-script overhead at the

View File

@@ -332,6 +332,26 @@
DelayBeforeAppearanceSend = 2
[RegionReady]
; Enable this module to get notified once all items and scripts in the region have been completely loaded and compiled
enabled = true
; Channel on which to signal region readiness through a message
; formatted as follows: "{server_startup|oar_file_load},{0|1},n,[oar error]"
; - the first field indicating whether this is an initial server startup
; - the second field is a number indicating whether the OAR file loaded ok (1 == ok, 0 == error)
; - the third field is a number indicating how many scripts failed to compile
; - "oar error" if supplied, provides the error message from the OAR load
channel_notify = -800
; - disallow logins while scripts are loading
; Instability can occur on regions with 100+ scripts if users enter before they have finished loading
login_disable = true
; - send an alert as json to a service
; alert_uri = "http://myappserver.net/my_handler/"
[SMTP]
enabled = false
@@ -487,7 +507,7 @@
; silly vanity "Facelights" dead. Sorry, head mounted miner's lamps
; will also be affected.
;
;DisableFacelights = "false"
;DisableFacelights = "false(1815)
[ClientStack.LindenCaps]
;; Long list of capabilities taken from
@@ -553,11 +573,14 @@
Cap_UploadObjectAsset = "localhost"
Cap_ViewerStartAuction = ""
Cap_ViewerStats = ""
; This last one is supported by OpenSim, but may
; lead to poor sim performance if served by the simulators,
; so it is disabled by default.
Cap_WebFetchInventoryDescendents = ""
; The fetch inventory descendents caps are supported by OpenSim, but may
; lead to poor sim performance if served by the simulators,
; so they are disabled by default.
; FetchInventoryDescendents2 is the one used in the latest Linden Lab viewers (from some point in the v2 series and above)
Cap_WebFetchInventoryDescendents = ""
Cap_FetchInventoryDescendents2 = ""
[Chat]
; Controls whether the chat module is enabled. Default is true.
@@ -701,7 +724,8 @@
av_density = 80
; use this value to cut 52% of the height the sim gives us
av_height_fudge_factor = 0.52
; Currently unused
; av_height_fudge_factor = 0.52
; Movement. Smaller is faster.
@@ -1098,15 +1122,18 @@
[Economy]
; These economy values get used in the BetaGridLikeMoneyModule. - This module is for demonstration only -
; The default economy module only implements just enough to allow free actions (transfer of objects, etc).
; There is no intention to implement anything further in core OpenSimulator.
; This functionality has to be provided by third party modules.
; Enables selling things for $0
SellEnabled = "false"
;; Enables selling things for $0. Default is true.
SellEnabled = true
; Money Unit fee to upload textures, animations etc
PriceUpload = 0
;; Money Unit fee to upload textures, animations etc. Default is 0.
PriceUpload = 0
; Money Unit fee to create groups
PriceGroupCreate = 0
;; Money Unit fee to create groups. Default is 0.
PriceGroupCreate = 0
; We don't really know what the rest of these values do. These get sent to the client
; These taken from Agni at a Public Telehub. Change at your own risk.
@@ -1301,24 +1328,6 @@
broker = "http://broker.place.com/{1}"
[RegionReady]
; Enable this module to get notified once all items and scripts in the region have been completely loaded and compiled
; default is false
enabled = false
; Channel on which to signal region readiness through a message
; formatted as follows: "{server_startup|oar_file_load},{0|1},n,[oar error]"
; - the first field indicating whether this is an initial server startup
; - the second field is a number indicating whether the OAR file loaded ok (1 == ok, 0 == error)
; - the third field is a number indicating how many scripts failed to compile
; - "oar error" if supplied, provides the error message from the OAR load
channel_notify = -800
; - disallow logins while scripts are loading
login_disable = false
; - send an alert as json to a service
; alert_uri = "http://myappserver.net/my_handler/"
[MRM]
; Enables the Mini Region Modules Script Engine.
; default is false

View File

@@ -237,7 +237,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
AllowRemoteSetLoginLevel = "false"
; For V2 map
; MapTileURL = "http://127.0.0.1:8002";
MapTileURL = "http://127.0.0.1:8002";
; If you run this login server behind a proxy, set this to true
; HasProxy = false

View File

@@ -222,7 +222,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
AllowRemoteSetLoginLevel = "false"
; For V2 map
; MapTileURL = "http://127.0.0.1:8002";
MapTileURL = "http://127.0.0.1:8002";
; If you run this login server behind a proxy, set this to true
; HasProxy = false

View File

@@ -1801,6 +1801,7 @@
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Xml"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
@@ -2066,6 +2067,7 @@
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Xml"/>
<Reference name="System.Data"/>
<Reference name="OpenSim.Capabilities"/>
@@ -2425,6 +2427,7 @@
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Data"/>
<Reference name="System.Web"/>
<Reference name="System.Xml"/>