Compare commits

...

116 Commits

Author SHA1 Message Date
Justin Clark-Casey (justincc) 911e751019 Replace old Prebuild.exe accidentally added back in f977291 with one built without <copy> nant target generation and on mono 2.4.3 2012-12-12 01:46:53 +00:00
Justin Clark-Casey (justincc) 27f3f71a24 Replace previously updated Prebuild.exe with one built directly with mono 2.4.3 2012-12-12 01:46:45 +00:00
Justin Clark-Casey (justincc) e0cb9a5d27 Stop Prebuild from generating <copy> statements which unnecessarily copy files into bin/Debug or bin/Release
nant_0.91~alpha2+dfsg-3_all.deb in Ubuntu 12.04 and earlier actually ignored these due to a bug
However, nant 0.92~rc1+dfsg-2 in Ubuntu 12.10 fixes this bug (possibly https://github.com/nant/nant/pull/39).
Which makes nant time-consumingly copy these files when the aren't actually used.
Tested removal of <copy> on both nant 0.91 and nant 0.92
Will be submitting this patch to prebuild project for comment though I suspect there's nobody there to pay attention.
2012-12-12 01:46:31 +00:00
Justin Clark-Casey (justincc) 9d00fba777 Allow GetTexture calls with no second value in the range header (e.g. just 5333-)
It looks like the latest Kokua is doing this.
As per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, leaving off the second value is legal
This indicates the caller wants the rest of the entity.
2012-12-12 01:38:06 +00:00
Justin Clark-Casey (justincc) 0c5437e021 Fix build break whree accidentally did inv.Folders rather than inv.Folders.Count in a minor change. 2012-06-14 02:38:19 +01:00
Justin Clark-Casey (justincc) e391bdab22 Fix various issues with http inventory
1) The return messages were being wrongly populated with the names of asset, inventory and sale types when their corresponding integers should have been used instead.
2) Folders with links were including the linked items in the descendents figure, when only the links should be included.
3) Links and linked items in link folders were not being included in the return data, and not in the correct order.

Now that these issues have been addressed, outfits and attachments appear to work consistently when HTTP inventory is enabled (as is now the default).
2012-06-14 02:35:09 +01:00
Justin Clark-Casey (justincc) b13ddfc590 Enable FetchInventoryDescendents2 and FetchInventory2 caps by default. This appears to be required now for LL 3.3.1 to work properly.
Without this, LL 3.3.1 continually pushes LLInventoryModelFetchDescendentsResponder::error 499 to its log.
This cap will be ignored by older viewers - UDP inventory will work normally.
2012-06-14 02:34:50 +01:00
Melanie c83a80d847 Fix a logic error in app domain creation 2012-04-24 00:34:44 +01:00
Melanie 96e8795382 Don't re-add the assembly resolver for each script if not creating the appdomain 2012-04-24 00:34:37 +01:00
Justin Clark-Casey (justincc) 487a6f3d15 Fix bug in WebStatsModule where an exception would always be output on update if the user teleported to another region on that simulator.
This was because update was looking for an existing stats record unique in session id, agent id and region id.
But if the user teleports to another region then region id changes.
WebStatsModule promptly doesn't find the existing record and tries to insert a new one, but only session id is the primary key and that's still the same, which makes things go bang.
This makes the update search only on the unique session id.
This is only an issue with simulators that have multiple regions where the webstats module is enabled.
2012-04-18 21:52:21 +01:00
Justin Clark-Casey (justincc) 906f6820c7 minor: Add some documentation to OnNewClient and OnClientClosed events 2012-04-18 21:46:04 +01:00
nebadon 8dea2c8e40 fix yield prolog so it compiles with mono 2.11 there has been a bugzilla
report files with mono project in regards to this change, this simply
lets us move forward with using mono 2.11 for now :
https://bugzilla.xamarin.com/show_bug.cgi?id=4052
2012-04-18 21:28:31 +01:00
Justin Clark-Casey (justincc) de667ea00a Change flavour back to post fixes. 2012-03-31 01:31:45 +01:00
Justin Clark-Casey (justincc) 88b2247d94 Bump to 0.7.3.1 release version 2012-03-30 22:04:55 +01:00
Justin Clark-Casey (justincc) 54ee59c0bb Add Extended flavour option to opensim version information.
This flavour is for changes in addition to the 0.7.3-post-fixes branch that are too large to be considered fixes but should be reasonably stable.
This flavour will almost certainly never see a formal release.
2012-03-30 02:13:37 +01:00
Justin Clark-Casey (justincc) 4a5c61a33d Enable voice by default on parcels to weaken effects of viewer 2/3 ParcelVoiceInfoRequest bug
Viewer 2/3 contains a bug where the viewer will constantly retry ParcelVoiceInfoRequest requests on voice-disabled parcels where voice is otherwise available.
Attempts to fix this server-side have not been successful - sending a non-OK http code (e.g. a 404) just makes the viewer request again immediately.
Dropping the request entirely is a bit better but the viewer still retries after a minute.
Estate settings already enabled voice by default so doing the same for parcels.  This only has an effect if you have any voice system active at all.
Ultimately, the re-request bug needs to be fixed viewer-side (LL suffers from the same issue!) but it might be worth implementing the drop request hack.
2012-03-30 02:03:52 +01:00
Diva Canto 179c0f5f56 Merge branch '0.7.3-post-fixes' of ssh://opensimulator.org/var/git/opensim into 0.7.3-post-fixes 2012-03-22 20:36:01 -07:00
Justin Clark-Casey (justincc) 4dbf937707 Comment out login parameters debug output accidentally included with c4b2d24 2012-03-22 23:33:08 +00:00
Justin Clark-Casey (justincc) 9edb57e5e9 Comment out a terrain save-tile debugging message that accidentally crept in with c4b2d24 2012-03-22 23:17:54 +00:00
Justin Clark-Casey (justincc) 4d15ad63bf refactor: simplify code for checks when part.OwnerID != destPart.OwnerID in MoveTaskInventoryItem() 2012-03-22 23:03:00 +00:00
Justin Clark-Casey (justincc) 4021709371 Fix llGiveInventory() so that it checks the destination part for AllowInventoryDrop, not the source.
This allows llAllowInventoryDrop() to work.
Regression test added for this case.
2012-03-22 23:02:49 +00:00
Justin Clark-Casey (justincc) 3c13f5c3aa Add llGiveInventory() test from object to object where both objects are owned by the same user. 2012-03-22 23:02:35 +00:00
Justin Clark-Casey (justincc) 381517b451 Add prim name to "[MESH]: No recognized physics mesh..." log message 2012-03-22 23:01:39 +00:00
Justin Clark-Casey (justincc) 6ecf36d49c Fix small typo 2012-03-22 22:47:03 +00:00
Justin Clark-Casey (justincc) 64eb4b8408 Fix crash where two scene loop threads could changes m_MeshToTriMeshMap at the same time.
Have to lock m_MeshToTriMeshMap as property is static and with more than one region two scene loops could try to manipulate at the same time.
2012-03-22 22:46:45 +00:00
Diva Canto 318da3fdcd Added new simple_build_permissions config to the .ini and .example files. 2012-03-22 14:34:46 -07:00
Melanie 50c99fcda6 Change a false false to be truly true - or is this statement false?
Fixes perms boo-boo
2012-03-22 14:34:33 -07:00
Melanie 321de1f263 Rework Diva's patch to simplify it 2012-03-22 14:34:19 -07:00
Diva Canto fa30ace67d Fixed borkness with map search introduce by my last changes to it. 2012-03-20 17:49:05 -07:00
Justin Clark-Casey (justincc) 92baa79253 Add some doc about the EventManager.OnLoginsEnabled event. 2012-03-19 22:49:34 +00:00
Justin Clark-Casey (justincc) e861b45313 Fix a bug where logins to standalones would fail if the RegionReady module was not active
Unfortunately, the OnLoginsEnabled event is currently only guaranteed to fire if the RegionReady module is active.
However, we can instantiate the AuthorizationService in the module RegionLoaded method since by this time all other modules will have been loaded
2012-03-19 22:49:14 +00:00
Justin Clark-Casey (justincc) cf91ac68b6 Stop console command "xengine status" throwing an exception if there are no scripts in a region.
Addresses http://opensimulator.org/mantis/view.php?id=5940
2012-03-19 21:45:18 +00:00
Justin Clark-Casey (justincc) d4aba13526 Clean up "save iar" help 2012-03-19 21:33:03 +00:00
Justin Clark-Casey (justincc) d36c7c3782 minor: reuse threadpool count we just fetched instead of fetching it again 2012-03-19 21:32:50 +00:00
Justin Clark-Casey (justincc) 4385fcdeae Add total scripts count to "show threads"
However, this returns 0 on Mono (at least on 2.6.7)!  So not showing if it is zero.
2012-03-19 21:32:42 +00:00
Justin Clark-Casey (justincc) 04eb170624 refactor: separate out console and status report generation parts of XEngine 2012-03-19 21:32:34 +00:00
Justin Clark-Casey (justincc) 4803686078 Improve threadpool reporting to "show threads" console command (also gets printed out periodically) 2012-03-19 21:32:25 +00:00
Justin Clark-Casey (justincc) 20b0fda3bb Add process working memory to "show stats" memory statistics.
This shows the actual amount of RAM being taken up by OpenSimulator (objects + vm overhead)
2012-03-19 21:32:16 +00:00
Justin Clark-Casey (justincc) 4e5f823595 In Top Scripts report, don't show scripts with no or less than 1 microsecond of execution time.
This is to make the report clearer and less confusing.
2012-03-19 21:32:02 +00:00
Justin Clark-Casey (justincc) a74408d1d2 Aggregate script execution times by linksets rather than individual prims.
This is for the top scripts report.
2012-03-19 21:31:53 +00:00
Justin Clark-Casey (justincc) 8206537efd Fix owner name display in "Top Colliders" and "Top Script" region reports. 2012-03-19 21:31:45 +00:00
Justin Clark-Casey (justincc) a9a77bb3ab Replace script-lines-per-second with the script execution time scaled by its measurement period and an idealised frame time.
The previous lines-per-second measurement used for top scripts report was inaccurate, since lines executed does not reflect time taken to execute.
Also, every fetch of the report would reset all the numbers limiting its usefulness and we weren't even guaranteed to see the top 100.
The actual measurement value should be script execution time per frame but XEngine does not work this way.
Therefore, we use actual script execution time scaled by the measurement period and an idealised frame time.
This is still not ideal but gives reasonable results and allows scripts to be compared.
This commit moves script execution time calculations from SceneGraph into IScriptModule implementations.
2012-03-19 21:31:38 +00:00
Justin Clark-Casey (justincc) 6390de689d Remove property/field duplication in ScriptInstance where it's unnecessary. 2012-03-19 21:31:17 +00:00
Justin Clark-Casey (justincc) 41ce19836b Simplify some logic in the ScriptInstance constructor - running is set to false in both if/else branches 2012-03-19 21:31:07 +00:00
Melanie 883a4f6fff FireAndForget scripted rez - port from Avination 2012-03-19 21:30:31 +00:00
Justin Clark-Casey (justincc) 5f1da80fc1 minor: correct indentation levels 2012-03-19 21:30:16 +00:00
Justin Clark-Casey (justincc) 64217d67f6 Remove duplication of m_RunEvents and Running 2012-03-19 21:29:45 +00:00
Justin Clark-Casey (justincc) b01c79354c Fix a problem where multiple near simultaneous calls to llDie() from multiple scripts in the same linkset can cause unnecessary thread aborts.
The first llDie() could lock Scene.m_deleting_scene_object.
The second llDie() would then wait at this lock.
The first llDie() would go on to remove the second script but always abort it since the second script's WorkItem would not go away.
Easiest solution here is to remove the m_deleting_scene_object since it's no longer justified - we no longer lock m_parts but take a copy instead.
This also requires an adjustment in XEngine.OnRemoveScript not to use instance.ObjectID instead when firing the OnObjectRemoved event.
2012-03-19 21:29:34 +00:00
Justin Clark-Casey (justincc) 9ecbcb787c Alleviate an issue where calling Thread.Abort() on script WorkItems can fail to release locks, resulting in a crippled simulator.
This seems to be a particular problem with ReaderWriterLockSlim, though other locks can be affected as well.
It has been seen to happen when llDie() is called in a linkset running more than one script.
Alleviation here means supplying a ScriptInstance.Stop() timeout of 1000ms rather than 0ms, to give events a chance to complete.
Also, we check the IsRunning status at the top of the ScriptInstance.EventProcessor() so that another event doesn't start in the mean time.
Ultimately, a better solution may have to be found since a long-running event would still exceed the timeout and be aborted.
2012-03-19 21:29:24 +00:00
Justin Clark-Casey (justincc) e17e376b04 refactor: rename ScriptInstance.m_CurrentResult to m_CurrentWorkItem to make it more understandable as to what it is and what it does (hold a thread pool work item for a waiting of in-progress event)
Also add other various illustrative comments
2012-03-19 21:29:09 +00:00
Justin Clark-Casey (justincc) 1b4ea4f178 Add max thread and min thread information to "xengine status" region console command 2012-03-19 21:28:54 +00:00
Melanie 1de29fb362 Change OpenSim.ini.example to reflect how to actually enable prim limits,
as opposed to how it was first designed.
2012-03-19 21:28:37 +00:00
Justin Clark-Casey (justincc) 7e4bd492fd Add documentation to make more explicit the difference between OnRezScript and OnNewScript in the event manager
OnNewScript fires when a script is added to a scene
OnRezScript fires when the script actually runs (i.e. after permission checks, state retrieval, etc.)
2012-03-19 21:26:32 +00:00
Justin Clark-Casey (justincc) 588d56503d Remove unnecessary explicit ElapsedEventHandler in SimReporter 2012-03-19 21:26:12 +00:00
Justin Clark-Casey (justincc) e9602656f8 Add sensor, dataserver requests, timer and listener counts to "xengine status" command.
This is for diagnostic purposes.
2012-03-19 21:26:04 +00:00
Justin Clark-Casey (justincc) 0116d418f0 Fix TestSyntaxError() and TestSyntaxErrorDeclaringVariableInForLoop()
They were all failing assertions but the exceptions these threw were caught as expected Exceptions.
I don't think we can easily distinguish these from the Exceptions that we're expecting.
So for now we'll do some messy manually checking with boolean setting instead.
This patch also corrects the assertions themselves.
2012-03-19 21:25:41 +00:00
Justin Clark-Casey (justincc) 9992974c66 Get all test methods in OpenSim.Region.ScriptEngine.Tests.dll to report that they're running 2012-03-19 21:25:30 +00:00
Justin Clark-Casey (justincc) ba27d8a389 Fix off by one error in script error reporting. 2012-03-19 21:25:20 +00:00
Justin Clark-Casey (justincc) f96e985763 Simplify NPCModuleTests code by putting the NPCModule in an instance variable rather than making each test fetch it seperately.
Also rename instance variables in the test to conform to naming standards and for understandability
2012-03-19 21:25:07 +00:00
Diva Canto 5b9eaae50d Region access control! Region operators can now specify things like DisallowForeigners (means what it says) and DisallowResidents (means that only admins and managers can get into the region). This puts the never-completed AuthorizationService to good use. Note that I didn't implement a grid-wide Authorization service; this service implementation is done entirely locally on the simulator. This can be changed as usual by pluging in a different AuthorizationServicesConnector. 2012-03-17 19:49:14 -07:00
Diva Canto 74a13f7e3b Fixes mantis #5923 2012-03-17 19:47:05 -07:00
Diva Canto 3e88fc8aad Datasnapshot: added "secret" to the registration/deregistration query so that data providers can verify authenticity if they want. 2012-03-16 17:27:45 -07:00
Diva Canto 881740d702 DataSnapshot: renamed gridserverURL to gatekeeperURL, and normalimzed the capitalization of 'name' to lower case, also in the same <grid> section. 2012-03-16 17:27:29 -07:00
Diva Canto 9a643a1bb9 Terrain: added [Terrain] section with an option to load an initial flat terrain. Default is still pinhead island. I much rather have a flat land in the beginning.
Conflicts:

	bin/OpenSim.ini.example
2012-03-16 13:14:26 -07:00
Diva Canto a5488650ff More on map search: send extra messages to the user regarding the region being found or not, because the UI is horribly confusing -- places profile is always "loading..." whether the region exists or not. 2012-03-15 20:24:26 -07:00
Diva Canto a275127a65 More on SLURLs and V3. This is hacky, but it works. Basically, we have to redefine the encoding of HG URLs because the viewer messes them up. Examples of what works and doesn't work:
- secondlife://ucigrid00.nacs.uci.edu|8002/128/128 <-- works throughout the viewer
- secondlife://http|!!ucigrid00.nacs.uci.edu|8002+Test+Zone+1/128/128 <-- works throughout the viewer
- secondlife://http|!!grid.sciencesim.com!grid!hypergrid.php+Yellowstone01+74/128/128 <-- works throughout
- secondlife://http%3A%2F%2Fucigrid00.nacs.uci.edu%3A8002%20UCI%20Central%201/128/128 <-- works in chat, but not as URLs in the webkit
2012-03-15 16:14:20 -07:00
Diva Canto 02db31db6a Revert "Revert "More hacking around viewer bug""
This reverts commit 0434758a0d.
2012-03-15 16:14:07 -07:00
Diva Canto 8bd813e6fc Revert "Revert "Hack around https://jira.secondlife.com/browse/VWR-28570""
This reverts commit 09ff121654.
2012-03-15 16:13:50 -07:00
Diva Canto 09ff121654 Revert "Hack around https://jira.secondlife.com/browse/VWR-28570"
This reverts commit d7651a389e.
2012-03-15 14:38:22 -07:00
Diva Canto 0434758a0d Revert "More hacking around viewer bug"
This reverts commit 8bb0a71083.
2012-03-15 14:38:03 -07:00
Diva Canto 8bb0a71083 More hacking around viewer bug 2012-03-15 11:04:56 -07:00
Diva Canto d7651a389e Hack around https://jira.secondlife.com/browse/VWR-28570 2012-03-15 10:18:55 -07:00
Justin Clark-Casey (justincc) 824318a0c1 Go back to setting appearance directly in NPCModule.SetAppearance() to fix mantis 5914
The part reverted is from commit 2ebb421.
Unfortunately, IAvatarFactoryModule.SetAppearance() does not transfer attachments.
I'm not sure how to do this separately, unfortunately I'll need to leave it to Dan :)
Regression test added for this case.
Mantis ref: http://opensimulator.org/mantis/view.php?id=5914
2012-03-06 01:32:44 +00:00
Justin Clark-Casey (justincc) 5e9ed22e84 Merge branch '0.7.3-post-fixes' of ssh://opensimulator.org/var/git/opensim into 0.7.3-post-fixes 2012-03-06 00:48:24 +00:00
Chris Hart a6c611e7c9 Updates to MSSQL store for 0.7.3 to include:
* Telehub support
* Bugfix to Friends lookups
* Updates to Creator fields to store up to 255 characters for HG item creator storage
2012-03-06 00:45:58 +00:00
Diva Canto 72b325f8b5 Send the right name and creation date on the BasicProfileModule. 2012-03-01 19:58:57 -08:00
Justin Clark-Casey (justincc) 54d0514b13 Move SenseRepeaters.Count check inside the SenseRepeatListLock.
No methods in the List class are thread safe in the MS specification/documentation
2012-03-02 00:37:48 +00:00
Justin Clark-Casey (justincc) 58b1c3cec0 lock SenseRepeatListLock when added a new sensor during script reconstitution.
This is already being done in the other place where a sensor is added.
Adding a sensor whilst another thread is iterating over the sensor list can cause a concurrency exception.
2012-03-02 00:37:42 +00:00
Justin Clark-Casey (justincc) 71641523a3 Flick 0.7.3-post-fixes to Flavour.Post_Fixes 2012-02-29 23:43:41 +00:00
Justin Clark-Casey (justincc) 94c5e25c3b Extend distsrc target to cleanup the files generated by running prebuild 2012-02-29 22:32:32 +00:00
Justin Clark-Casey (justincc) 20bad0aa6c Merge branch '0.7.3-post-fixes' of ssh://opensimulator.org/var/git/opensim into 0.7.3-post-fixes 2012-02-29 22:22:42 +00:00
Justin Clark-Casey (justincc) e7f23a6218 Switch flavour to release 2012-02-29 22:10:33 +00:00
Justin Clark-Casey (justincc) 25c29db8b6 Don't start pCampbot if the user doesn't supply bot firstname, lastname stub and password 2012-02-29 22:04:17 +00:00
Justin Clark-Casey (justincc) 1750fba9ce Call Dispose() via using() on SqliteCommands in WebStatsModule after use. 2012-02-29 22:04:04 +00:00
PixelTomsen b18e410586 PRIM_SCULPT_FLAG_INVERT, PRIM_SCULPT_FLAG_MIRROR implemented
http://opensimulator.org/mantis/view.php?id=5763
2012-02-29 22:03:28 +00:00
Justin Clark-Casey (justincc) 38d5e1fab3 Move libopenjpeg native libraries into lib32 and lib64 as appropriate. 2012-02-29 22:03:15 +00:00
Justin Clark-Casey (justincc) 4180c32eb1 Remove some more unused Bullet libraries. 2012-02-29 22:03:08 +00:00
Justin Clark-Casey (justincc) 5115229fdf Remove old libbulletnet native libraries. These are not used in the current generation bullet physics plugin. 2012-02-29 22:02:59 +00:00
Justin Clark-Casey (justincc) e8f2d814e7 Move other sqlite and ode 32-bit and 64-bit libraries into lib32 or lib64 as appropriate. 2012-02-29 22:02:50 +00:00
Diva Canto 1fda8c5a86 HG: Remove async in posting assets to foreign grid. Mono hates concurrency there. 2012-02-26 14:30:58 -08:00
Justin Clark-Casey (justincc) 6b77b55d40 Merge branch 'master' into 0.7.3-post-fixes 2012-02-25 00:49:16 +00:00
Justin Clark-Casey (justincc) 82cdb08c1f Merge branch 'master' into 0.7.3-post-fixes 2012-02-25 00:49:05 +00:00
Justin Clark-Casey (justincc) dafcb3bcd7 Merge branch 'master' into 0.7.3-post-fixes 2012-02-24 23:35:59 +00:00
Diva Canto 3259b1d1e0 Amend to last commit: synchronize access to queues. 2012-02-20 11:13:02 -08:00
Diva Canto 512910a51f More improvements on agent position updates: if the target sims fail, blacklist them for 2 min, so that we don't keep doing remote calls that fail. 2012-02-20 11:00:01 -08:00
Diva Canto fdda57cf10 Merge branch '0.7.3-post-fixes' of ssh://opensimulator.org/var/git/opensim into 0.7.3-post-fixes 2012-02-19 16:48:09 -08:00
Diva Canto ec8e34950d One more tweak related to the previous 2 commits. 2012-02-19 16:47:04 -08:00
Diva Canto 93964ef3a4 Amend to last commit. This should have been committed too. 2012-02-19 16:46:47 -08:00
Diva Canto 5c8af6a136 A few more tweaks on position updates and create child agents. Mono hates concurrent uses of the same TCP connection, and even of the connections to the same server. So let's stop doing it. This patch makes movement much smoother when there are lots of neighbours. 2012-02-19 16:46:32 -08:00
PixelTomsen 4d0c8aca05 Fix:OmegaX, OmegaY and OmegaZ not saved for child prims http://opensimulator.org/mantis/view.php?id=5893
Signed-off-by: nebadon <michael@osgrid.org>
2012-02-19 13:49:51 -05:00
PixelTomsen 8fc16ece96 Fix:Fly setting for Parcel dosen't work http://opensimulator.org/mantis/view.php?id=5887
Signed-off-by: nebadon <michael@osgrid.org>
2012-02-19 13:49:41 -05:00
BlueWall fcbb375e8f Use localy defined name, TPFlags, for Constants.TeleportFlags 2012-02-19 12:42:05 -05:00
BlueWall 49c65279fa Route logins according to Estate, Telehub and TeleportFlags 2012-02-19 12:41:44 -05:00
BlueWall 86e8a56fe1 Propagate our teleport flags on logins 2012-02-19 12:41:30 -05:00
BlueWall b199330682 Parcel sales support to SQLite 2012-02-19 12:41:11 -05:00
BlueWall 7a7ebaebd1 Fillin missing SQLite support for Telehubs 2012-02-19 12:40:46 -05:00
BlueWall 164ae0b24b Fix missing telehub handling on login 2012-02-19 12:40:26 -05:00
Diva Canto 7156545fca This should smooth movement in heteregeneous networks by a lot: cache the region by position instead of looking it up all the time -- this was being done during the main update loop! 2012-02-18 22:15:58 -08:00
Justin Clark-Casey (justincc) 73a5abf4d9 Merge branch 'master' into 0.7.3-post-fixes 2012-02-17 04:04:38 +00:00
Justin Clark-Casey (justincc) 630c8dc828 switch version flavour to rc2 2012-02-17 04:03:59 +00:00
Justin Clark-Casey (justincc) 6de89246c2 Merge branch 'master' into 0.7.3-post-fixes 2012-02-17 00:02:16 +00:00
Justin Clark-Casey (justincc) 96973a5778 Merge branch 'master' into 0.7.3-post-fixes 2012-02-16 03:39:25 +00:00
Justin Clark-Casey (justincc) 96843f2b17 Merge branch 'master' into 0.7.3-post-fixes 2012-02-15 02:41:50 +00:00
Justin Clark-Casey (justincc) 8a36f54cf4 Merge branch 'master' into 0.7.3-post-fixes 2012-02-06 20:54:21 +00:00
Justin Clark-Casey (justincc) 1a14e660d2 Merge branch 'master' into 0.7.3-post-fixes 2012-02-04 02:03:49 +00:00
Justin Clark-Casey (justincc) 2502aae5db Switch flavour to RC1. It will still be a while before RC1 is released. 2012-02-04 01:26:29 +00:00
104 changed files with 2096 additions and 965 deletions

View File

@ -8,6 +8,24 @@
<copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/> <copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/>
<copy file="bin/config-include/StandaloneCommon.ini.example" tofile="bin/config-include/StandaloneCommon.ini"/> <copy file="bin/config-include/StandaloneCommon.ini.example" tofile="bin/config-include/StandaloneCommon.ini"/>
<copy file="bin/config-include/FlotsamCache.ini.example" tofile="bin/config-include/FlotsamCache.ini"/> <copy file="bin/config-include/FlotsamCache.ini.example" tofile="bin/config-include/FlotsamCache.ini"/>
<!-- delete files generated by runprebuild.sh which had to be run in order to generate the build file for this target-->
<delete>
<fileset basedir="OpenSim">
<include name="**/*.build"/>
<include name="**/*.csproj*"/>
<include name="**/*.dll.build"/>
<include name="**/*.pidb"/>
<exclude name="Tools/OpenSim.32BitLaunch/**"/>
<exclude name="Tools/Robust.32BitLaunch/**"/>
<exclude name="Tools/LaunchSLClient/**"/>
</fileset>
</delete>
<delete>
<fileset>
<include name="OpenSim.build"/>
<include name="OpenSim.sln"/>
</fileset>
</delete>
</target> </target>
<property name="distbindir" value="distbin" /> <property name="distbindir" value="distbin" />

View File

@ -101,18 +101,8 @@ namespace OpenSim.Capabilities.Handlers
llsdItem.item_id = invItem.ID; llsdItem.item_id = invItem.ID;
llsdItem.name = invItem.Name; llsdItem.name = invItem.Name;
llsdItem.parent_id = invItem.Folder; llsdItem.parent_id = invItem.Folder;
llsdItem.type = invItem.AssetType;
try llsdItem.inv_type = invItem.InvType;
{
llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType);
llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType);
}
catch (Exception e)
{
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 = new LLSDPermissions();
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
@ -126,21 +116,7 @@ namespace OpenSim.Capabilities.Handlers
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
llsdItem.sale_info = new LLSDSaleInfo(); llsdItem.sale_info = new LLSDSaleInfo();
llsdItem.sale_info.sale_price = invItem.SalePrice; llsdItem.sale_info.sale_price = invItem.SalePrice;
switch (invItem.SaleType) llsdItem.sale_info.sale_type = invItem.SaleType;
{
default:
llsdItem.sale_info.sale_type = "not";
break;
case 1:
llsdItem.sale_info.sale_type = "original";
break;
case 2:
llsdItem.sale_info.sale_type = "copy";
break;
case 3:
llsdItem.sale_info.sale_type = "contents";
break;
}
return llsdItem; return llsdItem;
} }

View File

@ -230,6 +230,11 @@ namespace OpenSim.Capabilities.Handlers
} }
else else
{ {
// Handle the case where no second range value was given. This is equivalent to requesting
// the rest of the entity.
if (end == -1)
end = int.MaxValue;
end = Utils.Clamp(end, 0, texture.Data.Length - 1); end = Utils.Clamp(end, 0, texture.Data.Length - 1);
start = Utils.Clamp(start, 0, end); start = Utils.Clamp(start, 0, end);
int len = end - start + 1; int len = end - start + 1;
@ -277,16 +282,44 @@ namespace OpenSim.Capabilities.Handlers
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length); // texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
} }
/// <summary>
/// Parse a range header.
/// </summary>
/// <remarks>
/// As per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html,
/// this obeys range headers with two values (e.g. 533-4165) and no second value (e.g. 533-).
/// Where there is no value, -1 is returned.
/// FIXME: Need to cover the case where only a second value is specified (e.g. -4165), probably by returning -1
/// for start.</remarks>
/// <returns></returns>
/// <param name='header'></param>
/// <param name='start'>Undefined if the parse fails.</param>
/// <param name='end'>Undefined if the parse fails.</param>
private bool TryParseRange(string header, out int start, out int end) private bool TryParseRange(string header, out int start, out int end)
{ {
start = end = 0;
if (header.StartsWith("bytes=")) if (header.StartsWith("bytes="))
{ {
string[] rangeValues = header.Substring(6).Split('-'); string[] rangeValues = header.Substring(6).Split('-');
if (rangeValues.Length == 2) if (rangeValues.Length == 2)
{ {
if (Int32.TryParse(rangeValues[0], out start) && Int32.TryParse(rangeValues[1], out end)) if (!Int32.TryParse(rangeValues[0], out start))
return false;
string rawEnd = rangeValues[1];
if (rawEnd == "")
{
end = -1;
return true; return true;
} }
else if (Int32.TryParse(rawEnd, out end))
{
return true;
}
}
} }
start = end = 0; start = end = 0;

View File

@ -156,11 +156,12 @@ namespace OpenSim.Capabilities.Handlers
inv.Folders = new List<InventoryFolderBase>(); inv.Folders = new List<InventoryFolderBase>();
inv.Items = new List<InventoryItemBase>(); inv.Items = new List<InventoryItemBase>();
int version = 0; int version = 0;
int descendents = 0;
inv inv
= Fetch( = Fetch(
invFetch.owner_id, invFetch.folder_id, invFetch.owner_id, invFetch.owner_id, invFetch.folder_id, invFetch.owner_id,
invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version); invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version, out descendents);
if (inv.Folders != null) if (inv.Folders != null)
{ {
@ -168,6 +169,8 @@ namespace OpenSim.Capabilities.Handlers
{ {
contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); contents.categories.Array.Add(ConvertInventoryFolder(invFolder));
} }
descendents += inv.Folders.Count;
} }
if (inv.Items != null) if (inv.Items != null)
@ -178,7 +181,7 @@ namespace OpenSim.Capabilities.Handlers
} }
} }
contents.descendents = contents.items.Array.Count + contents.categories.Array.Count; contents.descendents = descendents;
contents.version = version; contents.version = version;
// m_log.DebugFormat( // m_log.DebugFormat(
@ -206,7 +209,7 @@ namespace OpenSim.Capabilities.Handlers
/// <returns>An empty InventoryCollection if the inventory look up failed</returns> /// <returns>An empty InventoryCollection if the inventory look up failed</returns>
private InventoryCollection Fetch( private InventoryCollection Fetch(
UUID agentID, UUID folderID, UUID ownerID, UUID agentID, UUID folderID, UUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder, out int version) bool fetchFolders, bool fetchItems, int sortOrder, out int version, out int descendents)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", // "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
@ -215,6 +218,8 @@ namespace OpenSim.Capabilities.Handlers
// FIXME MAYBE: We're not handling sortOrder! // FIXME MAYBE: We're not handling sortOrder!
version = 0; version = 0;
descendents = 0;
InventoryFolderImpl fold; InventoryFolderImpl fold;
if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner) if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner)
{ {
@ -223,6 +228,7 @@ namespace OpenSim.Capabilities.Handlers
InventoryCollection ret = new InventoryCollection(); InventoryCollection ret = new InventoryCollection();
ret.Folders = new List<InventoryFolderBase>(); ret.Folders = new List<InventoryFolderBase>();
ret.Items = fold.RequestListOfItems(); ret.Items = fold.RequestListOfItems();
descendents = ret.Folders.Count + ret.Items.Count;
return ret; return ret;
} }
@ -246,24 +252,73 @@ namespace OpenSim.Capabilities.Handlers
version = containingFolder.Version; version = containingFolder.Version;
// if (fetchItems) if (fetchItems)
// { {
// List<InventoryItemBase> linkedItemsToAdd = new List<InventoryItemBase>(); List<InventoryItemBase> itemsToReturn = contents.Items;
// List<InventoryItemBase> originalItems = new List<InventoryItemBase>(itemsToReturn);
// descendents must only include the links, not the linked items we add
descendents = originalItems.Count;
// Second, add target items for links in this folder
foreach (InventoryItemBase item in originalItems)
{
if (item.AssetType == (int)AssetType.Link)
{
InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
// Take care of genuinely broken links where the target doesn't exist
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
// but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
// rather than having to keep track of every folder requested in the recursion.
if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
itemsToReturn.Insert(0, linkedItem);
}
}
// First, scan for folder links and add target items in those folders.
foreach (InventoryItemBase item in originalItems)
{
if (item.AssetType == (int)AssetType.LinkFolder)
{
InventoryCollection linkedFolderContents = m_InventoryService.GetFolderContent(ownerID, item.AssetID);
List<InventoryItemBase> links = linkedFolderContents.Items;
// Second, insert the links contained in this linked folder.
itemsToReturn.InsertRange(0, links);
// Third, insert the real items linked by the links in this linked folder.
foreach (InventoryItemBase link in linkedFolderContents.Items)
{
// Take care of genuinely broken links where the target doesn't exist
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
// but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
// rather than having to keep track of every folder requested in the recursion.
if (link != null)
{
// m_log.DebugFormat(
// "[WEB FETCH INV DESC HANDLER]: Adding item {0} {1} from folder {2} linked from {3}",
// link.Name, (AssetType)link.AssetType, item.AssetID, containingFolder.Name);
InventoryItemBase linkedItem
= m_InventoryService.GetItem(new InventoryItemBase(link.AssetID));
itemsToReturn.Insert(0, linkedItem);
}
}
}
}
}
// foreach (InventoryItemBase item in contents.Items) // foreach (InventoryItemBase item in contents.Items)
// { // {
// if (item.AssetType == (int)AssetType.Link) // m_log.DebugFormat(
// { // "[WEB FETCH INV DESC HANDLER]: Returning item {0}, type {1}, parent {2} in {3} {4}",
// InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID)); // item.Name, (AssetType)item.AssetType, item.Folder, containingFolder.Name, containingFolder.ID);
//
// // Take care of genuinely broken links where the target doesn't exist
// // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
// // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
// // rather than having to keep track of every folder requested in the recursion.
// if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
// linkedItemsToAdd.Insert(0, linkedItem);
// }
// } // }
// =====
// //
// foreach (InventoryItemBase linkedItem in linkedItemsToAdd) // foreach (InventoryItemBase linkedItem in linkedItemsToAdd)
// { // {
@ -365,18 +420,8 @@ namespace OpenSim.Capabilities.Handlers
llsdItem.item_id = invItem.ID; llsdItem.item_id = invItem.ID;
llsdItem.name = invItem.Name; llsdItem.name = invItem.Name;
llsdItem.parent_id = invItem.Folder; llsdItem.parent_id = invItem.Folder;
llsdItem.type = invItem.AssetType;
try llsdItem.inv_type = invItem.InvType;
{
llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType);
llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType);
}
catch (Exception e)
{
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 = new LLSDPermissions();
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
@ -390,21 +435,7 @@ namespace OpenSim.Capabilities.Handlers
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
llsdItem.sale_info = new LLSDSaleInfo(); llsdItem.sale_info = new LLSDSaleInfo();
llsdItem.sale_info.sale_price = invItem.SalePrice; llsdItem.sale_info.sale_price = invItem.SalePrice;
switch (invItem.SaleType) llsdItem.sale_info.sale_type = invItem.SaleType;
{
default:
llsdItem.sale_info.sale_type = "not";
break;
case 1:
llsdItem.sale_info.sale_type = "original";
break;
case 2:
llsdItem.sale_info.sale_type = "copy";
break;
case 3:
llsdItem.sale_info.sale_type = "contents";
break;
}
return llsdItem; return llsdItem;
} }

View File

@ -37,8 +37,8 @@ namespace OpenSim.Framework.Capabilities
public UUID asset_id; public UUID asset_id;
public UUID item_id; public UUID item_id;
public LLSDPermissions permissions; public LLSDPermissions permissions;
public string type; public int type;
public string inv_type; public int inv_type;
public int flags; public int flags;
public LLSDSaleInfo sale_info; public LLSDSaleInfo sale_info;
@ -65,7 +65,7 @@ namespace OpenSim.Framework.Capabilities
public class LLSDSaleInfo public class LLSDSaleInfo
{ {
public int sale_price; public int sale_price;
public string sale_type; public int sale_type;
} }
[OSDMap] [OSDMap]

View File

@ -89,5 +89,11 @@ namespace OpenSim.Data.MSSQL
return DoQuery(cmd); return DoQuery(cmd);
} }
} }
public FriendsData[] GetFriends(Guid principalID)
{
return GetFriends(principalID.ToString());
}
} }
} }

View File

@ -813,7 +813,7 @@ namespace OpenSim.Data.MSSQL
{ {
try try
{ {
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID", connection)) using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID and type=-1", connection))
{ {
command.Parameters.Add(database.CreateParameter("folderID", folderID)); command.Parameters.Add(database.CreateParameter("folderID", folderID));

View File

@ -675,7 +675,7 @@ VALUES
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)"; sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags],[Expires]) VALUES (@LandUUID,@AccessUUID,@Flags,@Expires)";
using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
@ -1215,6 +1215,8 @@ VALUES
//Store new values //Store new values
StoreNewRegionSettings(regionSettings); StoreNewRegionSettings(regionSettings);
LoadSpawnPoints(regionSettings);
return regionSettings; return regionSettings;
} }
@ -1252,7 +1254,7 @@ VALUES
,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se ,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se
,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit ,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit
,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position ,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position
,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id ,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id, [map_tile_id] = @TerrainImageID, [telehubobject] = @telehubobject, [parcel_tile_id] = @ParcelImageID
WHERE [regionUUID] = @regionUUID"; WHERE [regionUUID] = @regionUUID";
using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlConnection conn = new SqlConnection(m_connectionString))
@ -1263,6 +1265,7 @@ VALUES
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
SaveSpawnPoints(regionSettings);
} }
public void Shutdown() public void Shutdown()
@ -1383,6 +1386,11 @@ VALUES
newSettings.LoadedCreationID = ""; newSettings.LoadedCreationID = "";
else else
newSettings.LoadedCreationID = (String)row["loaded_creation_id"]; newSettings.LoadedCreationID = (String)row["loaded_creation_id"];
newSettings.TerrainImageID = new UUID((string)row["map_tile_ID"]);
newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]);
newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]);
return newSettings; return newSettings;
} }
@ -1454,6 +1462,13 @@ VALUES
} }
newData.ParcelAccessList = new List<LandAccessEntry>(); newData.ParcelAccessList = new List<LandAccessEntry>();
newData.MediaDescription = (string)row["MediaDescription"];
newData.MediaType = (string)row["MediaType"];
newData.MediaWidth = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[0]);
newData.MediaHeight = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[1]);
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
return newData; return newData;
} }
@ -1468,7 +1483,7 @@ VALUES
LandAccessEntry entry = new LandAccessEntry(); LandAccessEntry entry = new LandAccessEntry();
entry.AgentID = new UUID((Guid)row["AccessUUID"]); entry.AgentID = new UUID((Guid)row["AccessUUID"]);
entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
entry.Expires = 0; entry.Expires = Convert.ToInt32(row["Expires"]);
return entry; return entry;
} }
@ -1497,7 +1512,8 @@ VALUES
prim.TouchName = (string)primRow["TouchName"]; prim.TouchName = (string)primRow["TouchName"];
// permissions // permissions
prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]); prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]);
prim.CreatorID = new UUID((Guid)primRow["CreatorID"]); //prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
prim.CreatorIdentification = (string)primRow["CreatorID"];
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
prim.GroupID = new UUID((Guid)primRow["GroupID"]); prim.GroupID = new UUID((Guid)primRow["GroupID"]);
prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
@ -1691,7 +1707,8 @@ VALUES
taskItem.Name = (string)inventoryRow["name"]; taskItem.Name = (string)inventoryRow["name"];
taskItem.Description = (string)inventoryRow["description"]; taskItem.Description = (string)inventoryRow["description"];
taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]); taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]);
taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]); //taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
taskItem.CreatorIdentification = (string)inventoryRow["creatorID"];
taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]); taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]);
taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]); taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]);
taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]); taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]);
@ -1792,6 +1809,9 @@ VALUES
parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime)); parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime));
parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime)); parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime));
parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID)); parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID));
parameters.Add(_Database.CreateParameter("TerrainImageID", settings.TerrainImageID));
parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
return parameters.ToArray(); return parameters.ToArray();
} }
@ -1859,6 +1879,7 @@ VALUES
parameters.Add(_Database.CreateParameter("LandUUID", parcelID)); parameters.Add(_Database.CreateParameter("LandUUID", parcelID));
parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID)); parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID));
parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags)); parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags));
parameters.Add(_Database.CreateParameter("Expires", parcelAccessEntry.Expires));
return parameters.ToArray(); return parameters.ToArray();
} }
@ -2063,5 +2084,57 @@ VALUES
#endregion #endregion
#endregion #endregion
private void LoadSpawnPoints(RegionSettings rs)
{
rs.ClearSpawnPoints();
string sql = "SELECT Yaw, Pitch, Distance FROM spawn_points WHERE RegionUUID = @RegionUUID";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID.ToString()));
conn.Open();
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
SpawnPoint sp = new SpawnPoint();
sp.Yaw = (float)reader["Yaw"];
sp.Pitch = (float)reader["Pitch"];
sp.Distance = (float)reader["Distance"];
rs.AddSpawnPoint(sp);
}
}
}
}
private void SaveSpawnPoints(RegionSettings rs)
{
string sql = "DELETE FROM spawn_points WHERE RegionUUID = @RegionUUID";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
conn.Open();
cmd.ExecuteNonQuery();
}
foreach (SpawnPoint p in rs.SpawnPoints())
{
sql = "INSERT INTO spawn_points (RegionUUID, Yaw, Pitch, Distance) VALUES (@RegionUUID, @Yaw, @Pitch, @Distance)";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
cmd.Parameters.Add(_Database.CreateParameter("@Yaw", p.Yaw));
cmd.Parameters.Add(_Database.CreateParameter("@Pitch", p.Pitch));
cmd.Parameters.Add(_Database.CreateParameter("@Distance", p.Distance));
conn.Open();
cmd.ExecuteNonQuery();
}
}
}
} }
} }

View File

@ -1044,10 +1044,93 @@ ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL
COMMIT COMMIT
:VERSION 29 #--------------------- :VERSION 29 #----------------- Region Covenant changed time
BEGIN TRANSACTION BEGIN TRANSACTION
ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0 ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0
COMMIT COMMIT
:VERSION 30 #------------------Migrate creatorID storage to varchars instead of UUIDs for HG support
BEGIN TRANSACTION
EXECUTE sp_rename N'dbo.prims.creatorid', N'creatoridold', 'COLUMN'
EXECUTE sp_rename N'dbo.primitems.creatorid', N'creatoridold', 'COLUMN'
COMMIT
:VERSION 31 #---------------------
BEGIN TRANSACTION
ALTER TABLE prims ADD CreatorID varchar(255)
ALTER TABLE primitems ADD CreatorID varchar(255)
COMMIT
:VERSION 32 #---------------------
BEGIN TRANSACTION
UPDATE prims SET prims.CreatorID = CONVERT(varchar(255), creatoridold)
UPDATE primitems SET primitems.CreatorID = CONVERT(varchar(255), creatoridold)
COMMIT
:VERSION 33 #---------------------
BEGIN TRANSACTION
ALTER TABLE prims
ADD CONSTRAINT DF_prims_CreatorIDNew
DEFAULT '00000000-0000-0000-0000-000000000000'
FOR CreatorID
ALTER TABLE prims ALTER COLUMN CreatorID varchar(255) NOT NULL
ALTER TABLE primitems
ADD CONSTRAINT DF_primitems_CreatorIDNew
DEFAULT '00000000-0000-0000-0000-000000000000'
FOR CreatorID
ALTER TABLE primitems ALTER COLUMN CreatorID varchar(255) NOT NULL
COMMIT
:VERSION 34 #--------------- Telehub support
BEGIN TRANSACTION
CREATE TABLE [dbo].[Spawn_Points](
[RegionUUID] [uniqueidentifier] NOT NULL,
[Yaw] [float] NOT NULL,
[Pitch] [float] NOT NULL,
[Distance] [float] NOT NULL,
PRIMARY KEY CLUSTERED
(
[RegionUUID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
ALTER TABLE regionsettings ADD TelehubObject uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT
:VERSION 35 #---------------- Parcels for sale
BEGIN TRANSACTION
ALTER TABLE regionsettings ADD parcel_tile_ID uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT
:VERSION 36 #---------------- Timed bans/access
BEGIN TRANSACTION
ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0;
COMMIT

View File

@ -71,6 +71,7 @@ namespace OpenSim.Framework
bool IsEitherBannedOrRestricted(UUID avatar); bool IsEitherBannedOrRestricted(UUID avatar);
bool IsBannedFromLand(UUID avatar); bool IsBannedFromLand(UUID avatar);
bool IsRestrictedFromLand(UUID avatar); bool IsRestrictedFromLand(UUID avatar);
bool IsInLandAccessList(UUID avatar);
void SendLandUpdateToClient(IClientAPI remote_client); void SendLandUpdateToClient(IClientAPI remote_client);
void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag); List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag);

View File

@ -69,7 +69,7 @@ namespace OpenSim.Framework
(uint) ParcelFlags.AllowAPrimitiveEntry | (uint) ParcelFlags.AllowAPrimitiveEntry |
(uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform | (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform |
(uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts | (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts |
(uint) ParcelFlags.SoundLocal; (uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat;
private byte _landingType = 0; private byte _landingType = 0;
private string _name = "Your Parcel"; private string _name = "Your Parcel";

View File

@ -269,15 +269,19 @@ namespace OpenSim.Framework.Servers
t.Priority, t.Priority,
t.ThreadState); t.ThreadState);
sb.Append(Environment.NewLine); sb.Append("\n");
} }
int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0; sb.Append("\n");
ThreadPool.GetAvailableThreads(out workers, out ports);
ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts);
sb.Append(Environment.NewLine + "*** ThreadPool threads ***" + Environment.NewLine); // For some reason mono 2.6.7 returns an empty threads set! Not going to confuse people by reporting
sb.Append("workers: " + (maxWorkers - workers) + " (" + maxWorkers + "); ports: " + (maxPorts - ports) + " (" + maxPorts + ")" + Environment.NewLine); // zero active threads.
int totalThreads = Process.GetCurrentProcess().Threads.Count;
if (totalThreads > 0)
sb.AppendFormat("Total threads active: {0}\n\n", totalThreads);
sb.Append("Main threadpool (excluding script engine pools)\n");
sb.Append(Util.GetThreadPoolReport());
return sb.ToString(); return sb.ToString();
} }

View File

@ -29,8 +29,8 @@ namespace OpenSim
{ {
public class VersionInfo public class VersionInfo
{ {
private const string VERSION_NUMBER = "0.7.3"; private const string VERSION_NUMBER = "0.7.3.1";
private const Flavour VERSION_FLAVOUR = Flavour.Dev; private const Flavour VERSION_FLAVOUR = Flavour.Post_Fixes;
public enum Flavour public enum Flavour
{ {
@ -39,7 +39,8 @@ namespace OpenSim
RC1, RC1,
RC2, RC2,
Release, Release,
Post_Fixes Post_Fixes,
Extended
} }
public static string Version public static string Version

View File

@ -26,8 +26,8 @@
*/ */
using System; using System;
using System.Diagnostics;
using System.Text; using System.Text;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
@ -46,8 +46,12 @@ namespace OpenSim.Framework.Statistics
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append( sb.Append(
string.Format( string.Format(
"Allocated to OpenSim : {0} MB" + Environment.NewLine, "Allocated to OpenSim objects: {0} MB\n",
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0))); Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
sb.Append(
string.Format(
"Process memory : {0} MB\n",
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0)));
return sb.ToString(); return sb.ToString();
} }

View File

@ -81,12 +81,15 @@ namespace OpenSim.Framework
private static uint nextXferID = 5000; private static uint nextXferID = 5000;
private static Random randomClass = new Random(); private static Random randomClass = new Random();
// Get a list of invalid file characters (OS dependent) // Get a list of invalid file characters (OS dependent)
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]"; private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]"; private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
private static object XferLock = new object(); private static object XferLock = new object();
/// <summary>Thread pool used for Util.FireAndForget if
/// FireAndForgetMethod.SmartThreadPool is used</summary> /// <summary>
/// Thread pool used for Util.FireAndForget if FireAndForgetMethod.SmartThreadPool is used
/// </summary>
private static SmartThreadPool m_ThreadPool; private static SmartThreadPool m_ThreadPool;
// Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC. // Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC.
@ -144,7 +147,6 @@ namespace OpenSim.Framework
return lerp(y, lerp(x, a, b), lerp(x, c, d)); return lerp(y, lerp(x, a, b), lerp(x, c, d));
} }
public static Encoding UTF8 = Encoding.UTF8; public static Encoding UTF8 = Encoding.UTF8;
/// <value> /// <value>
@ -1671,6 +1673,61 @@ namespace OpenSim.Framework
} }
} }
/// <summary>
/// Get a thread pool report.
/// </summary>
/// <returns></returns>
public static string GetThreadPoolReport()
{
string threadPoolUsed = null;
int maxThreads = 0;
int minThreads = 0;
int allocatedThreads = 0;
int inUseThreads = 0;
int waitingCallbacks = 0;
int completionPortThreads = 0;
StringBuilder sb = new StringBuilder();
if (FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
{
threadPoolUsed = "SmartThreadPool";
maxThreads = m_ThreadPool.MaxThreads;
minThreads = m_ThreadPool.MinThreads;
inUseThreads = m_ThreadPool.InUseThreads;
allocatedThreads = m_ThreadPool.ActiveThreads;
waitingCallbacks = m_ThreadPool.WaitingCallbacks;
}
else if (
FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem
|| FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem)
{
threadPoolUsed = "BuiltInThreadPool";
ThreadPool.GetMaxThreads(out maxThreads, out completionPortThreads);
ThreadPool.GetMinThreads(out minThreads, out completionPortThreads);
int availableThreads;
ThreadPool.GetAvailableThreads(out availableThreads, out completionPortThreads);
inUseThreads = maxThreads - availableThreads;
allocatedThreads = -1;
waitingCallbacks = -1;
}
if (threadPoolUsed != null)
{
sb.AppendFormat("Thread pool used : {0}\n", threadPoolUsed);
sb.AppendFormat("Max threads : {0}\n", maxThreads);
sb.AppendFormat("Min threads : {0}\n", minThreads);
sb.AppendFormat("Allocated threads : {0}\n", allocatedThreads < 0 ? "not applicable" : allocatedThreads.ToString());
sb.AppendFormat("In use threads : {0}\n", inUseThreads);
sb.AppendFormat("Work items waiting : {0}\n", waitingCallbacks < 0 ? "not available" : waitingCallbacks.ToString());
}
else
{
sb.AppendFormat("Thread pool not used\n");
}
return sb.ToString();
}
private static object SmartThreadPoolCallback(object o) private static object SmartThreadPoolCallback(object o)
{ {
object[] array = (object[])o; object[] array = (object[])o;

View File

@ -124,15 +124,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
this, "save iar", this, "save iar",
"save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]", "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]",
"Save user inventory archive (IAR).", "Save user inventory archive (IAR).",
"<first> is the user's first name." + Environment.NewLine "<first> is the user's first name.\n"
+ "<last> is the user's last name." + Environment.NewLine + "<last> is the user's last name.\n"
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine + "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n"
+ "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
+ "-c|--creators preserves information about foreign creators." + Environment.NewLine
+ "-v|--verbose extra debug messages." + Environment.NewLine
+ "--noassets stops assets being saved to the IAR."
+ "<IAR path> is the filesystem path at which to save the IAR." + "<IAR path> is the filesystem path at which to save the IAR."
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), + string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME)
+ "-h|--home=<url> adds the url of the profile service to the saved user information.\n"
+ "-c|--creators preserves information about foreign creators.\n"
+ "-v|--verbose extra debug messages.\n"
+ "--noassets stops assets being saved to the IAR.",
HandleSaveInvConsoleCommand); HandleSaveInvConsoleCommand);
m_aScene = scene; m_aScene = scene;

View File

@ -150,7 +150,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
string skillsText = String.Empty; string skillsText = String.Empty;
string languages = String.Empty; string languages = String.Empty;
Byte[] charterMember = Utils.StringToBytes("Avatar"); UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID);
string name = "Avatar";
int created = 0;
if (account != null)
{
name = account.FirstName + " " + account.LastName;
created = account.Created;
}
Byte[] charterMember = Utils.StringToBytes(name);
profileUrl = "No profile data"; profileUrl = "No profile data";
aboutText = string.Empty; aboutText = string.Empty;
@ -160,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
partner = UUID.Zero; partner = UUID.Zero;
remoteClient.SendAvatarProperties(avatarID, aboutText, remoteClient.SendAvatarProperties(avatarID, aboutText,
Util.ToDateTime(0).ToString( Util.ToDateTime(created).ToString(
"M/d/yyyy", CultureInfo.InvariantCulture), "M/d/yyyy", CultureInfo.InvariantCulture),
charterMember, firstLifeAboutText, charterMember, firstLifeAboutText,
(uint)(0 & 0xff), (uint)(0 & 0xff),

View File

@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
string userAssetServer = string.Empty; string userAssetServer = string.Empty;
if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
{ {
Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); m_assMapper.Post(assetID, avatarID, userAssetServer);
} }
} }

View File

@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
#region IWorldComm Members #region IWorldComm Members
public int ListenerCount
{
get
{
return m_listenerManager.ListenerCount;
}
}
/// <summary> /// <summary>
/// Create a listen event callback with the specified filters. /// Create a listen event callback with the specified filters.
/// The parameters localID,itemID are needed to uniquely identify /// The parameters localID,itemID are needed to uniquely identify
@ -438,6 +446,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
private int m_maxhandles; private int m_maxhandles;
private int m_curlisteners; private int m_curlisteners;
/// <summary>
/// Total number of listeners
/// </summary>
public int ListenerCount
{
get
{
lock (m_listeners)
return m_listeners.Count;
}
}
public ListenerManager(int maxlisteners, int maxhandles) public ListenerManager(int maxlisteners, int maxhandles)
{ {
m_maxlisteners = maxlisteners; m_maxlisteners = maxlisteners;

View File

@ -0,0 +1,124 @@
/*
* 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 Nini.Config;
using log4net;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenMetaverse;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
{
public class AuthorizationService : IAuthorizationService
{
private enum AccessFlags
{
None = 0, /* No restrictions */
DisallowResidents = 1, /* Only gods and managers*/
DisallowForeigners = 2, /* Only local people */
}
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private IUserManagement m_UserManagement;
private IGridService m_GridService;
private Scene m_Scene;
AccessFlags m_accessValue = AccessFlags.None;
public AuthorizationService(IConfig config, Scene scene)
{
m_Scene = scene;
m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
m_GridService = scene.GridService;
if (config != null)
{
string accessStr = config.GetString("Region_" + scene.RegionInfo.RegionName.Replace(' ', '_'), String.Empty);
if (accessStr != string.Empty)
{
try
{
m_accessValue = (AccessFlags)Enum.Parse(typeof(AccessFlags), accessStr);
}
catch (ArgumentException)
{
m_log.WarnFormat("[AuthorizationService]: {0} is not a valid access flag", accessStr);
}
}
m_log.DebugFormat("[AuthorizationService]: Region {0} access restrictions: {1}", m_Scene.RegionInfo.RegionName, m_accessValue);
}
}
public bool IsAuthorizedForRegion(
string user, string firstName, string lastName, string regionID, out string message)
{
message = "authorized";
// This should not happen
if (m_Scene.RegionInfo.RegionID.ToString() != regionID)
{
m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}",
m_Scene.RegionInfo.RegionID, regionID);
return true;
}
if (m_accessValue == AccessFlags.None)
return true;
UUID userID = new UUID(user);
bool authorized = true;
if ((m_accessValue & AccessFlags.DisallowForeigners) == AccessFlags.DisallowForeigners)
{
authorized = m_UserManagement.IsLocalGridUser(userID);
if (!authorized)
message = "no foreigner users allowed in this region";
}
if (authorized && (m_accessValue & AccessFlags.DisallowResidents) == AccessFlags.DisallowResidents)
{
authorized = m_Scene.Permissions.IsGod(userID) | m_Scene.Permissions.IsAdministrator(userID);
if (!authorized)
message = "only Admins and Managers allowed in this region";
}
return authorized;
}
}
}

View File

@ -39,13 +39,15 @@ using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
{ {
public class LocalAuthorizationServicesConnector : ISharedRegionModule, IAuthorizationService public class LocalAuthorizationServicesConnector : INonSharedRegionModule, IAuthorizationService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private IAuthorizationService m_AuthorizationService; private IAuthorizationService m_AuthorizationService;
private Scene m_Scene;
private IConfig m_AuthorizationConfig;
private bool m_Enabled = false; private bool m_Enabled = false;
@ -69,33 +71,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
string name = moduleConfig.GetString("AuthorizationServices", string.Empty); string name = moduleConfig.GetString("AuthorizationServices", string.Empty);
if (name == Name) if (name == Name)
{ {
IConfig authorizationConfig = source.Configs["AuthorizationService"];
if (authorizationConfig == null)
{
m_log.Error("[AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini");
return;
}
string serviceDll = authorizationConfig.GetString("LocalServiceModule",
String.Empty);
if (serviceDll == String.Empty)
{
m_log.Error("[AUTHORIZATION CONNECTOR]: No LocalServiceModule named in section AuthorizationService");
return;
}
Object[] args = new Object[] { source };
m_AuthorizationService =
ServerUtils.LoadPlugin<IAuthorizationService>(serviceDll,
args);
if (m_AuthorizationService == null)
{
m_log.Error("[AUTHORIZATION CONNECTOR]: Can't load authorization service");
return;
}
m_Enabled = true; m_Enabled = true;
m_AuthorizationConfig = source.Configs["AuthorizationService"];
m_log.Info("[AUTHORIZATION CONNECTOR]: Local authorization connector enabled"); m_log.Info("[AUTHORIZATION CONNECTOR]: Local authorization connector enabled");
} }
} }
@ -115,6 +92,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
return; return;
scene.RegisterModuleInterface<IAuthorizationService>(this); scene.RegisterModuleInterface<IAuthorizationService>(this);
m_Scene = scene;
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
@ -126,6 +104,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
if (!m_Enabled) if (!m_Enabled)
return; return;
m_AuthorizationService = new AuthorizationService(m_AuthorizationConfig, m_Scene);
m_log.InfoFormat( m_log.InfoFormat(
"[AUTHORIZATION CONNECTOR]: Enabled local authorization for region {0}", "[AUTHORIZATION CONNECTOR]: Enabled local authorization for region {0}",
scene.RegionInfo.RegionName); scene.RegionInfo.RegionName);
@ -134,6 +114,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
public bool IsAuthorizedForRegion( public bool IsAuthorizedForRegion(
string userID, string firstName, string lastName, string regionID, out string message) string userID, string firstName, string lastName, string regionID, out string message)
{ {
message = "";
if (!m_Enabled)
return true;
return m_AuthorizationService.IsAuthorizedForRegion(userID, firstName, lastName, regionID, out message); return m_AuthorizationService.IsAuthorizedForRegion(userID, firstName, lastName, regionID, out message);
} }
} }

View File

@ -26,8 +26,10 @@
*/ */
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Security; using System.Security;
using log4net; using log4net;
@ -45,8 +47,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private delegate void LookupUUIDS(List<UUID> uuidLst);
public Scene Scene { get; private set; } public Scene Scene { get; private set; }
public IUserManagement UserManager { get; private set; } public IUserManagement UserManager { get; private set; }
@ -876,38 +876,55 @@ namespace OpenSim.Region.CoreModules.World.Estate
if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false))
return; return;
Dictionary<uint, float> SceneData = new Dictionary<uint,float>(); Dictionary<uint, float> sceneData = null;
List<UUID> uuidNameLookupList = new List<UUID>(); List<UUID> uuidNameLookupList = new List<UUID>();
if (reportType == 1) if (reportType == 1)
{ {
SceneData = Scene.PhysicsScene.GetTopColliders(); sceneData = Scene.PhysicsScene.GetTopColliders();
} }
else if (reportType == 0) else if (reportType == 0)
{ {
SceneData = Scene.SceneGraph.GetTopScripts(); IScriptModule scriptModule = Scene.RequestModuleInterface<IScriptModule>();
if (scriptModule != null)
sceneData = scriptModule.GetObjectScriptsExecutionTimes();
} }
List<LandStatReportItem> SceneReport = new List<LandStatReportItem>(); List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
lock (SceneData) if (sceneData != null)
{ {
foreach (uint obj in SceneData.Keys) var sortedSceneData
= sceneData.Select(
item => new { Measurement = item.Value, Part = Scene.GetSceneObjectPart(item.Key) });
sortedSceneData.OrderBy(item => item.Measurement);
int items = 0;
foreach (var entry in sortedSceneData)
{ {
SceneObjectPart prt = Scene.GetSceneObjectPart(obj); // The object may have been deleted since we received the data.
if (prt != null) if (entry.Part == null)
{ continue;
SceneObjectGroup sog = prt.ParentGroup;
// Don't show scripts that haven't executed or where execution time is below one microsecond in
// order to produce a more readable report.
if (entry.Measurement < 0.001)
continue;
items++;
SceneObjectGroup so = entry.Part.ParentGroup;
LandStatReportItem lsri = new LandStatReportItem(); LandStatReportItem lsri = new LandStatReportItem();
lsri.LocationX = sog.AbsolutePosition.X; lsri.LocationX = so.AbsolutePosition.X;
lsri.LocationY = sog.AbsolutePosition.Y; lsri.LocationY = so.AbsolutePosition.Y;
lsri.LocationZ = sog.AbsolutePosition.Z; lsri.LocationZ = so.AbsolutePosition.Z;
lsri.Score = SceneData[obj]; lsri.Score = entry.Measurement;
lsri.TaskID = sog.UUID; lsri.TaskID = so.UUID;
lsri.TaskLocalID = sog.LocalId; lsri.TaskLocalID = so.LocalId;
lsri.TaskName = sog.GetPartName(obj); lsri.TaskName = entry.Part.Name;
lsri.OwnerName = "waiting"; lsri.OwnerName = UserManager.GetUserName(so.OwnerID);
lock (uuidNameLookupList)
uuidNameLookupList.Add(sog.OwnerID);
if (filter.Length != 0) if (filter.Length != 0)
{ {
@ -921,53 +938,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
} }
SceneReport.Add(lsri); SceneReport.Add(lsri);
}
if (items >= 100)
break;
} }
} }
remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
if (uuidNameLookupList.Count > 0)
LookupUUID(uuidNameLookupList);
} }
private static void LookupUUIDSCompleted(IAsyncResult iar)
{
LookupUUIDS icon = (LookupUUIDS)iar.AsyncState;
icon.EndInvoke(iar);
}
private void LookupUUID(List<UUID> uuidLst)
{
LookupUUIDS d = LookupUUIDsAsync;
d.BeginInvoke(uuidLst,
LookupUUIDSCompleted,
d);
}
private void LookupUUIDsAsync(List<UUID> uuidLst)
{
UUID[] uuidarr;
lock (uuidLst)
{
uuidarr = uuidLst.ToArray();
}
for (int i = 0; i < uuidarr.Length; i++)
{
// string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>();
if (userManager != null)
userManager.GetUserName(uuidarr[i]);
// we drop it. It gets cached though... so we're ready for the next request.
// diva commnent 11/21/2010: uh?!? wft?
// justincc comment 21/01/2011: A side effect of userManager.GetUserName() I presume.
}
}
#endregion #endregion
#region Outgoing Packets #region Outgoing Packets

View File

@ -448,8 +448,6 @@ namespace OpenSim.Region.CoreModules.World.Land
public bool IsRestrictedFromLand(UUID avatar) public bool IsRestrictedFromLand(UUID avatar)
{ {
ExpireAccessList();
if (m_scene.Permissions.IsAdministrator(avatar)) if (m_scene.Permissions.IsAdministrator(avatar))
return false; return false;
@ -459,8 +457,16 @@ namespace OpenSim.Region.CoreModules.World.Land
if (avatar == LandData.OwnerID) if (avatar == LandData.OwnerID)
return false; return false;
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0)
return false;
return (!IsInLandAccessList(avatar));
}
public bool IsInLandAccessList(UUID avatar)
{ {
ExpireAccessList();
if (LandData.ParcelAccessList.FindIndex( if (LandData.ParcelAccessList.FindIndex(
delegate(LandAccessEntry e) delegate(LandAccessEntry e)
{ {
@ -469,11 +475,10 @@ namespace OpenSim.Region.CoreModules.World.Land
return false; return false;
}) == -1) }) == -1)
{ {
return true;
}
}
return false; return false;
} }
return true;
}
public void SendLandUpdateToClient(IClientAPI remote_client) public void SendLandUpdateToClient(IClientAPI remote_client)
{ {

View File

@ -95,6 +95,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private bool m_RegionManagerIsGod = false; private bool m_RegionManagerIsGod = false;
private bool m_ParcelOwnerIsGod = false; private bool m_ParcelOwnerIsGod = false;
private bool m_SimpleBuildPermissions = false;
/// <value> /// <value>
/// The set of users that are allowed to create scripts. This is only active if permissions are not being /// The set of users that are allowed to create scripts. This is only active if permissions are not being
/// bypassed. This overrides normal permissions. /// bypassed. This overrides normal permissions.
@ -140,6 +142,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false);
m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true);
m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false);
m_allowedScriptCreators m_allowedScriptCreators
= ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators);
m_allowedScriptEditors m_allowedScriptEditors
@ -824,6 +828,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
permission = true; permission = true;
} }
if (m_SimpleBuildPermissions &&
(parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user))
permission = true;
return permission; return permission;
} }

View File

@ -86,6 +86,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
private volatile bool m_tainted; private volatile bool m_tainted;
private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
private String m_InitialTerrain = "pinhead-island";
/// <summary> /// <summary>
/// Human readable list of terrain file extensions that are supported. /// Human readable list of terrain file extensions that are supported.
/// </summary> /// </summary>
@ -109,6 +111,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
/// <param name="config">Config for the region</param> /// <param name="config">Config for the region</param>
public void Initialise(IConfigSource config) public void Initialise(IConfigSource config)
{ {
IConfig terrainConfig = config.Configs["Terrain"];
if (terrainConfig != null)
m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain);
} }
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
@ -120,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
{ {
if (m_scene.Heightmap == null) if (m_scene.Heightmap == null)
{ {
m_channel = new TerrainChannel(); m_channel = new TerrainChannel(m_InitialTerrain);
m_scene.Heightmap = m_channel; m_scene.Heightmap = m_channel;
m_revert = new TerrainChannel(); m_revert = new TerrainChannel();
UpdateRevertMap(); UpdateRevertMap();
@ -593,6 +598,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
"[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
} }
// else
// {
// m_log.ErrorFormat(
// "[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}",
// m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY);
// }
} }
/// <summary> /// <summary>

View File

@ -94,6 +94,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
//m_log.DebugFormat("MAP NAME=({0})", mapName); //m_log.DebugFormat("MAP NAME=({0})", mapName);
// Hack to get around the fact that ll V3 now drops the port from the
// map name. See https://jira.secondlife.com/browse/VWR-28570
//
// Caller, use this magic form instead:
// secondlife://http|!!mygrid.com|8002|Region+Name/128/128
// or url encode if possible.
// the hacks we do with this viewer...
//
string mapNameOrig = mapName;
if (mapName.Contains("|"))
mapName = mapName.Replace('|', ':');
if (mapName.Contains("+"))
mapName = mapName.Replace('+', ' ');
if (mapName.Contains("!"))
mapName = mapName.Replace('!', '/');
// try to fetch from GridServer // try to fetch from GridServer
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
if (regionInfos.Count == 0) if (regionInfos.Count == 0)
@ -114,6 +130,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
data.MapImageId = UUID.Zero; data.MapImageId = UUID.Zero;
else else
data.MapImageId = info.TerrainImage; data.MapImageId = info.TerrainImage;
// ugh! V2-3 is very sensitive about the result being
// exactly the same as the requested name
if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+"))
data.Name = mapNameOrig;
else
data.Name = info.RegionName; data.Name = info.RegionName;
data.RegionFlags = 0; // TODO not used? data.RegionFlags = 0; // TODO not used?
data.WaterHeight = 0; // not used data.WaterHeight = 0; // not used
@ -138,6 +159,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// flags are agent flags sent from the viewer. // flags are agent flags sent from the viewer.
// they have different values depending on different viewers, apparently // they have different values depending on different viewers, apparently
remoteClient.SendMapBlock(blocks, flags); remoteClient.SendMapBlock(blocks, flags);
// send extra user messages for V3
// because the UI is very confusing
// while we don't fix the hard-coded urls
if (flags == 2)
{
if (regionInfos.Count == 0)
remoteClient.SendAgentAlertMessage("No regions found with that name.", true);
else if (regionInfos.Count == 1)
remoteClient.SendAgentAlertMessage("Region found!", false);
}
} }
// private Scene GetClientScene(IClientAPI client) // private Scene GetClientScene(IClientAPI client)

View File

@ -46,8 +46,6 @@ namespace OpenSim.Region.DataSnapshot
private DataSnapshotManager m_externalData = null; private DataSnapshotManager m_externalData = null;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly string m_discoveryPath = "DS0001/";
public DataRequestHandler(Scene scene, DataSnapshotManager externalData) public DataRequestHandler(Scene scene, DataSnapshotManager externalData)
{ {
m_scene = scene; m_scene = scene;
@ -58,37 +56,9 @@ namespace OpenSim.Region.DataSnapshot
{ {
m_log.Info("[DATASNAPSHOT]: Set up snapshot service"); m_log.Info("[DATASNAPSHOT]: Set up snapshot service");
} }
// Register validation callback handler
MainServer.Instance.AddHTTPHandler("validate", OnValidate);
//Register CAPS handler event
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
//harbl
}
public void OnRegisterCaps(UUID agentID, Caps caps)
{
// m_log.InfoFormat("[DATASNAPSHOT]: Registering service discovery capability for {0}", agentID);
string capsBase = "/CAPS/" + caps.CapsObjectPath;
caps.RegisterHandler("PublicSnapshotDataInfo",
new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt));
}
public string OnDiscoveryAttempt(string request, string path, string param,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
//Very static for now, flexible enough to add new formats
LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse();
llsd_response.snapshot_resources = new OSDArray();
LLSDDiscoveryDataURL llsd_dataurl = new LLSDDiscoveryDataURL();
llsd_dataurl.snapshot_format = "os-datasnapshot-v1";
llsd_dataurl.snapshot_url = "http://" + m_externalData.m_hostname + ":" + m_externalData.m_listener_port + "/?method=collector";
llsd_response.snapshot_resources.Array.Add(llsd_dataurl);
string response = LLSDHelpers.SerialiseLLSDReply(llsd_response);
return response;
} }
public Hashtable OnGetSnapshot(Hashtable keysvals) public Hashtable OnGetSnapshot(Hashtable keysvals)
@ -107,5 +77,23 @@ namespace OpenSim.Region.DataSnapshot
return reply; return reply;
} }
public Hashtable OnValidate(Hashtable keysvals)
{
m_log.Info("[DATASNAPSHOT] Received validation request");
Hashtable reply = new Hashtable();
int statuscode = 200;
string secret = (string)keysvals["secret"];
if (secret == m_externalData.Secret.ToString())
statuscode = 403;
reply["str_response_string"] = string.Empty;
reply["int_response_code"] = statuscode;
reply["content_type"] = "text/plain";
return reply;
}
} }
} }

View File

@ -66,6 +66,7 @@ namespace OpenSim.Region.DataSnapshot
private string m_dataServices = "noservices"; private string m_dataServices = "noservices";
public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString(); public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString();
public string m_hostname = "127.0.0.1"; public string m_hostname = "127.0.0.1";
private UUID m_Secret = UUID.Random();
//Update timers //Update timers
private int m_period = 20; // in seconds private int m_period = 20; // in seconds
@ -85,6 +86,11 @@ namespace OpenSim.Region.DataSnapshot
get { return m_exposure_level; } get { return m_exposure_level; }
} }
public UUID Secret
{
get { return m_Secret; }
}
#endregion #endregion
#region IRegionModule #region IRegionModule
@ -103,10 +109,10 @@ namespace OpenSim.Region.DataSnapshot
m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled); m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled);
IConfig conf = config.Configs["GridService"]; IConfig conf = config.Configs["GridService"];
if (conf != null) if (conf != null)
m_gridinfo.Add("gridserverURL", conf.GetString("GridServerURI", "http://127.0.0.1:8003")); m_gridinfo.Add("gatekeeperURL", conf.GetString("Gatekeeper", String.Empty));
m_gridinfo.Add( m_gridinfo.Add(
"Name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo")); "name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo"));
m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level); m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level);
m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period); m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period);
m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales); m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales);
@ -315,6 +321,7 @@ namespace OpenSim.Region.DataSnapshot
cli.AddQueryParameter("service", serviceName); cli.AddQueryParameter("service", serviceName);
cli.AddQueryParameter("host", m_hostname); cli.AddQueryParameter("host", m_hostname);
cli.AddQueryParameter("port", m_listener_port); cli.AddQueryParameter("port", m_listener_port);
cli.AddQueryParameter("secret", m_Secret.ToString());
cli.RequestMethod = "GET"; cli.RequestMethod = "GET";
try try
{ {
@ -341,7 +348,7 @@ namespace OpenSim.Region.DataSnapshot
} }
// This is not quite working, so... // This is not quite working, so...
// string responseStr = Util.UTF8.GetString(response); // string responseStr = Util.UTF8.GetString(response);
m_log.Info("[DATASNAPSHOT]: data service notified: " + url); m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret);
} }
} }

View File

@ -154,6 +154,15 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns>null if the item does not exist</returns> /// <returns>null if the item does not exist</returns>
TaskInventoryItem GetInventoryItem(UUID itemId); TaskInventoryItem GetInventoryItem(UUID itemId);
/// <summary>
/// Get all inventory items.
/// </summary>
/// <param name="name"></param>
/// <returns>
/// If there are no inventory items then an empty list is returned.
/// </returns>
List<TaskInventoryItem> GetInventoryItems();
/// <summary> /// <summary>
/// Get inventory items by name. /// Get inventory items by name.
/// </summary> /// </summary>
@ -162,7 +171,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// A list of inventory items with that name. /// A list of inventory items with that name.
/// If no inventory item has that name then an empty list is returned. /// If no inventory item has that name then an empty list is returned.
/// </returns> /// </returns>
IList<TaskInventoryItem> GetInventoryItems(string name); List<TaskInventoryItem> GetInventoryItems(string name);
/// <summary> /// <summary>
/// Get the scene object referenced by an inventory item. /// Get the scene object referenced by an inventory item.

View File

@ -27,6 +27,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
@ -74,5 +75,14 @@ namespace OpenSim.Region.Framework.Interfaces
/// Starts the processing threads. /// Starts the processing threads.
/// </summary> /// </summary>
void StartProcessing(); void StartProcessing();
/// <summary>
/// Get the execution times of all scripts in each object.
/// </summary>
/// <returns>
/// A dictionary where the key is the root object ID of a linkset
/// and the value is a representative execution time in milliseconds of all scripts in that linkset.
/// </returns>
Dictionary<uint, float> GetObjectScriptsExecutionTimes();
} }
} }

View File

@ -49,6 +49,11 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IWorldComm public interface IWorldComm
{ {
/// <summary>
/// Total number of listeners
/// </summary>
int ListenerCount { get; }
/// <summary> /// <summary>
/// Create a listen event callback with the specified filters. /// Create a listen event callback with the specified filters.
/// The parameters localID,itemID are needed to uniquely identify /// The parameters localID,itemID are needed to uniquely identify

View File

@ -68,9 +68,11 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void OnNewClientDelegate(IClientAPI client); public delegate void OnNewClientDelegate(IClientAPI client);
/// <summary> /// <summary>
/// Deprecated in favour of OnClientConnect. /// Triggered when a new client is added to the scene.
/// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces.
/// </summary> /// </summary>
/// <remarks>
/// Triggered before OnClientLogin.
/// </remarks>
public event OnNewClientDelegate OnNewClient; public event OnNewClientDelegate OnNewClient;
/// <summary> /// <summary>
@ -138,8 +140,11 @@ namespace OpenSim.Region.Framework.Scenes
public event OnPermissionErrorDelegate OnPermissionError; public event OnPermissionErrorDelegate OnPermissionError;
/// <summary> /// <summary>
/// Fired when a new script is created. /// Fired when a script is run.
/// </summary> /// </summary>
/// <remarks>
/// Occurs after OnNewScript.
/// </remarks>
public event NewRezScript OnRezScript; public event NewRezScript OnRezScript;
public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
@ -185,12 +190,24 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void ClientClosed(UUID clientID, Scene scene); public delegate void ClientClosed(UUID clientID, Scene scene);
/// <summary>
/// Fired when a client is removed from a scene.
/// </summary>
/// <remarks>
/// At the point of firing, the scene still contains the client's scene presence.
/// </remarks>
public event ClientClosed OnClientClosed; public event ClientClosed OnClientClosed;
// Fired when a script is created
// The indication that a new script exists in this region.
public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
/// <summary>
/// Fired when a script is created.
/// </summary>
/// <remarks>
/// Occurs before OnRezScript
/// </remarks>
public event NewScript OnNewScript; public event NewScript OnNewScript;
public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
{ {
NewScript handlerNewScript = OnNewScript; NewScript handlerNewScript = OnNewScript;
@ -212,10 +229,16 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
//TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset
// An indication that the script has changed.
public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID); public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
/// <summary>
/// An indication that the script has changed.
/// </summary>
/// <remarks>
/// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset.
/// </remarks>
public event UpdateScript OnUpdateScript; public event UpdateScript OnUpdateScript;
public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID) public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
{ {
UpdateScript handlerUpdateScript = OnUpdateScript; UpdateScript handlerUpdateScript = OnUpdateScript;
@ -466,6 +489,13 @@ namespace OpenSim.Region.Framework.Scenes
public event RegionHeartbeatEnd OnRegionHeartbeatEnd; public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
public delegate void LoginsEnabled(string regionName); public delegate void LoginsEnabled(string regionName);
/// <summary>
/// This should only fire in all circumstances if the RegionReady module is active.
/// </summary>
/// <remarks>
/// TODO: Fire this even when the RegionReady module is not active.
/// </remarks>
public event LoginsEnabled OnLoginsEnabled; public event LoginsEnabled OnLoginsEnabled;
public delegate void PrimsLoaded(Scene s); public delegate void PrimsLoaded(Scene s);

View File

@ -1210,9 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Copy a task (prim) inventory item to another task (prim) /// Copy a task (prim) inventory item to another task (prim)
/// </summary> /// </summary>
/// <param name="destId"></param> /// <param name="destId">ID of destination part</param>
/// <param name="part"></param> /// <param name="part">Source part</param>
/// <param name="itemId"></param> /// <param name="itemId">Source item id to transfer</param>
public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId) public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId)
{ {
TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId); TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId);
@ -1238,24 +1238,21 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
// Can't transfer this if (part.OwnerID != destPart.OwnerID)
// {
if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) // Source must have transfer permissions
if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
return; return;
if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) // Object cannot copy items to an object owned by a different owner
{ // unless llAllowInventoryDrop has been called on the destination
// object cannot copy items to an object owned by a different owner if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
// unless llAllowInventoryDrop has been called
return; return;
} }
// must have both move and modify permission to put an item in an object // must have both move and modify permission to put an item in an object
if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0)
{
return; return;
}
TaskInventoryItem destTaskItem = new TaskInventoryItem(); TaskInventoryItem destTaskItem = new TaskInventoryItem();

View File

@ -220,8 +220,6 @@ namespace OpenSim.Region.Framework.Scenes
private int m_lastUpdate; private int m_lastUpdate;
private bool m_firstHeartbeat = true; private bool m_firstHeartbeat = true;
private object m_deleting_scene_object = new object();
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
private bool m_reprioritizationEnabled = true; private bool m_reprioritizationEnabled = true;
private double m_reprioritizationInterval = 5000.0; private double m_reprioritizationInterval = 5000.0;
@ -1583,8 +1581,15 @@ namespace OpenSim.Region.Framework.Scenes
double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID); double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
if (map == null) if (map == null)
{ {
m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); // This should be in the Terrain module, but it isn't because
Heightmap = new TerrainChannel(); // the heightmap is needed _way_ before the modules are initialized...
IConfig terrainConfig = m_config.Configs["Terrain"];
String m_InitialTerrain = "pinhead-island";
if (terrainConfig != null)
m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain);
m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain);
Heightmap = new TerrainChannel(m_InitialTerrain);
SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
} }
@ -2000,14 +2005,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
//SceneObjectPart rootPart = group.GetChildPart(group.UUID);
// Serialise calls to RemoveScriptInstances to avoid
// deadlocking on m_parts inside SceneObjectGroup
lock (m_deleting_scene_object)
{
group.RemoveScriptInstances(true); group.RemoveScriptInstances(true);
}
SceneObjectPart[] partList = group.Parts; SceneObjectPart[] partList = group.Parts;
@ -3540,8 +3538,8 @@ namespace OpenSim.Region.Framework.Scenes
if (!AuthorizationService.IsAuthorizedForRegion( if (!AuthorizationService.IsAuthorizedForRegion(
agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
{ {
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}",
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason);
return false; return false;
} }

View File

@ -156,6 +156,7 @@ namespace OpenSim.Region.Framework.Scenes
// that the region position is cached or performance will degrade // that the region position is cached or performance will degrade
Utils.LongToUInts(regionHandle, out x, out y); Utils.LongToUInts(regionHandle, out x, out y);
GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
// bool v = true; // bool v = true;
if (!simulatorList.Contains(dest.ServerURI)) if (!simulatorList.Contains(dest.ServerURI))
{ {

View File

@ -751,6 +751,7 @@ namespace OpenSim.Region.Framework.Scenes
#endregion #endregion
#region Get Methods #region Get Methods
/// <summary> /// <summary>
/// Get the controlling client for the given avatar, if there is one. /// Get the controlling client for the given avatar, if there is one.
/// ///
@ -1092,36 +1093,6 @@ namespace OpenSim.Region.Framework.Scenes
return Entities.GetEntities(); return Entities.GetEntities();
} }
public Dictionary<uint, float> GetTopScripts()
{
Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
EntityBase[] EntityList = GetEntities();
int limit = 0;
foreach (EntityBase ent in EntityList)
{
if (ent is SceneObjectGroup)
{
SceneObjectGroup grp = (SceneObjectGroup)ent;
if ((grp.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
{
if (grp.scriptScore >= 0.01)
{
topScripts.Add(grp.LocalId, grp.scriptScore);
limit++;
if (limit >= 100)
{
break;
}
}
grp.scriptScore = 0;
}
}
}
return topScripts;
}
#endregion #endregion
#region Other Methods #region Other Methods

View File

@ -229,8 +229,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return RootPart.VolumeDetectActive; } get { return RootPart.VolumeDetectActive; }
} }
public float scriptScore;
private Vector3 lastPhysGroupPos; private Vector3 lastPhysGroupPos;
private Quaternion lastPhysGroupRot; private Quaternion lastPhysGroupRot;
@ -1184,12 +1182,7 @@ namespace OpenSim.Region.Framework.Scenes
public void AddScriptLPS(int count) public void AddScriptLPS(int count)
{ {
if (scriptScore + count >= float.MaxValue - count) m_scene.SceneGraph.AddToScriptLPS(count);
scriptScore = 0;
scriptScore += (float)count;
SceneGraph d = m_scene.SceneGraph;
d.AddToScriptLPS(count);
} }
public void AddActiveScriptCount(int count) public void AddActiveScriptCount(int count)

View File

@ -590,9 +590,9 @@ namespace OpenSim.Region.Framework.Scenes
/// A list of inventory items with that name. /// A list of inventory items with that name.
/// If no inventory item has that name then an empty list is returned. /// If no inventory item has that name then an empty list is returned.
/// </returns> /// </returns>
public IList<TaskInventoryItem> GetInventoryItems(string name) public List<TaskInventoryItem> GetInventoryItems(string name)
{ {
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(); List<TaskInventoryItem> items = new List<TaskInventoryItem>();
lock (m_items) lock (m_items)
{ {

View File

@ -178,7 +178,7 @@ namespace OpenSim.Region.Framework.Scenes
m_objectCapacity = scene.RegionInfo.ObjectCapacity; m_objectCapacity = scene.RegionInfo.ObjectCapacity;
m_report.AutoReset = true; m_report.AutoReset = true;
m_report.Interval = statsUpdatesEveryMS; m_report.Interval = statsUpdatesEveryMS;
m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); m_report.Elapsed += statsHeartBeat;
m_report.Enabled = true; m_report.Enabled = true;
if (StatsManager.SimExtraStats != null) if (StatsManager.SimExtraStats != null)

View File

@ -48,21 +48,18 @@ namespace OpenSim.Region.Framework.Scenes
map = new double[Constants.RegionSize, Constants.RegionSize]; map = new double[Constants.RegionSize, Constants.RegionSize];
taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16]; taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16];
int x; PinHeadIsland();
for (x = 0; x < Constants.RegionSize; x++)
{
int y;
for (y = 0; y < Constants.RegionSize; y++)
{
map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
double spherFacA = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 50) * 0.01;
double spherFacB = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 100) * 0.001;
if (map[x, y] < spherFacA)
map[x, y] = spherFacA;
if (map[x, y] < spherFacB)
map[x, y] = spherFacB;
}
} }
public TerrainChannel(String type)
{
map = new double[Constants.RegionSize, Constants.RegionSize];
taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16];
if (type.Equals("flat"))
FlatLand();
else
PinHeadIsland();
} }
public TerrainChannel(double[,] import) public TerrainChannel(double[,] import)
@ -238,5 +235,36 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
private void PinHeadIsland()
{
int x;
for (x = 0; x < Constants.RegionSize; x++)
{
int y;
for (y = 0; y < Constants.RegionSize; y++)
{
map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
double spherFacA = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 50) * 0.01;
double spherFacB = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 100) * 0.001;
if (map[x, y] < spherFacA)
map[x, y] = spherFacA;
if (map[x, y] < spherFacB)
map[x, y] = spherFacB;
}
}
}
private void FlatLand()
{
int x;
for (x = 0; x < Constants.RegionSize; x++)
{
int y;
for (y = 0; y < Constants.RegionSize; y++)
map[x, y] = 21;
}
}
} }
} }

View File

@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.Tests
} }
/// <summary> /// <summary>
/// Test MoveTaskInventoryItem where the item has no parent folder assigned. /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// This should place it in the most suitable user folder. /// This should place it in the most suitable user folder.
@ -143,9 +143,11 @@ namespace OpenSim.Region.Framework.Tests
} }
/// <summary> /// <summary>
/// Test MoveTaskInventoryItem where the item has no parent folder assigned. /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned.
/// </summary> /// </summary>
/// <remarks>
/// This should place it in the most suitable user folder. /// This should place it in the most suitable user folder.
/// </remarks>
[Test] [Test]
public void TestMoveTaskInventoryItemNoParent() public void TestMoveTaskInventoryItemNoParent()
{ {

View File

@ -88,22 +88,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene)
{ {
ScenePresence sp = scene.GetScenePresence(agentId); ScenePresence npc = scene.GetScenePresence(agentId);
if (sp == null || sp.IsChildAgent) if (npc == null || npc.IsChildAgent)
return false; return false;
lock (m_avatars) lock (m_avatars)
if (!m_avatars.ContainsKey(agentId)) if (!m_avatars.ContainsKey(agentId))
return false; return false;
// Delete existing sp attachments // Delete existing npc attachments
scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
// Set new sp appearance. Also sends to clients. // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments
scene.RequestModuleInterface<IAvatarFactoryModule>().SetAppearance(sp, new AvatarAppearance(appearance, true)); AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
npc.Appearance = npcAppearance;
// Rez needed sp attachments // Rez needed npc attachments
scene.AttachmentsModule.RezAttachments(sp); scene.AttachmentsModule.RezAttachments(npc);
IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
module.SendAppearance(npc.UUID);
return true; return true;
} }

View File

@ -50,10 +50,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
[TestFixture] [TestFixture]
public class NPCModuleTests public class NPCModuleTests
{ {
private TestScene scene; private TestScene m_scene;
private AvatarFactoryModule afm; private AvatarFactoryModule m_afMod;
private UserManagementModule umm; private UserManagementModule m_umMod;
private AttachmentsModule am; private AttachmentsModule m_attMod;
private NPCModule m_npcMod;
[TestFixtureSetUp] [TestFixtureSetUp]
public void FixtureInit() public void FixtureInit()
@ -79,12 +80,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
config.AddConfig("Modules"); config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
afm = new AvatarFactoryModule(); m_afMod = new AvatarFactoryModule();
umm = new UserManagementModule(); m_umMod = new UserManagementModule();
am = new AttachmentsModule(); m_attMod = new AttachmentsModule();
m_npcMod = new NPCModule();
scene = SceneHelpers.SetupScene(); m_scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule());
} }
[Test] [Test]
@ -93,7 +95,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
// 8 is the index of the first baked texture in AvatarAppearance // 8 is the index of the first baked texture in AvatarAppearance
@ -104,18 +106,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
// We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell
// ScenePresence.SendInitialData() to reset our entire appearance. // ScenePresence.SendInitialData() to reset our entire appearance.
scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
afm.SetAppearance(sp, originalTe, null); m_afMod.SetAppearance(sp, originalTe, null);
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance);
ScenePresence npc = scene.GetScenePresence(npcId); ScenePresence npc = m_scene.GetScenePresence(npcId);
Assert.That(npc, Is.Not.Null); Assert.That(npc, Is.Not.Null);
Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname)));
} }
[Test] [Test]
@ -124,42 +125,83 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
Vector3 startPos = new Vector3(128, 128, 30); Vector3 startPos = new Vector3(128, 128, 30);
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
npcModule.DeleteNPC(npcId, scene); m_npcMod.DeleteNPC(npcId, m_scene);
ScenePresence deletedNpc = scene.GetScenePresence(npcId); ScenePresence deletedNpc = m_scene.GetScenePresence(npcId);
Assert.That(deletedNpc, Is.Null); Assert.That(deletedNpc, Is.Null);
} }
[Test] [Test]
public void TestAttachments() public void TestCreateWithAttachments()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
UUID userId = TestHelpers.ParseTail(0x1); UUID userId = TestHelpers.ParseTail(0x1);
UserAccountHelpers.CreateUserWithInventory(scene, userId); UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
UUID attItemId = TestHelpers.ParseTail(0x2); UUID attItemId = TestHelpers.ParseTail(0x2);
UUID attAssetId = TestHelpers.ParseTail(0x3); UUID attAssetId = TestHelpers.ParseTail(0x3);
string attName = "att"; string attName = "att";
UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance);
ScenePresence npc = scene.GetScenePresence(npcId); ScenePresence npc = m_scene.GetScenePresence(npcId);
// Check scene presence status
Assert.That(npc.HasAttachments(), Is.True);
List<SceneObjectGroup> attachments = npc.GetAttachments();
Assert.That(attachments.Count, Is.EqualTo(1));
SceneObjectGroup attSo = attachments[0];
// Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item
// name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC.
// Assert.That(attSo.Name, Is.EqualTo(attName));
Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False);
Assert.That(attSo.IsTemporary, Is.False);
Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID));
}
[Test]
public void TestLoadAppearance()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID userId = TestHelpers.ParseTail(0x1);
UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
// Now add the attachment to the original avatar and use that to load a new appearance
// TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here
UUID attItemId = TestHelpers.ParseTail(0x2);
UUID attAssetId = TestHelpers.ParseTail(0x3);
string attName = "att";
UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
m_npcMod.SetNPCAppearance(npcId, sp.Appearance, m_scene);
ScenePresence npc = m_scene.GetScenePresence(npcId);
// Check scene presence status // Check scene presence status
Assert.That(npc.HasAttachments(), Is.True); Assert.That(npc.HasAttachments(), Is.True);
@ -184,31 +226,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
Vector3 startPos = new Vector3(128, 128, 30); Vector3 startPos = new Vector3(128, 128, 30);
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
ScenePresence npc = scene.GetScenePresence(npcId); ScenePresence npc = m_scene.GetScenePresence(npcId);
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
// For now, we'll make the scene presence fly to simplify this test, but this needs to change. // For now, we'll make the scene presence fly to simplify this test, but this needs to change.
npc.Flying = true; npc.Flying = true;
scene.Update(); m_scene.Update();
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
Vector3 targetPos = startPos + new Vector3(0, 10, 0); Vector3 targetPos = startPos + new Vector3(0, 10, 0);
npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false);
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
//Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f)));
Assert.That( Assert.That(
npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001)); npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001));
scene.Update(); m_scene.Update();
// We should really check the exact figure. // We should really check the exact figure.
Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X));
@ -217,7 +258,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X)); Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X));
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
scene.Update(); m_scene.Update();
double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move");
@ -227,14 +268,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
// Try a second movement // Try a second movement
startPos = npc.AbsolutePosition; startPos = npc.AbsolutePosition;
targetPos = startPos + new Vector3(10, 0, 0); targetPos = startPos + new Vector3(10, 0, 0);
npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false);
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
// Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1)));
Assert.That( Assert.That(
npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001)); npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001));
scene.Update(); m_scene.Update();
// We should really check the exact figure. // We should really check the exact figure.
Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X)); Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X));
@ -243,7 +284,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
scene.Update(); m_scene.Update();
distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move");
@ -256,17 +297,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
Vector3 startPos = new Vector3(128, 128, 30); Vector3 startPos = new Vector3(128, 128, 30);
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
ScenePresence npc = scene.GetScenePresence(npcId); ScenePresence npc = m_scene.GetScenePresence(npcId);
SceneObjectPart part = SceneHelpers.AddSceneObject(scene); SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
part.SitTargetPosition = new Vector3(0, 0, 1); part.SitTargetPosition = new Vector3(0, 0, 1);
npcModule.Sit(npc.UUID, part.UUID, scene); m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
@ -274,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
npc.AbsolutePosition, npc.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
npcModule.Stand(npc.UUID, scene); m_npcMod.Stand(npc.UUID, m_scene);
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(npc.ParentID, Is.EqualTo(0)); Assert.That(npc.ParentID, Is.EqualTo(0));
@ -286,19 +326,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
// FIXME: To get this to work for now, we are going to place the npc right next to the target so that // FIXME: To get this to work for now, we are going to place the npc right next to the target so that
// the autopilot doesn't trigger // the autopilot doesn't trigger
Vector3 startPos = new Vector3(1, 1, 1); Vector3 startPos = new Vector3(1, 1, 1);
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
ScenePresence npc = scene.GetScenePresence(npcId); ScenePresence npc = m_scene.GetScenePresence(npcId);
SceneObjectPart part = SceneHelpers.AddSceneObject(scene); SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
npcModule.Sit(npc.UUID, part.UUID, scene); m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
@ -311,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
npc.AbsolutePosition, npc.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));
npcModule.Stand(npc.UUID, scene); m_npcMod.Stand(npc.UUID, m_scene);
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(npc.ParentID, Is.EqualTo(0)); Assert.That(npc.ParentID, Is.EqualTo(0));

View File

@ -358,7 +358,7 @@ namespace OpenSim.Region.Physics.Meshing
if (physicsParms == null) if (physicsParms == null)
{ {
m_log.Warn("[MESH]: no recognized physics mesh found in mesh asset"); m_log.WarnFormat("[MESH]: No recognized physics mesh found in mesh asset for {0}", primName);
return false; return false;
} }

View File

@ -842,6 +842,11 @@ namespace OpenSim.Region.Physics.OdePlugin
mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
mesh.releaseSourceMeshData(); // free up the original mesh data to save memory mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
// We must lock here since m_MeshToTriMeshMap is static and multiple scene threads may call this method at
// the same time.
lock (m_MeshToTriMeshMap)
{
if (m_MeshToTriMeshMap.ContainsKey(mesh)) if (m_MeshToTriMeshMap.ContainsKey(mesh))
{ {
_triMeshData = m_MeshToTriMeshMap[mesh]; _triMeshData = m_MeshToTriMeshMap[mesh];
@ -854,6 +859,7 @@ namespace OpenSim.Region.Physics.OdePlugin
d.GeomTriMeshDataPreprocess(_triMeshData); d.GeomTriMeshDataPreprocess(_triMeshData);
m_MeshToTriMeshMap[mesh] = _triMeshData; m_MeshToTriMeshMap[mesh] = _triMeshData;
} }
}
// _parent_scene.waitForSpaceUnlock(m_targetSpace); // _parent_scene.waitForSpaceUnlock(m_targetSpace);
try try

View File

@ -68,14 +68,48 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
/// </summary> /// </summary>
bool Suspended { get; set; } bool Suspended { get; set; }
/// <summary>
/// Is the script shutting down?
/// </summary>
bool ShuttingDown { get; set; } bool ShuttingDown { get; set; }
/// <summary>
/// Script state
/// </summary>
string State { get; set; } string State { get; set; }
/// <summary>
/// Time the script was last started
/// </summary>
DateTime TimeStarted { get; }
/// <summary>
/// Tick the last measurement period was started.
/// </summary>
long MeasurementPeriodTickStart { get; }
/// <summary>
/// Ticks spent executing in the last measurement period.
/// </summary>
long MeasurementPeriodExecutionTime { get; }
IScriptEngine Engine { get; } IScriptEngine Engine { get; }
UUID AppDomain { get; set; } UUID AppDomain { get; set; }
string PrimName { get; } string PrimName { get; }
string ScriptName { get; } string ScriptName { get; }
UUID ItemID { get; } UUID ItemID { get; }
UUID ObjectID { get; } UUID ObjectID { get; }
/// <summary>
/// UUID of the root object for the linkset that the script is in.
/// </summary>
UUID RootObjectID { get; }
/// <summary>
/// Local id of the root object for the linkset that the script is in.
/// </summary>
uint RootLocalID { get; }
uint LocalID { get; } uint LocalID { get; }
UUID AssetID { get; } UUID AssetID { get; }
Queue EventQueue { get; } Queue EventQueue { get; }
@ -89,7 +123,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
void Start(); void Start();
/// <summary> /// <summary>
/// Stop the script. /// Stop the script instance.
/// </summary> /// </summary>
/// <param name="timeout"></param> /// <param name="timeout"></param>
/// <returns>true if the script was successfully stopped, false otherwise</returns> /// <returns>true if the script was successfully stopped, false otherwise</returns>
@ -97,13 +131,17 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
void SetState(string state); void SetState(string state);
/// <summary>
/// Post an event to this script instance.
/// </summary>
/// <param name="data"></param>
void PostEvent(EventParams data); void PostEvent(EventParams data);
void Suspend(); void Suspend();
void Resume(); void Resume();
/// <summary> /// <summary>
/// Process the next event queued for this script /// Process the next event queued for this script instance.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
object EventProcessor(); object EventProcessor();

View File

@ -247,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Remove Sensors // Remove Sensors
m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
}
/// <summary>
/// Get the sensor repeat plugin for this script engine.
/// </summary>
/// <param name="engine"></param>
/// <returns></returns>
public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine)
{
if (m_SensorRepeat.ContainsKey(engine))
return m_SensorRepeat[engine];
else
return null;
}
/// <summary>
/// Get the dataserver plugin for this script engine.
/// </summary>
/// <param name="engine"></param>
/// <returns></returns>
public static Dataserver GetDataserverPlugin(IScriptEngine engine)
{
if (m_Dataserver.ContainsKey(engine))
return m_Dataserver[engine];
else
return null;
}
/// <summary>
/// Get the timer plugin for this script engine.
/// </summary>
/// <param name="engine"></param>
/// <returns></returns>
public static Timer GetTimerPlugin(IScriptEngine engine)
{
if (m_Timer.ContainsKey(engine))
return m_Timer[engine];
else
return null;
}
/// <summary>
/// Get the listener plugin for this script engine.
/// </summary>
/// <param name="engine"></param>
/// <returns></returns>
public static Listener GetListenerPlugin(IScriptEngine engine)
{
if (m_Listener.ContainsKey(engine))
return m_Listener[engine];
else
return null;
} }
public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID) public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID)

View File

@ -2771,6 +2771,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
Util.FireAndForget(delegate (object x)
{
if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s)) if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
return; return;
float dist = (float)llVecDist(llGetPos(), pos); float dist = (float)llVecDist(llGetPos(), pos);
@ -2778,6 +2780,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (dist > m_ScriptDistanceFactor * 10.0f) if (dist > m_ScriptDistanceFactor * 10.0f)
return; return;
//Clone is thread-safe
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory) foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
@ -2795,7 +2798,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
// need the magnitude later // need the magnitude later
float velmag = (float)Util.GetMagnitude(llvel); // float velmag = (float)Util.GetMagnitude(llvel);
SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param); SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param);
@ -2822,13 +2825,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
} }
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
ScriptSleep((int)((groupmass * velmag) / 10));
ScriptSleep(100);
return; return;
} }
} }
llSay(0, "Could not find object " + inventory); llSay(0, "Could not find object " + inventory);
});
//ScriptSleep((int)((groupmass * velmag) / 10));
ScriptSleep(100);
} }
public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
@ -7069,10 +7074,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
shapeBlock.PathScaleX = 100; shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 150; shapeBlock.PathScaleY = 150;
if (type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER && int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR);
type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE &&
type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE && if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) &&
type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) &&
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) &&
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag))
{ {
// default // default
type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;

View File

@ -38,6 +38,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
{ {
public AsyncCommandManager m_CmdManager; public AsyncCommandManager m_CmdManager;
public int DataserverRequestsCount
{
get
{
lock (DataserverRequests)
return DataserverRequests.Count;
}
}
private Dictionary<string, DataserverRequest> DataserverRequests = private Dictionary<string, DataserverRequest> DataserverRequests =
new Dictionary<string, DataserverRequest>(); new Dictionary<string, DataserverRequest>();

View File

@ -42,22 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
public AsyncCommandManager m_CmdManager; public AsyncCommandManager m_CmdManager;
private IWorldComm m_commsPlugin;
public int ListenerCount
{
get { return m_commsPlugin.ListenerCount; }
}
public Listener(AsyncCommandManager CmdManager) public Listener(AsyncCommandManager CmdManager)
{ {
m_CmdManager = CmdManager; m_CmdManager = CmdManager;
m_commsPlugin = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
} }
public void CheckListeners() public void CheckListeners()
{ {
if (m_CmdManager.m_ScriptEngine.World == null) if (m_CmdManager.m_ScriptEngine.World == null)
return; return;
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
if (comms != null) if (m_commsPlugin != null)
{ {
while (comms.HasMessages()) while (m_commsPlugin.HasMessages())
{ {
ListenerInfo lInfo = (ListenerInfo)comms.GetNextMessage(); ListenerInfo lInfo = (ListenerInfo)m_commsPlugin.GetNextMessage();
//Deliver data to prim's listen handler //Deliver data to prim's listen handler
object[] resobj = new object[] object[] resobj = new object[]
@ -81,17 +88,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
public Object[] GetSerializationData(UUID itemID) public Object[] GetSerializationData(UUID itemID)
{ {
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); return m_commsPlugin.GetSerializationData(itemID);
return comms.GetSerializationData(itemID);
} }
public void CreateFromData(uint localID, UUID itemID, UUID hostID, public void CreateFromData(uint localID, UUID itemID, UUID hostID,
Object[] data) Object[] data)
{ {
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); m_commsPlugin.CreateFromData(localID, itemID, hostID, data);
comms.CreateFromData(localID, itemID, hostID, data);
} }
} }
} }

View File

@ -44,6 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
public AsyncCommandManager m_CmdManager; public AsyncCommandManager m_CmdManager;
/// <summary>
/// Number of sensors active.
/// </summary>
public int SensorsCount
{
get
{
lock (SenseRepeatListLock)
return SenseRepeaters.Count;
}
}
public SensorRepeat(AsyncCommandManager CmdManager) public SensorRepeat(AsyncCommandManager CmdManager)
{ {
m_CmdManager = CmdManager; m_CmdManager = CmdManager;
@ -156,13 +168,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
} }
public void CheckSenseRepeaterEvents() public void CheckSenseRepeaterEvents()
{
lock (SenseRepeatListLock)
{ {
// Nothing to do here? // Nothing to do here?
if (SenseRepeaters.Count == 0) if (SenseRepeaters.Count == 0)
return; return;
lock (SenseRepeatListLock)
{
// Go through all timers // Go through all timers
foreach (SenseRepeatClass ts in SenseRepeaters) foreach (SenseRepeatClass ts in SenseRepeaters)
{ {
@ -635,7 +647,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
ts.next = ts.next =
DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
lock (SenseRepeatListLock)
SenseRepeaters.Add(ts); SenseRepeaters.Add(ts);
idx += 6; idx += 6;
} }
} }

View File

@ -37,6 +37,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
{ {
public AsyncCommandManager m_CmdManager; public AsyncCommandManager m_CmdManager;
public int TimersCount
{
get
{
lock (TimerListLock)
return Timers.Count;
}
}
public Timer(AsyncCommandManager CmdManager) public Timer(AsyncCommandManager CmdManager)
{ {
m_CmdManager = CmdManager; m_CmdManager = CmdManager;

View File

@ -378,6 +378,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_SCULPT_TYPE_TORUS = 2; public const int PRIM_SCULPT_TYPE_TORUS = 2;
public const int PRIM_SCULPT_TYPE_PLANE = 3; public const int PRIM_SCULPT_TYPE_PLANE = 3;
public const int PRIM_SCULPT_TYPE_CYLINDER = 4; public const int PRIM_SCULPT_TYPE_CYLINDER = 4;
public const int PRIM_SCULPT_FLAG_INVERT = 64;
public const int PRIM_SCULPT_FLAG_MIRROR = 128;
public const int MASK_BASE = 0; public const int MASK_BASE = 0;
public const int MASK_OWNER = 1; public const int MASK_OWNER = 1;

View File

@ -226,7 +226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
break; break;
} }
} }
int z = 0;
try try
{ {
if (gotMatch) if (gotMatch)
@ -235,8 +235,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
finally finally
{ {
// Manually finalize all the iterators. // Manually finalize all the iterators.
for (int i = 0; i < nIterators; ++i) for (z = 0; z < nIterators; ++z)
iterators[i].Dispose(); iterators[z].Dispose();
} }
} }
} }

View File

@ -576,7 +576,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
break; break;
} }
} }
int z = 0;
try try
{ {
if (gotMatch) if (gotMatch)
@ -585,8 +585,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
finally finally
{ {
// Manually finalize all the iterators. // Manually finalize all the iterators.
for (int i = 0; i < nIterators; ++i) for (z = 0; z < nIterators; ++z)
iterators[i].Dispose(); iterators[z].Dispose();
} }
} }

View File

@ -118,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
emessage = emessage.Substring(slinfo.Length+2); emessage = emessage.Substring(slinfo.Length+2);
message = String.Format("({0},{1}) {2}", message = String.Format("({0},{1}) {2}",
e.slInfo.lineNumber - 2, e.slInfo.lineNumber - 1,
e.slInfo.charPosition - 1, emessage); e.slInfo.charPosition - 1, emessage);
throw new Exception(message); throw new Exception(message);

View File

@ -29,6 +29,7 @@ using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using NUnit.Framework; using NUnit.Framework;
using OpenSim.Region.ScriptEngine.Shared.CodeTools; using OpenSim.Region.ScriptEngine.Shared.CodeTools;
using OpenSim.Tests.Common;
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
{ {
@ -43,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
[Test] [Test]
public void TestDefaultState() public void TestDefaultState()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -63,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
[Test] [Test]
public void TestCustomState() public void TestCustomState()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -93,6 +98,8 @@ state another_state
[Test] [Test]
public void TestEventWithArguments() public void TestEventWithArguments()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
at_rot_target(integer tnum, rotation targetrot, rotation ourrot) at_rot_target(integer tnum, rotation targetrot, rotation ourrot)
@ -113,6 +120,8 @@ state another_state
[Test] [Test]
public void TestIntegerDeclaration() public void TestIntegerDeclaration()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
touch_start(integer num_detected) touch_start(integer num_detected)
@ -135,6 +144,8 @@ state another_state
[Test] [Test]
public void TestLoneIdent() public void TestLoneIdent()
{ {
TestHelpers.InMethod();
// A lone ident should be removed completely as it's an error in C# // A lone ident should be removed completely as it's an error in C#
// (MONO at least). // (MONO at least).
string input = @"default string input = @"default
@ -161,6 +172,8 @@ state another_state
[Test] [Test]
public void TestAssignments() public void TestAssignments()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
touch_start(integer num_detected) touch_start(integer num_detected)
@ -187,6 +200,8 @@ state another_state
[Test] [Test]
public void TestAdditionSubtractionOperator() public void TestAdditionSubtractionOperator()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
touch_start(integer num_detected) touch_start(integer num_detected)
@ -215,6 +230,8 @@ state another_state
[Test] [Test]
public void TestStrings() public void TestStrings()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
touch_start(integer num_detected) touch_start(integer num_detected)
@ -242,6 +259,8 @@ state another_state
[Test] [Test]
public void TestBinaryExpression() public void TestBinaryExpression()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
touch_start(integer num_detected) touch_start(integer num_detected)
@ -284,6 +303,8 @@ state another_state
[Test] [Test]
public void TestFloatConstants() public void TestFloatConstants()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
touch_start(integer num_detected) touch_start(integer num_detected)
@ -336,6 +357,8 @@ state another_state
[Test] [Test]
public void TestComments() public void TestComments()
{ {
TestHelpers.InMethod();
string input = @"// this test tests comments string input = @"// this test tests comments
default default
{ {
@ -358,6 +381,8 @@ default
[Test] [Test]
public void TestStringsWithEscapedQuotesAndComments() public void TestStringsWithEscapedQuotesAndComments()
{ {
TestHelpers.InMethod();
string input = @"// this test tests strings, with escaped quotes and comments in strings string input = @"// this test tests strings, with escaped quotes and comments in strings
default default
{ {
@ -397,6 +422,8 @@ default
[Test] [Test]
public void TestCStyleComments() public void TestCStyleComments()
{ {
TestHelpers.InMethod();
string input = @"/* this test tests comments string input = @"/* this test tests comments
of the C variety of the C variety
*/ */
@ -426,6 +453,8 @@ default
[Test] [Test]
public void TestGlobalDefinedFunctions() public void TestGlobalDefinedFunctions()
{ {
TestHelpers.InMethod();
string input = @"// this test tests custom defined functions string input = @"// this test tests custom defined functions
string onefunc() string onefunc()
@ -470,6 +499,8 @@ default
[Test] [Test]
public void TestGlobalDeclaredVariables() public void TestGlobalDeclaredVariables()
{ {
TestHelpers.InMethod();
string input = @"// this test tests custom defined functions and global variables string input = @"// this test tests custom defined functions and global variables
string globalString; string globalString;
@ -525,6 +556,8 @@ default
[Test] [Test]
public void TestMoreAssignments() public void TestMoreAssignments()
{ {
TestHelpers.InMethod();
string input = @"// this test tests +=, -=, *=, /=, %= string input = @"// this test tests +=, -=, *=, /=, %=
string globalString; string globalString;
@ -579,6 +612,8 @@ default
[Test] [Test]
public void TestVectorConstantNotation() public void TestVectorConstantNotation()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
touch_start(integer num_detected) touch_start(integer num_detected)
@ -606,6 +641,8 @@ default
[Test] [Test]
public void TestVectorMemberAccess() public void TestVectorMemberAccess()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
touch_start(integer num_detected) touch_start(integer num_detected)
@ -632,6 +669,8 @@ default
[Test] [Test]
public void TestExpressionInParentheses() public void TestExpressionInParentheses()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
touch_start(integer num_detected) touch_start(integer num_detected)
@ -660,6 +699,8 @@ default
[Test] [Test]
public void TestIncrementDecrementOperator() public void TestIncrementDecrementOperator()
{ {
TestHelpers.InMethod();
string input = @"// here we'll test the ++ and -- operators string input = @"// here we'll test the ++ and -- operators
default default
@ -690,6 +731,8 @@ default
[Test] [Test]
public void TestLists() public void TestLists()
{ {
TestHelpers.InMethod();
string input = @"// testing lists string input = @"// testing lists
default default
@ -718,6 +761,8 @@ default
[Test] [Test]
public void TestIfStatement() public void TestIfStatement()
{ {
TestHelpers.InMethod();
string input = @"// let's test if statements string input = @"// let's test if statements
default default
@ -822,6 +867,8 @@ default
[Test] [Test]
public void TestIfElseStatement() public void TestIfElseStatement()
{ {
TestHelpers.InMethod();
string input = @"// let's test complex logical expressions string input = @"// let's test complex logical expressions
default default
@ -928,6 +975,8 @@ default
[Test] [Test]
public void TestWhileLoop() public void TestWhileLoop()
{ {
TestHelpers.InMethod();
string input = @"// let's test while loops string input = @"// let's test while loops
default default
@ -968,6 +1017,8 @@ default
[Test] [Test]
public void TestDoWhileLoop() public void TestDoWhileLoop()
{ {
TestHelpers.InMethod();
string input = @"// let's test do-while loops string input = @"// let's test do-while loops
default default
@ -1012,6 +1063,8 @@ default
[Test] [Test]
public void TestForLoop() public void TestForLoop()
{ {
TestHelpers.InMethod();
string input = @"// let's test for loops string input = @"// let's test for loops
default default
@ -1056,6 +1109,8 @@ default
[Test] [Test]
public void TestFloatsWithTrailingDecimal() public void TestFloatsWithTrailingDecimal()
{ {
TestHelpers.InMethod();
string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot
default default
@ -1108,6 +1163,8 @@ default
[Test] [Test]
public void TestUnaryAndBinaryOperators() public void TestUnaryAndBinaryOperators()
{ {
TestHelpers.InMethod();
string input = @"// let's test a few more operators string input = @"// let's test a few more operators
default default
@ -1144,6 +1201,8 @@ default
[Test] [Test]
public void TestTypecasts() public void TestTypecasts()
{ {
TestHelpers.InMethod();
string input = @"// let's test typecasts string input = @"// let's test typecasts
default default
@ -1189,6 +1248,8 @@ default
[Test] [Test]
public void TestStates() public void TestStates()
{ {
TestHelpers.InMethod();
string input = @"// let's test states string input = @"// let's test states
default default
@ -1229,6 +1290,8 @@ state statetwo
[Test] [Test]
public void TestHexIntegerConstants() public void TestHexIntegerConstants()
{ {
TestHelpers.InMethod();
string input = @"// let's test hex integers string input = @"// let's test hex integers
default default
@ -1261,6 +1324,8 @@ default
[Test] [Test]
public void TestJumps() public void TestJumps()
{ {
TestHelpers.InMethod();
string input = @"// let's test jumps string input = @"// let's test jumps
default default
@ -1291,6 +1356,8 @@ default
[Test] [Test]
public void TestImplicitVariableInitialization() public void TestImplicitVariableInitialization()
{ {
TestHelpers.InMethod();
string input = @"// let's test implicitly initializing variables string input = @"// let's test implicitly initializing variables
default default
@ -1334,6 +1401,8 @@ default
[Test] [Test]
public void TestMultipleEqualsExpression() public void TestMultipleEqualsExpression()
{ {
TestHelpers.InMethod();
string input = @"// let's test x = y = 5 type expressions string input = @"// let's test x = y = 5 type expressions
default default
@ -1366,6 +1435,8 @@ default
[Test] [Test]
public void TestUnaryExpressionLastInVectorConstant() public void TestUnaryExpressionLastInVectorConstant()
{ {
TestHelpers.InMethod();
string input = @"// let's test unary expressions some more string input = @"// let's test unary expressions some more
default default
@ -1390,6 +1461,8 @@ default
[Test] [Test]
public void TestVectorMemberPlusEquals() public void TestVectorMemberPlusEquals()
{ {
TestHelpers.InMethod();
string input = @"// let's test unary expressions some more string input = @"// let's test unary expressions some more
default default
@ -1424,6 +1497,8 @@ default
[Test] [Test]
public void TestWhileLoopWithNoBody() public void TestWhileLoopWithNoBody()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1447,6 +1522,8 @@ default
[Test] [Test]
public void TestDoWhileLoopWithNoBody() public void TestDoWhileLoopWithNoBody()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1472,6 +1549,8 @@ default
[Test] [Test]
public void TestIfWithNoBody() public void TestIfWithNoBody()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1495,6 +1574,8 @@ default
[Test] [Test]
public void TestIfElseWithNoBody() public void TestIfElseWithNoBody()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1521,6 +1602,8 @@ default
[Test] [Test]
public void TestForLoopWithNoBody() public void TestForLoopWithNoBody()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1544,6 +1627,8 @@ default
[Test] [Test]
public void TestForLoopWithNoAssignment() public void TestForLoopWithNoAssignment()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1569,6 +1654,8 @@ default
[Test] [Test]
public void TestForLoopWithOnlyIdentInAssignment() public void TestForLoopWithOnlyIdentInAssignment()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1594,6 +1681,8 @@ default
[Test] [Test]
public void TestAssignmentInIfWhileDoWhile() public void TestAssignmentInIfWhileDoWhile()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1631,6 +1720,8 @@ default
[Test] [Test]
public void TestLSLListHack() public void TestLSLListHack()
{ {
TestHelpers.InMethod();
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1653,9 +1744,12 @@ default
} }
[Test] [Test]
[ExpectedException(typeof(System.Exception))]
public void TestSyntaxError() public void TestSyntaxError()
{ {
TestHelpers.InMethod();
bool gotException = false;
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1671,17 +1765,22 @@ default
} }
catch (System.Exception e) catch (System.Exception e)
{ {
// The syntax error is on line 6, char 5 (expected ';', found // The syntax error is on line 5, char 4 (expected ';', found
// '}'). // '}').
Assert.AreEqual("(4,4) syntax error", e.Message); Assert.AreEqual("(5,4) syntax error", e.Message);
throw; gotException = true;
} }
Assert.That(gotException, Is.True);
} }
[Test] [Test]
[ExpectedException(typeof(System.Exception))]
public void TestSyntaxErrorDeclaringVariableInForLoop() public void TestSyntaxErrorDeclaringVariableInForLoop()
{ {
TestHelpers.InMethod();
bool gotException = false;
string input = @"default string input = @"default
{ {
state_entry() state_entry()
@ -1697,11 +1796,13 @@ default
} }
catch (System.Exception e) catch (System.Exception e)
{ {
// The syntax error is on line 5, char 14 (Syntax error) // The syntax error is on line 4, char 13 (Syntax error)
Assert.AreEqual("(3,13) syntax error", e.Message); Assert.AreEqual("(4,13) syntax error", e.Message);
throw; gotException = true;
} }
Assert.That(gotException, Is.True);
} }
} }
} }

View File

@ -31,6 +31,7 @@ using System.Collections.Generic;
using Microsoft.CSharp; using Microsoft.CSharp;
using NUnit.Framework; using NUnit.Framework;
using OpenSim.Region.ScriptEngine.Shared.CodeTools; using OpenSim.Region.ScriptEngine.Shared.CodeTools;
using OpenSim.Tests.Common;
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
{ {
@ -92,6 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
//[Test] //[Test]
public void TestUseUndeclaredVariable() public void TestUseUndeclaredVariable()
{ {
TestHelpers.InMethod();
m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
string input = @"default string input = @"default
@ -124,6 +127,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
//[Test] //[Test]
public void TestCastAndConcatString() public void TestCastAndConcatString()
{ {
TestHelpers.InMethod();
m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
string input = @"string s = "" a string""; string input = @"string s = "" a string"";

View File

@ -57,35 +57,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IScriptEngine m_Engine; /// <summary>
private IScriptWorkItem m_CurrentResult = null; /// The current work item if an event for this script is running or waiting to run,
private Queue m_EventQueue = new Queue(32); /// </summary>
private bool m_RunEvents = false; /// <remarks>
private UUID m_ItemID; /// Null if there is no running or waiting to run event. Must be changed only under an EventQueue lock.
private uint m_LocalID; /// </remarks>
private UUID m_ObjectID; private IScriptWorkItem m_CurrentWorkItem;
private UUID m_AssetID;
private IScript m_Script; private IScript m_Script;
private UUID m_AppDomain;
private DetectParams[] m_DetectParams; private DetectParams[] m_DetectParams;
private bool m_TimerQueued; private bool m_TimerQueued;
private DateTime m_EventStart; private DateTime m_EventStart;
private bool m_InEvent; private bool m_InEvent;
private string m_PrimName;
private string m_ScriptName;
private string m_Assembly; private string m_Assembly;
private int m_StartParam;
private string m_CurrentEvent = String.Empty; private string m_CurrentEvent = String.Empty;
private bool m_InSelfDelete; private bool m_InSelfDelete;
private int m_MaxScriptQueue; private int m_MaxScriptQueue;
private bool m_SaveState = true; private bool m_SaveState = true;
private bool m_ShuttingDown;
private int m_ControlEventsInQueue; private int m_ControlEventsInQueue;
private int m_LastControlLevel; private int m_LastControlLevel;
private bool m_CollisionInQueue; private bool m_CollisionInQueue;
private TaskInventoryItem m_thisScriptTask;
// The following is for setting a minimum delay between events // The following is for setting a minimum delay between events
private double m_minEventDelay; private double m_minEventDelay;
private long m_eventDelayTicks; private long m_eventDelayTicks;
private long m_nextEventTimeTicks; private long m_nextEventTimeTicks;
private bool m_startOnInit = true; private bool m_startOnInit = true;
@ -96,21 +92,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private UUID m_CurrentStateHash; private UUID m_CurrentStateHash;
private UUID m_RegionID; private UUID m_RegionID;
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; }
m_LineMap;
public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
LineMap
{
get { return m_LineMap; }
set { m_LineMap = value; }
}
private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
// Script state
private string m_State = "default";
public Object[] PluginData = new Object[0]; public Object[] PluginData = new Object[0];
/// <summary> /// <summary>
@ -133,11 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
} }
} }
public bool Running public bool Running { get; set; }
{
get { return m_RunEvents; }
set { m_RunEvents = value; }
}
public bool Suspended public bool Suspended
{ {
@ -153,11 +134,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (wasSuspended && !m_Suspended) if (wasSuspended && !m_Suspended)
{ {
lock (m_EventQueue) lock (EventQueue)
{ {
// Need to place ourselves back in a work item if there are events to process // Need to place ourselves back in a work item if there are events to process
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) if (EventQueue.Count > 0 && Running && !ShuttingDown)
m_CurrentResult = m_Engine.QueueEventHandler(this); m_CurrentWorkItem = Engine.QueueEventHandler(this);
} }
} }
} }
@ -165,79 +146,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
} }
private bool m_Suspended; private bool m_Suspended;
public bool ShuttingDown public bool ShuttingDown { get; set; }
{
get { return m_ShuttingDown; }
set { m_ShuttingDown = value; }
}
public string State public string State { get; set; }
{
get { return m_State; }
set { m_State = value; }
}
public IScriptEngine Engine public IScriptEngine Engine { get; private set; }
{
get { return m_Engine; }
}
public UUID AppDomain public UUID AppDomain { get; set; }
{
get { return m_AppDomain; }
set { m_AppDomain = value; }
}
public string PrimName public string PrimName { get; private set; }
{
get { return m_PrimName; }
}
public string ScriptName public string ScriptName { get; private set; }
{
get { return m_ScriptName; }
}
public UUID ItemID public UUID ItemID { get; private set; }
{
get { return m_ItemID; }
}
public UUID ObjectID public UUID ObjectID { get; private set; }
{
get { return m_ObjectID; }
}
public uint LocalID public uint LocalID { get; private set; }
{
get { return m_LocalID; }
}
public UUID AssetID public UUID RootObjectID { get; private set; }
{
get { return m_AssetID; }
}
public Queue EventQueue public uint RootLocalID { get; private set; }
{
get { return m_EventQueue; } public UUID AssetID { get; private set; }
}
public Queue EventQueue { get; private set; }
public int StartParam { get; set; }
public TaskInventoryItem ScriptTask { get; private set; }
public DateTime TimeStarted { get; private set; }
public long MeasurementPeriodTickStart { get; private set; }
public long MeasurementPeriodExecutionTime { get; private set; }
public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute;
public void ClearQueue() public void ClearQueue()
{ {
m_TimerQueued = false; m_TimerQueued = false;
m_EventQueue.Clear(); EventQueue.Clear();
}
public int StartParam
{
get { return m_StartParam; }
set { m_StartParam = value; }
}
public TaskInventoryItem ScriptTask
{
get { return m_thisScriptTask; }
} }
public ScriptInstance(IScriptEngine engine, SceneObjectPart part, public ScriptInstance(IScriptEngine engine, SceneObjectPart part,
@ -246,16 +196,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
int startParam, bool postOnRez, StateSource stateSource, int startParam, bool postOnRez, StateSource stateSource,
int maxScriptQueue) int maxScriptQueue)
{ {
m_Engine = engine; State = "default";
EventQueue = new Queue(32);
m_LocalID = part.LocalId; Engine = engine;
m_ObjectID = part.UUID; LocalID = part.LocalId;
m_ItemID = itemID; ObjectID = part.UUID;
m_AssetID = assetID; RootLocalID = part.ParentGroup.LocalId;
m_PrimName = primName; RootObjectID = part.ParentGroup.UUID;
m_ScriptName = scriptName; ItemID = itemID;
AssetID = assetID;
PrimName = primName;
ScriptName = scriptName;
m_Assembly = assembly; m_Assembly = assembly;
m_StartParam = startParam; StartParam = startParam;
m_MaxScriptQueue = maxScriptQueue; m_MaxScriptQueue = maxScriptQueue;
m_stateSource = stateSource; m_stateSource = stateSource;
m_postOnRez = postOnRez; m_postOnRez = postOnRez;
@ -266,9 +220,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{ {
lock (part.TaskInventory) lock (part.TaskInventory)
{ {
if (part.TaskInventory.ContainsKey(m_ItemID)) if (part.TaskInventory.ContainsKey(ItemID))
{ {
m_thisScriptTask = part.TaskInventory[m_ItemID]; ScriptTask = part.TaskInventory[ItemID];
} }
} }
} }
@ -278,7 +232,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
foreach (string api in am.GetApis()) foreach (string api in am.GetApis())
{ {
m_Apis[api] = am.CreateApi(api); m_Apis[api] = am.CreateApi(api);
m_Apis[api].Initialize(engine, part, m_LocalID, itemID); m_Apis[api].Initialize(engine, part, LocalID, itemID);
} }
try try
@ -292,7 +246,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
Path.GetFileNameWithoutExtension(assembly)).CreateInstance( Path.GetFileNameWithoutExtension(assembly)).CreateInstance(
"SecondLife.Script"); "SecondLife.Script");
//ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
//RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); //RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
// lease.Register(this); // lease.Register(this);
@ -313,7 +266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
// // m_log.Debug("[Script] Script instance created"); // // m_log.Debug("[Script] Script instance created");
part.SetScriptEvents(m_ItemID, part.SetScriptEvents(ItemID,
(int)m_Script.GetStateEventFlags(State)); (int)m_Script.GetStateEventFlags(State));
} }
catch (Exception e) catch (Exception e)
@ -328,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_SaveState = true; m_SaveState = true;
string savedState = Path.Combine(Path.GetDirectoryName(assembly), string savedState = Path.Combine(Path.GetDirectoryName(assembly),
m_ItemID.ToString() + ".state"); ItemID.ToString() + ".state");
if (File.Exists(savedState)) if (File.Exists(savedState))
{ {
string xml = String.Empty; string xml = String.Empty;
@ -352,24 +305,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ScriptSerializer.Deserialize(xml, this); ScriptSerializer.Deserialize(xml, this);
AsyncCommandManager.CreateFromData(m_Engine, AsyncCommandManager.CreateFromData(Engine,
m_LocalID, m_ItemID, m_ObjectID, LocalID, ItemID, ObjectID,
PluginData); PluginData);
// m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName); // m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName);
part.SetScriptEvents(m_ItemID, part.SetScriptEvents(ItemID,
(int)m_Script.GetStateEventFlags(State)); (int)m_Script.GetStateEventFlags(State));
if (m_RunEvents && (!m_ShuttingDown)) Running = false;
{
m_RunEvents = false; if (ShuttingDown)
}
else
{
m_RunEvents = false;
m_startOnInit = false; m_startOnInit = false;
}
// we get new rez events on sim restart, too // we get new rez events on sim restart, too
// but if there is state, then we fire the change // but if there is state, then we fire the change
@ -378,7 +326,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
// We loaded state, don't force a re-save // We loaded state, don't force a re-save
m_SaveState = false; m_SaveState = false;
m_startedFromSavedState = true; m_startedFromSavedState = true;
} }
} }
else else
@ -397,7 +344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
} }
// else // else
// { // {
// ScenePresence presence = m_Engine.World.GetScenePresence(part.OwnerID); // ScenePresence presence = Engine.World.GetScenePresence(part.OwnerID);
// if (presence != null && (!postOnRez)) // if (presence != null && (!postOnRez))
// presence.ControllingClient.SendAgentAlertMessage("Compile successful", false); // presence.ControllingClient.SendAgentAlertMessage("Compile successful", false);
@ -415,7 +362,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (m_postOnRez) if (m_postOnRez)
{ {
PostEvent(new EventParams("on_rez", PostEvent(new EventParams("on_rez",
new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0])); new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
} }
if (m_stateSource == StateSource.AttachedRez) if (m_stateSource == StateSource.AttachedRez)
@ -449,7 +396,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (m_postOnRez) if (m_postOnRez)
{ {
PostEvent(new EventParams("on_rez", PostEvent(new EventParams("on_rez",
new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0])); new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
} }
if (m_stateSource == StateSource.AttachedRez) if (m_stateSource == StateSource.AttachedRez)
@ -463,7 +410,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private void ReleaseControls() private void ReleaseControls()
{ {
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(m_LocalID); SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
if (part != null) if (part != null)
{ {
@ -471,18 +418,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
UUID permsGranter; UUID permsGranter;
lock (part.TaskInventory) lock (part.TaskInventory)
{ {
if (!part.TaskInventory.ContainsKey(m_ItemID)) if (!part.TaskInventory.ContainsKey(ItemID))
return; return;
permsGranter = part.TaskInventory[m_ItemID].PermsGranter; permsGranter = part.TaskInventory[ItemID].PermsGranter;
permsMask = part.TaskInventory[m_ItemID].PermsMask; permsMask = part.TaskInventory[ItemID].PermsMask;
} }
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
{ {
ScenePresence presence = m_Engine.World.GetScenePresence(permsGranter); ScenePresence presence = Engine.World.GetScenePresence(permsGranter);
if (presence != null) if (presence != null)
presence.UnRegisterControlEventsToScript(m_LocalID, m_ItemID); presence.UnRegisterControlEventsToScript(LocalID, ItemID);
} }
} }
} }
@ -490,13 +437,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void DestroyScriptInstance() public void DestroyScriptInstance()
{ {
ReleaseControls(); ReleaseControls();
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID); AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
} }
public void RemoveState() public void RemoveState()
{ {
string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly), string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly),
m_ItemID.ToString() + ".state"); ItemID.ToString() + ".state");
try try
{ {
@ -509,7 +456,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void VarDump(Dictionary<string, object> vars) public void VarDump(Dictionary<string, object> vars)
{ {
// m_log.Info("Variable dump for script "+ m_ItemID.ToString()); // m_log.Info("Variable dump for script "+ ItemID.ToString());
// foreach (KeyValuePair<string, object> v in vars) // foreach (KeyValuePair<string, object> v in vars)
// { // {
// m_log.Info("Variable: "+v.Key+" = "+v.Value.ToString()); // m_log.Info("Variable: "+v.Key+" = "+v.Value.ToString());
@ -518,17 +465,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void Start() public void Start()
{ {
lock (m_EventQueue) lock (EventQueue)
{ {
if (Running) if (Running)
return; return;
m_RunEvents = true; Running = true;
if (m_EventQueue.Count > 0) TimeStarted = DateTime.Now;
MeasurementPeriodTickStart = Util.EnvironmentTickCount();
MeasurementPeriodExecutionTime = 0;
if (EventQueue.Count > 0)
{ {
if (m_CurrentResult == null) if (m_CurrentWorkItem == null)
m_CurrentResult = m_Engine.QueueEventHandler(this); m_CurrentWorkItem = Engine.QueueEventHandler(this);
// else // else
// m_log.Error("[Script] Tried to start a script that was already queued"); // m_log.Error("[Script] Tried to start a script that was already queued");
} }
@ -538,51 +489,63 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public bool Stop(int timeout) public bool Stop(int timeout)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCRIPT INSTANCE]: Stopping script {0} {1} with timeout {2}", ScriptName, ItemID, timeout); // "[SCRIPT INSTANCE]: Stopping script {0} {1} in {2} {3} with timeout {4} {5} {6}",
// ScriptName, ItemID, PrimName, ObjectID, timeout, m_InSelfDelete, DateTime.Now.Ticks);
IScriptWorkItem result; IScriptWorkItem workItem;
lock (m_EventQueue) lock (EventQueue)
{ {
if (!Running) if (!Running)
return true; return true;
if (m_CurrentResult == null) // If we're not running or waiting to run an event then we can safely stop.
if (m_CurrentWorkItem == null)
{ {
m_RunEvents = false; Running = false;
return true; return true;
} }
if (m_CurrentResult.Cancel()) // If we are waiting to run an event then we can try to cancel it.
if (m_CurrentWorkItem.Cancel())
{ {
m_CurrentResult = null; m_CurrentWorkItem = null;
m_RunEvents = false; Running = false;
return true; return true;
} }
result = m_CurrentResult; workItem = m_CurrentWorkItem;
m_RunEvents = false; Running = false;
} }
if (result.Wait(new TimeSpan((long)timeout * 100000))) // Wait for the current event to complete.
if (!m_InSelfDelete && workItem.Wait(new TimeSpan((long)timeout * 100000)))
{ {
return true; return true;
} }
lock (m_EventQueue) lock (EventQueue)
{ {
result = m_CurrentResult; workItem = m_CurrentWorkItem;
} }
if (result == null) if (workItem == null)
return true; return true;
// If the event still hasn't stopped and we the stop isn't the result of script or object removal, then
// forcibly abort the work item (this aborts the underlying thread).
if (!m_InSelfDelete) if (!m_InSelfDelete)
result.Abort();
lock (m_EventQueue)
{ {
m_CurrentResult = null; // m_log.ErrorFormat(
// "[SCRIPT INSTANCE]: Aborting script {0} {1} in prim {2} {3} {4} {5}",
// ScriptName, ItemID, PrimName, ObjectID, m_InSelfDelete, DateTime.Now.Ticks);
workItem.Abort();
}
lock (EventQueue)
{
m_CurrentWorkItem = null;
} }
return true; return true;
@ -603,10 +566,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
throw new EventAbortException(); throw new EventAbortException();
} }
/// <summary>
/// Post an event to this script instance.
/// </summary>
/// <remarks>
/// The request to run the event is sent
/// </remarks>
/// <param name="data"></param>
public void PostEvent(EventParams data) public void PostEvent(EventParams data)
{ {
// m_log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}", // m_log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}",
// m_PrimName, m_ScriptName, data.EventName, m_State); // PrimName, ScriptName, data.EventName, State);
if (!Running) if (!Running)
return; return;
@ -621,9 +591,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_nextEventTimeTicks = DateTime.Now.Ticks + m_eventDelayTicks; m_nextEventTimeTicks = DateTime.Now.Ticks + m_eventDelayTicks;
} }
lock (m_EventQueue) lock (EventQueue)
{ {
if (m_EventQueue.Count >= m_MaxScriptQueue) if (EventQueue.Count >= m_MaxScriptQueue)
return; return;
if (data.EventName == "timer") if (data.EventName == "timer")
@ -667,11 +637,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_CollisionInQueue = true; m_CollisionInQueue = true;
} }
m_EventQueue.Enqueue(data); EventQueue.Enqueue(data);
if (m_CurrentResult == null) if (m_CurrentWorkItem == null)
{ {
m_CurrentResult = m_Engine.QueueEventHandler(this); m_CurrentWorkItem = Engine.QueueEventHandler(this);
} }
} }
} }
@ -682,6 +652,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
/// <returns></returns> /// <returns></returns>
public object EventProcessor() public object EventProcessor()
{ {
// We check here as the thread stopping this instance from running may itself hold the m_Script lock.
if (!Running)
return 0;
lock (m_Script) lock (m_Script)
{ {
// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName); // m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
@ -691,18 +665,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
EventParams data = null; EventParams data = null;
lock (m_EventQueue) lock (EventQueue)
{ {
data = (EventParams) m_EventQueue.Dequeue(); data = (EventParams)EventQueue.Dequeue();
if (data == null) // Shouldn't happen if (data == null) // Shouldn't happen
{ {
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) if (EventQueue.Count > 0 && Running && !ShuttingDown)
{ {
m_CurrentResult = m_Engine.QueueEventHandler(this); m_CurrentWorkItem = Engine.QueueEventHandler(this);
} }
else else
{ {
m_CurrentResult = null; m_CurrentWorkItem = null;
} }
return 0; return 0;
} }
@ -725,28 +699,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (data.EventName == "state") // Hardcoded state change if (data.EventName == "state") // Hardcoded state change
{ {
// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}", // m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
// m_PrimName, m_ScriptName, data.Params[0].ToString()); // PrimName, ScriptName, data.Params[0].ToString());
m_State = data.Params[0].ToString(); State = data.Params[0].ToString();
AsyncCommandManager.RemoveScript(m_Engine, AsyncCommandManager.RemoveScript(Engine,
m_LocalID, m_ItemID); LocalID, ItemID);
SceneObjectPart part = m_Engine.World.GetSceneObjectPart( SceneObjectPart part = Engine.World.GetSceneObjectPart(
m_LocalID); LocalID);
if (part != null) if (part != null)
{ {
part.SetScriptEvents(m_ItemID, part.SetScriptEvents(ItemID,
(int)m_Script.GetStateEventFlags(State)); (int)m_Script.GetStateEventFlags(State));
} }
} }
else else
{ {
if (m_Engine.World.PipeEventsForScript(m_LocalID) || if (Engine.World.PipeEventsForScript(LocalID) ||
data.EventName == "control") // Don't freeze avies! data.EventName == "control") // Don't freeze avies!
{ {
SceneObjectPart part = m_Engine.World.GetSceneObjectPart( SceneObjectPart part = Engine.World.GetSceneObjectPart(
m_LocalID); LocalID);
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
// m_PrimName, m_ScriptName, data.EventName, m_State); // PrimName, ScriptName, data.EventName, State);
try try
{ {
@ -754,8 +728,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_EventStart = DateTime.Now; m_EventStart = DateTime.Now;
m_InEvent = true; m_InEvent = true;
int start = Util.EnvironmentTickCount();
// Reset the measurement period when we reach the end of the current one.
if (start - MeasurementPeriodTickStart > MaxMeasurementPeriod)
MeasurementPeriodTickStart = start;
m_Script.ExecuteEvent(State, data.EventName, data.Params); m_Script.ExecuteEvent(State, data.EventName, data.Params);
MeasurementPeriodExecutionTime += Util.EnvironmentTickCount() - start;
m_InEvent = false; m_InEvent = false;
m_CurrentEvent = String.Empty; m_CurrentEvent = String.Empty;
@ -764,7 +746,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
// This will be the very first event we deliver // This will be the very first event we deliver
// (state_entry) in default state // (state_entry) in default state
// //
SaveState(m_Assembly); SaveState(m_Assembly);
m_SaveState = false; m_SaveState = false;
@ -788,7 +769,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (text.Length > 1000) if (text.Length > 1000)
text = text.Substring(0, 1000); text = text.Substring(0, 1000);
m_Engine.World.SimChat(Utils.StringToBytes(text), Engine.World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647, ChatTypeEnum.DebugChannel, 2147483647,
part.AbsolutePosition, part.AbsolutePosition,
part.Name, part.UUID, false); part.Name, part.UUID, false);
@ -810,27 +791,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{ {
m_InSelfDelete = true; m_InSelfDelete = true;
if (part != null) if (part != null)
m_Engine.World.DeleteSceneObject(part.ParentGroup, false); Engine.World.DeleteSceneObject(part.ParentGroup, false);
} }
else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException)) else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
{ {
m_InSelfDelete = true; m_InSelfDelete = true;
if (part != null) if (part != null)
part.Inventory.RemoveInventoryItem(m_ItemID); part.Inventory.RemoveInventoryItem(ItemID);
} }
} }
} }
} }
lock (m_EventQueue) // If there are more events and we are currently running and not shutting down, then ask the
// script engine to run the next event.
lock (EventQueue)
{ {
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) if (EventQueue.Count > 0 && Running && !ShuttingDown)
{ {
m_CurrentResult = m_Engine.QueueEventHandler(this); m_CurrentWorkItem = Engine.QueueEventHandler(this);
} }
else else
{ {
m_CurrentResult = null; m_CurrentWorkItem = null;
} }
} }
@ -859,15 +842,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ReleaseControls(); ReleaseControls();
Stop(0); Stop(0);
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID); SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
part.Inventory.GetInventoryItem(m_ItemID).PermsMask = 0; part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
part.Inventory.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero; part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID); AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
m_EventQueue.Clear(); EventQueue.Clear();
m_Script.ResetVars(); m_Script.ResetVars();
m_State = "default"; State = "default";
part.SetScriptEvents(m_ItemID, part.SetScriptEvents(ItemID,
(int)m_Script.GetStateEventFlags(State)); (int)m_Script.GetStateEventFlags(State));
if (running) if (running)
Start(); Start();
@ -884,16 +867,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
ReleaseControls(); ReleaseControls();
m_Script.ResetVars(); m_Script.ResetVars();
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID); SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
part.Inventory.GetInventoryItem(m_ItemID).PermsMask = 0; part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
part.Inventory.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero; part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID); AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
m_EventQueue.Clear(); EventQueue.Clear();
m_Script.ResetVars(); m_Script.ResetVars();
m_State = "default"; State = "default";
part.SetScriptEvents(m_ItemID, part.SetScriptEvents(ItemID,
(int)m_Script.GetStateEventFlags(State)); (int)m_Script.GetStateEventFlags(State));
if (m_CurrentEvent != "state_entry") if (m_CurrentEvent != "state_entry")
@ -940,8 +923,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void SaveState(string assembly) public void SaveState(string assembly)
{ {
// If we're currently in an event, just tell it to save upon return // If we're currently in an event, just tell it to save upon return
// //
if (m_InEvent) if (m_InEvent)
@ -950,7 +931,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
return; return;
} }
PluginData = AsyncCommandManager.GetSerializationData(m_Engine, m_ItemID); PluginData = AsyncCommandManager.GetSerializationData(Engine, ItemID);
string xml = ScriptSerializer.Serialize(this); string xml = ScriptSerializer.Serialize(this);
@ -962,7 +943,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{ {
try try
{ {
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")); FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state"));
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
Byte[] buf = enc.GetBytes(xml); Byte[] buf = enc.GetBytes(xml);
fs.Write(buf, 0, buf.Length); fs.Write(buf, 0, buf.Length);
@ -972,7 +953,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{ {
// m_log.Error("Unable to save xml\n"+e.ToString()); // m_log.Error("Unable to save xml\n"+e.ToString());
} }
//if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"))) //if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")))
//{ //{
// throw new Exception("Completed persistence save, but no file was created"); // throw new Exception("Completed persistence save, but no file was created");
//} //}
@ -989,7 +970,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public override string ToString() public override string ToString()
{ {
return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName); return String.Format("{0} {1} on {2}", ScriptName, ItemID, PrimName);
} }
string FormatException(Exception e) string FormatException(Exception e)
@ -1057,7 +1038,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
// Force an update of the in-memory plugin data // Force an update of the in-memory plugin data
// //
PluginData = AsyncCommandManager.GetSerializationData(m_Engine, m_ItemID); PluginData = AsyncCommandManager.GetSerializationData(Engine, ItemID);
return ScriptSerializer.Serialize(this); return ScriptSerializer.Serialize(this);
} }

View File

@ -0,0 +1,168 @@
/*
* 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.Text;
using log4net;
using Nini.Config;
using NUnit.Framework;
using OpenMetaverse;
using OpenMetaverse.Assets;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
using OpenSim.Region.OptionalModules.World.NPC;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
namespace OpenSim.Region.ScriptEngine.Shared.Tests
{
/// <summary>
/// Tests for inventory functions in LSL
/// </summary>
[TestFixture]
public class LSL_ApiInventoryTests
{
protected Scene m_scene;
protected XEngine.XEngine m_engine;
[SetUp]
public void SetUp()
{
IConfigSource initConfigSource = new IniConfigSource();
IConfig config = initConfigSource.AddConfig("XEngine");
config.Set("Enabled", "true");
m_scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(m_scene, initConfigSource);
m_engine = new XEngine.XEngine();
m_engine.Initialise(initConfigSource);
m_engine.AddRegion(m_scene);
}
/// <summary>
/// Test giving inventory from an object to an object where both are owned by the same user.
/// </summary>
[Test]
public void TestLlGiveInventoryO2OSameOwner()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID userId = TestHelpers.ParseTail(0x1);
string inventoryItemName = "item1";
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, userId, "so1", 0x10);
m_scene.AddSceneObject(so1);
// Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20);
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId);
LSL_Api api = new LSL_Api();
api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
// Create a second object
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
m_scene.AddSceneObject(so2);
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
// Item has copy permissions so original should stay intact.
List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
Assert.That(originalItems.Count, Is.EqualTo(1));
List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
Assert.That(copiedItems.Count, Is.EqualTo(1));
Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
}
/// <summary>
/// Test giving inventory from an object to an object where they have different owners
/// </summary>
[Test]
public void TestLlGiveInventoryO2ODifferentOwners()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID user1Id = TestHelpers.ParseTail(0x1);
UUID user2Id = TestHelpers.ParseTail(0x2);
string inventoryItemName = "item1";
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
m_scene.AddSceneObject(so1);
LSL_Api api = new LSL_Api();
api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
// Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20);
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
// Create a second object
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
m_scene.AddSceneObject(so2);
LSL_Api api2 = new LSL_Api();
api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, so2.RootPart.UUID);
// *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
{
// Item has copy permissions so original should stay intact.
List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
Assert.That(originalItems.Count, Is.EqualTo(1));
// Should have not copied
List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
Assert.That(copiedItems.Count, Is.EqualTo(0));
}
// *** Secondly, we turn on allow inventory drop in the target and retest. ***
api2.llAllowInventoryDrop(1);
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
{
// Item has copy permissions so original should stay intact.
List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
Assert.That(originalItems.Count, Is.EqualTo(1));
// Should now have copied.
List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
Assert.That(copiedItems.Count, Is.EqualTo(1));
Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
}
}
}
}

View File

@ -46,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[TestFixture, LongRunning] [TestFixture, LongRunning]
public class LSL_ApiTest public class LSL_ApiTest
{ {
private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d;
private const float FLOAT_ACCURACY = 0.00005f; private const float FLOAT_ACCURACY = 0.00005f;
@ -55,7 +54,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[SetUp] [SetUp]
public void SetUp() public void SetUp()
{ {
IConfigSource initConfigSource = new IniConfigSource(); IConfigSource initConfigSource = new IniConfigSource();
IConfig config = initConfigSource.AddConfig("XEngine"); IConfig config = initConfigSource.AddConfig("XEngine");
config.Set("Enabled", "true"); config.Set("Enabled", "true");
@ -75,6 +73,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestllAngleBetween() public void TestllAngleBetween()
{ {
TestHelpers.InMethod();
CheckllAngleBetween(new Vector3(1, 0, 0), 0, 1, 1); CheckllAngleBetween(new Vector3(1, 0, 0), 0, 1, 1);
CheckllAngleBetween(new Vector3(1, 0, 0), 90, 1, 1); CheckllAngleBetween(new Vector3(1, 0, 0), 90, 1, 1);
CheckllAngleBetween(new Vector3(1, 0, 0), 180, 1, 1); CheckllAngleBetween(new Vector3(1, 0, 0), 180, 1, 1);
@ -158,6 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// llRot2Euler test. // llRot2Euler test.
public void TestllRot2Euler() public void TestllRot2Euler()
{ {
TestHelpers.InMethod();
// 180, 90 and zero degree rotations. // 180, 90 and zero degree rotations.
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f)); CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f));
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.707107f, 0.707107f)); CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.707107f, 0.707107f));
@ -256,6 +258,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// llSetPrimitiveParams and llGetPrimitiveParams test. // llSetPrimitiveParams and llGetPrimitiveParams test.
public void TestllSetPrimitiveParams() public void TestllSetPrimitiveParams()
{ {
TestHelpers.InMethod();
// Create Prim1. // Create Prim1.
Scene scene = SceneHelpers.SetupScene(); Scene scene = SceneHelpers.SetupScene();
string obj1Name = "Prim1"; string obj1Name = "Prim1";
@ -486,9 +490,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
} }
[Test] [Test]
// llVecNorm test.
public void TestllVecNorm() public void TestllVecNorm()
{ {
TestHelpers.InMethod();
// Check special case for normalizing zero vector. // Check special case for normalizing zero vector.
CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d));
// Check various vectors. // Check various vectors.

View File

@ -213,6 +213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestConstructFromInt() public void TestConstructFromInt()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
foreach (KeyValuePair<int, double> number in m_intDoubleSet) foreach (KeyValuePair<int, double> number in m_intDoubleSet)
@ -228,6 +230,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestConstructFromDouble() public void TestConstructFromDouble()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
@ -243,6 +247,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastLSLFloatToInt() public void TestExplicitCastLSLFloatToInt()
{ {
TestHelpers.InMethod();
int testNumber; int testNumber;
foreach (KeyValuePair<double, int> number in m_doubleIntSet) foreach (KeyValuePair<double, int> number in m_doubleIntSet)
@ -258,6 +264,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastLSLFloatToUint() public void TestExplicitCastLSLFloatToUint()
{ {
TestHelpers.InMethod();
uint testNumber; uint testNumber;
foreach (KeyValuePair<double, int> number in m_doubleUintSet) foreach (KeyValuePair<double, int> number in m_doubleUintSet)
@ -273,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestImplicitCastLSLFloatToBooleanTrue() public void TestImplicitCastLSLFloatToBooleanTrue()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
bool testBool; bool testBool;
@ -291,6 +301,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestImplicitCastLSLFloatToBooleanFalse() public void TestImplicitCastLSLFloatToBooleanFalse()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0); LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0);
bool testBool = testFloat; bool testBool = testFloat;
@ -303,6 +315,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestImplicitCastIntToLSLFloat() public void TestImplicitCastIntToLSLFloat()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
foreach (int number in m_intList) foreach (int number in m_intList)
@ -318,6 +332,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestImplicitCastLSLIntegerToLSLFloat() public void TestImplicitCastLSLIntegerToLSLFloat()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
foreach (int number in m_intList) foreach (int number in m_intList)
@ -333,6 +349,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastLSLIntegerToLSLFloat() public void TestExplicitCastLSLIntegerToLSLFloat()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
foreach (int number in m_intList) foreach (int number in m_intList)
@ -348,6 +366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastStringToLSLFloat() public void TestExplicitCastStringToLSLFloat()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
foreach (KeyValuePair<string, double> number in m_stringDoubleSet) foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
@ -363,6 +383,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastLSLStringToLSLFloat() public void TestExplicitCastLSLStringToLSLFloat()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
foreach (KeyValuePair<string, double> number in m_stringDoubleSet) foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
@ -378,6 +400,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestImplicitCastDoubleToLSLFloat() public void TestImplicitCastDoubleToLSLFloat()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
foreach (double number in m_doubleList) foreach (double number in m_doubleList)
@ -393,6 +417,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestImplicitCastLSLFloatToDouble() public void TestImplicitCastLSLFloatToDouble()
{ {
TestHelpers.InMethod();
double testNumber; double testNumber;
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
@ -411,9 +437,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastLSLFloatToFloat() public void TestExplicitCastLSLFloatToFloat()
{ {
TestHelpers.InMethod();
float testFloat; float testFloat;
float numberAsFloat; float numberAsFloat;
LSL_Types.LSLFloat testLSLFloat; LSL_Types.LSLFloat testLSLFloat;
foreach (double number in m_doubleList) foreach (double number in m_doubleList)
{ {
testLSLFloat = new LSL_Types.LSLFloat(number); testLSLFloat = new LSL_Types.LSLFloat(number);
@ -424,13 +453,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
} }
} }
/// <summary> /// <summary>
/// Tests the equality (==) operator. /// Tests the equality (==) operator.
/// </summary> /// </summary>
[Test] [Test]
public void TestEqualsOperator() public void TestEqualsOperator()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloatA, testFloatB; LSL_Types.LSLFloat testFloatA, testFloatB;
foreach (double number in m_doubleList) foreach (double number in m_doubleList)
@ -450,6 +480,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestNotEqualOperator() public void TestNotEqualOperator()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloatA, testFloatB; LSL_Types.LSLFloat testFloatA, testFloatB;
foreach (double number in m_doubleList) foreach (double number in m_doubleList)
@ -469,6 +501,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestIncrementOperator() public void TestIncrementOperator()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
double testNumber; double testNumber;
@ -493,6 +527,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestDecrementOperator() public void TestDecrementOperator()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
double testNumber; double testNumber;
@ -517,6 +553,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestToString() public void TestToString()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
foreach (KeyValuePair<double, string> number in m_doubleStringSet) foreach (KeyValuePair<double, string> number in m_doubleStringSet)
@ -532,6 +570,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestAddTwoLSLFloats() public void TestAddTwoLSLFloats()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testResult; LSL_Types.LSLFloat testResult;
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
@ -547,6 +587,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestSubtractTwoLSLFloats() public void TestSubtractTwoLSLFloats()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testResult; LSL_Types.LSLFloat testResult;
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
@ -562,6 +604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestMultiplyTwoLSLFloats() public void TestMultiplyTwoLSLFloats()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testResult; LSL_Types.LSLFloat testResult;
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
@ -577,6 +621,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestDivideTwoLSLFloats() public void TestDivideTwoLSLFloats()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testResult; LSL_Types.LSLFloat testResult;
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
@ -595,6 +641,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestImplicitCastBooleanToLSLFloat() public void TestImplicitCastBooleanToLSLFloat()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testFloat; LSL_Types.LSLFloat testFloat;
testFloat = (1 == 0); testFloat = (1 == 0);

View File

@ -79,6 +79,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastLSLFloatToLSLInteger() public void TestExplicitCastLSLFloatToLSLInteger()
{ {
TestHelpers.InMethod();
LSL_Types.LSLInteger testInteger; LSL_Types.LSLInteger testInteger;
foreach (KeyValuePair<double, int> number in m_doubleIntSet) foreach (KeyValuePair<double, int> number in m_doubleIntSet)
@ -94,6 +96,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastStringToLSLInteger() public void TestExplicitCastStringToLSLInteger()
{ {
TestHelpers.InMethod();
LSL_Types.LSLInteger testInteger; LSL_Types.LSLInteger testInteger;
foreach (KeyValuePair<string, int> number in m_stringIntSet) foreach (KeyValuePair<string, int> number in m_stringIntSet)
@ -109,6 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastLSLStringToLSLInteger() public void TestExplicitCastLSLStringToLSLInteger()
{ {
TestHelpers.InMethod();
LSL_Types.LSLInteger testInteger; LSL_Types.LSLInteger testInteger;
foreach (KeyValuePair<string, int> number in m_stringIntSet) foreach (KeyValuePair<string, int> number in m_stringIntSet)
@ -124,6 +130,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestImplicitCastBooleanToLSLInteger() public void TestImplicitCastBooleanToLSLInteger()
{ {
TestHelpers.InMethod();
LSL_Types.LSLInteger testInteger; LSL_Types.LSLInteger testInteger;
testInteger = (1 == 0); testInteger = (1 == 0);

View File

@ -71,6 +71,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestConstructFromLSLFloat() public void TestConstructFromLSLFloat()
{ {
TestHelpers.InMethod();
LSL_Types.LSLString testString; LSL_Types.LSLString testString;
foreach (KeyValuePair<double, string> number in m_doubleStringSet) foreach (KeyValuePair<double, string> number in m_doubleStringSet)
@ -86,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastLSLFloatToLSLString() public void TestExplicitCastLSLFloatToLSLString()
{ {
TestHelpers.InMethod();
LSL_Types.LSLString testString; LSL_Types.LSLString testString;
foreach (KeyValuePair<double, string> number in m_doubleStringSet) foreach (KeyValuePair<double, string> number in m_doubleStringSet)
@ -101,6 +105,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestExplicitCastLSLStringToQuaternion() public void TestExplicitCastLSLStringToQuaternion()
{ {
TestHelpers.InMethod();
string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>"; string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>";
LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString); LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString);
@ -118,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestImplicitCastBooleanToLSLFloat() public void TestImplicitCastBooleanToLSLFloat()
{ {
TestHelpers.InMethod();
LSL_Types.LSLString testString; LSL_Types.LSLString testString;
testString = (LSL_Types.LSLString) (1 == 0); testString = (LSL_Types.LSLString) (1 == 0);

View File

@ -44,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestConcatenateString() public void TestConcatenateString()
{ {
TestHelpers.InMethod();
LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
testList += new LSL_Types.LSLString("addition"); testList += new LSL_Types.LSLString("addition");
@ -64,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestConcatenateInteger() public void TestConcatenateInteger()
{ {
TestHelpers.InMethod();
LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
testList += new LSL_Types.LSLInteger(20); testList += new LSL_Types.LSLInteger(20);
@ -84,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestConcatenateDouble() public void TestConcatenateDouble()
{ {
TestHelpers.InMethod();
LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
testList += new LSL_Types.LSLFloat(2.0f); testList += new LSL_Types.LSLFloat(2.0f);
@ -104,6 +110,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestCastLSLIntegerItemToLSLInteger() public void TestCastLSLIntegerItemToLSLInteger()
{ {
TestHelpers.InMethod();
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(123); LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(123);
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -116,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestCastLSLFloatItemToLSLFloat() public void TestCastLSLFloatItemToLSLFloat()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(123.45678987); LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(123.45678987);
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -128,6 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestCastLSLStringItemToLSLString() public void TestCastLSLStringItemToLSLString()
{ {
TestHelpers.InMethod();
LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello there"); LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello there");
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -140,6 +152,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestCastVector3ItemToVector3() public void TestCastVector3ItemToVector3()
{ {
TestHelpers.InMethod();
LSL_Types.Vector3 testValue = new LSL_Types.Vector3(12.34, 56.987654, 0.00987); LSL_Types.Vector3 testValue = new LSL_Types.Vector3(12.34, 56.987654, 0.00987);
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -151,6 +165,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestCastQuaternionItemToQuaternion() public void TestCastQuaternionItemToQuaternion()
{ {
TestHelpers.InMethod();
LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.34, 56.44323, 765.983421, 0.00987); LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.34, 56.44323, 765.983421, 0.00987);
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -165,6 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestGetLSLIntegerItemForLSLIntegerItem() public void TestGetLSLIntegerItemForLSLIntegerItem()
{ {
TestHelpers.InMethod();
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911); LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911);
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -177,6 +195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestGetLSLFloatItemForLSLFloatItem() public void TestGetLSLFloatItemForLSLFloatItem()
{ {
TestHelpers.InMethod();
LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876); LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876);
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -189,6 +209,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestGetLSLFloatItemForLSLIntegerItem() public void TestGetLSLFloatItemForLSLIntegerItem()
{ {
TestHelpers.InMethod();
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987); LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987);
LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue); LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue);
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -202,6 +224,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestGetLSLStringItemForLSLStringItem() public void TestGetLSLStringItemForLSLStringItem()
{ {
TestHelpers.InMethod();
LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all"); LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all");
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -214,6 +238,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestGetLSLStringItemForKeyItem() public void TestGetLSLStringItemForKeyItem()
{ {
TestHelpers.InMethod();
LSL_Types.key testValue LSL_Types.key testValue
= new LSL_Types.key("98000000-0000-2222-3333-100000001000"); = new LSL_Types.key("98000000-0000-2222-3333-100000001000");
LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue); LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue);
@ -228,6 +254,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestGetVector3ItemForVector3Item() public void TestGetVector3ItemForVector3Item()
{ {
TestHelpers.InMethod();
LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987); LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987);
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -239,6 +267,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestGetQuaternionItemForQuaternionItem() public void TestGetQuaternionItemForQuaternionItem()
{ {
TestHelpers.InMethod();
LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987);
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);
@ -251,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
[Test] [Test]
public void TestGetKeyItemForKeyItem() public void TestGetKeyItemForKeyItem()
{ {
TestHelpers.InMethod();
LSL_Types.key testValue LSL_Types.key testValue
= new LSL_Types.key("00000000-0000-2222-3333-100000001012"); = new LSL_Types.key("00000000-0000-2222-3333-100000001012");
LSL_Types.list testList = new LSL_Types.list(testValue); LSL_Types.list testList = new LSL_Types.list(testValue);

View File

@ -31,17 +31,18 @@ using OpenSim.Tests.Common;
using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared;
namespace OpenSim.Region.ScriptEngine.Shared.Tests namespace OpenSim.Region.ScriptEngine.Shared.Tests
{
[TestFixture]
public class LSL_TypesTestVector3
{ {
/// <summary> /// <summary>
/// Tests for Vector3 /// Tests for Vector3
/// </summary> /// </summary>
[TestFixture]
public class LSL_TypesTestVector3
{
[Test] [Test]
public void TestDotProduct() public void TestDotProduct()
{ {
TestHelpers.InMethod();
// The numbers we test for. // The numbers we test for.
Dictionary<string, double> expectsSet = new Dictionary<string, double>(); Dictionary<string, double> expectsSet = new Dictionary<string, double>();
expectsSet.Add("<1, 2, 3> * <2, 3, 4>", 20.0); expectsSet.Add("<1, 2, 3> * <2, 3, 4>", 20.0);

View File

@ -49,7 +49,10 @@ using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
using OpenSim.Region.ScriptEngine.Shared.CodeTools; using OpenSim.Region.ScriptEngine.Shared.CodeTools;
using OpenSim.Region.ScriptEngine.Shared.Instance; using OpenSim.Region.ScriptEngine.Shared.Instance;
using OpenSim.Region.ScriptEngine.Shared.Api;
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Interfaces;
using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer;
using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>; using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>;
@ -173,12 +176,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
get { return m_ConfigSource; } get { return m_ConfigSource; }
} }
/// <summary>
/// Event fired after the script engine has finished removing a script.
/// </summary>
public event ScriptRemoved OnScriptRemoved; public event ScriptRemoved OnScriptRemoved;
/// <summary>
/// Event fired after the script engine has finished removing a script from an object.
/// </summary>
public event ObjectRemoved OnObjectRemoved; public event ObjectRemoved OnObjectRemoved;
//
// IRegionModule functions
//
public void Initialise(IConfigSource configSource) public void Initialise(IConfigSource configSource)
{ {
if (configSource.Configs["XEngine"] == null) if (configSource.Configs["XEngine"] == null)
@ -373,6 +380,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene)) if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
return; return;
MainConsole.Instance.OutputFormat(GetStatusReport());
}
public string GetStatusReport()
{
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName); sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName);
@ -381,12 +393,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine
sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count); sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count);
sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count);
sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads);
sb.AppendFormat("Min threads : {0}\n", m_ThreadPool.MinThreads);
sb.AppendFormat("Allocated threads : {0}\n", m_ThreadPool.ActiveThreads); sb.AppendFormat("Allocated threads : {0}\n", m_ThreadPool.ActiveThreads);
sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads); sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads);
sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks);
// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); // sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count);
MainConsole.Instance.OutputFormat(sb.ToString()); SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this);
sb.AppendFormat("Sensors : {0}\n", sr != null ? sr.SensorsCount : 0);
Dataserver ds = AsyncCommandManager.GetDataserverPlugin(this);
sb.AppendFormat("Dataserver requests : {0}\n", ds != null ? ds.DataserverRequestsCount : 0);
Timer t = AsyncCommandManager.GetTimerPlugin(this);
sb.AppendFormat("Timers : {0}\n", t != null ? t.TimersCount : 0);
Listener l = AsyncCommandManager.GetListenerPlugin(this);
sb.AppendFormat("Listeners : {0}\n", l != null ? l.ListenerCount : 0);
return sb.ToString();
} }
public void HandleShowScripts(string module, string[] cmdparams) public void HandleShowScripts(string module, string[] cmdparams)
@ -973,7 +999,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
lock (m_Scripts) lock (m_Scripts)
{ {
// Create the object record // Create the object record
if ((!m_Scripts.ContainsKey(itemID)) || if ((!m_Scripts.ContainsKey(itemID)) ||
(m_Scripts[itemID].AssetID != assetID)) (m_Scripts[itemID].AssetID != assetID))
{ {
@ -996,11 +1021,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
AppDomain sandbox; AppDomain sandbox;
if (m_AppDomainLoading) if (m_AppDomainLoading)
{
sandbox = AppDomain.CreateDomain( sandbox = AppDomain.CreateDomain(
m_Scene.RegionInfo.RegionID.ToString(), m_Scene.RegionInfo.RegionID.ToString(),
evidence, appSetup); evidence, appSetup);
sandbox.AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
}
else else
{
sandbox = AppDomain.CurrentDomain; sandbox = AppDomain.CurrentDomain;
}
//PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel(); //PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
//AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition(); //AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
@ -1012,9 +1044,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
m_AppDomains[appDomain] = sandbox; m_AppDomains[appDomain] = sandbox;
m_AppDomains[appDomain].AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
m_DomainScripts[appDomain] = new List<UUID>(); m_DomainScripts[appDomain] = new List<UUID>();
} }
catch (Exception e) catch (Exception e)
@ -1063,7 +1092,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (!m_PrimObjects[localID].Contains(itemID)) if (!m_PrimObjects[localID].Contains(itemID))
m_PrimObjects[localID].Add(itemID); m_PrimObjects[localID].Add(itemID);
} }
if (!m_Assemblies.ContainsKey(assetID)) if (!m_Assemblies.ContainsKey(assetID))
@ -1102,7 +1130,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
} }
instance.ClearQueue(); instance.ClearQueue();
instance.Stop(0);
// Give the script some time to finish processing its last event. Simply aborting the script thread can
// cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
instance.Stop(1000);
// bool objectRemoved = false; // bool objectRemoved = false;
lock (m_PrimObjects) lock (m_PrimObjects)
@ -1133,14 +1165,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
UnloadAppDomain(instance.AppDomain); UnloadAppDomain(instance.AppDomain);
} }
instance = null;
ObjectRemoved handlerObjectRemoved = OnObjectRemoved; ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
if (handlerObjectRemoved != null) if (handlerObjectRemoved != null)
{ handlerObjectRemoved(instance.ObjectID);
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
handlerObjectRemoved(part.UUID);
}
ScriptRemoved handlerScriptRemoved = OnScriptRemoved; ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
if (handlerScriptRemoved != null) if (handlerScriptRemoved != null)
@ -1872,6 +1899,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine
} }
} }
public Dictionary<uint, float> GetObjectScriptsExecutionTimes()
{
long tickNow = Util.EnvironmentTickCount();
Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
lock (m_Scripts)
{
foreach (IScriptInstance si in m_Scripts.Values)
{
if (!topScripts.ContainsKey(si.LocalID))
topScripts[si.RootLocalID] = 0;
// long ticksElapsed = tickNow - si.MeasurementPeriodTickStart;
// float framesElapsed = ticksElapsed / (18.1818 * TimeSpan.TicksPerMillisecond);
// Execution time of the script adjusted by it's measurement period to make scripts started at
// different times comparable.
// float adjustedExecutionTime
// = (float)si.MeasurementPeriodExecutionTime
// / ((float)(tickNow - si.MeasurementPeriodTickStart) / ScriptInstance.MaxMeasurementPeriod)
// / TimeSpan.TicksPerMillisecond;
long ticksElapsed = tickNow - si.MeasurementPeriodTickStart;
// Avoid divide by zerp
if (ticksElapsed == 0)
ticksElapsed = 1;
// Scale execution time to the ideal 55 fps frame time for these reasons.
//
// 1) XEngine does not execute scripts per frame, unlike other script engines. Hence, there is no
// 'script execution time per frame', which is the original purpose of this value.
//
// 2) Giving the raw execution times is misleading since scripts start at different times, making
// it impossible to compare scripts.
//
// 3) Scaling the raw execution time to the time that the script has been running is better but
// is still misleading since a script that has just been rezzed may appear to have been running
// for much longer.
//
// 4) Hence, we scale execution time to an idealised frame time (55 fps). This is also not perfect
// since the figure does not represent actual execution time and very hard running scripts will
// never exceed 18ms (though this is a very high number for script execution so is a warning sign).
float adjustedExecutionTime
= ((float)si.MeasurementPeriodExecutionTime / ticksElapsed) * 18.1818f;
topScripts[si.RootLocalID] += adjustedExecutionTime;
}
}
return topScripts;
}
public void SuspendScript(UUID itemID) public void SuspendScript(UUID itemID)
{ {
// m_log.DebugFormat("[XEngine]: Received request to suspend script with ID {0}", itemID); // m_log.DebugFormat("[XEngine]: Received request to suspend script with ID {0}", itemID);

View File

@ -224,14 +224,12 @@ namespace OpenSim.Region.UserStatistics
concurrencyCounter--; concurrencyCounter--;
response_code = 200; response_code = 200;
} }
else else
{ {
strOut = MainServer.Instance.GetHTTP404(""); strOut = MainServer.Instance.GetHTTP404("");
} }
responsedata["int_response_code"] = response_code; responsedata["int_response_code"] = response_code;
responsedata["content_type"] = contenttype; responsedata["content_type"] = contenttype;
responsedata["keepalive"] = false; responsedata["keepalive"] = false;
@ -247,8 +245,8 @@ namespace OpenSim.Region.UserStatistics
// TODO: FIXME: implement stats migrations // TODO: FIXME: implement stats migrations
const string SQL = @"SELECT * FROM migrations LIMIT 1"; const string SQL = @"SELECT * FROM migrations LIMIT 1";
SqliteCommand cmd = new SqliteCommand(SQL, db); using (SqliteCommand cmd = new SqliteCommand(SQL, db))
{
try try
{ {
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -259,31 +257,32 @@ namespace OpenSim.Region.UserStatistics
} }
} }
} }
}
public void CreateTables(SqliteConnection db) public void CreateTables(SqliteConnection db)
{ {
SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db); using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db))
{
createcmd.ExecuteNonQuery(); createcmd.ExecuteNonQuery();
createcmd.CommandText = SQL_MIGRA_TABLE_CREATE; createcmd.CommandText = SQL_MIGRA_TABLE_CREATE;
createcmd.ExecuteNonQuery(); createcmd.ExecuteNonQuery();
} }
}
public virtual void PostInitialise() public virtual void PostInitialise()
{ {
if (!enabled) if (!enabled)
{
return; return;
}
AddHandlers(); AddHandlers();
} }
public virtual void Close() public virtual void Close()
{ {
if (!enabled) if (!enabled)
{
return; return;
}
dbConn.Close(); dbConn.Close();
dbConn.Dispose(); dbConn.Dispose();
m_sessions.Clear(); m_sessions.Clear();
@ -304,7 +303,8 @@ namespace OpenSim.Region.UserStatistics
public void OnRegisterCaps(UUID agentID, Caps caps) public void OnRegisterCaps(UUID agentID, Caps caps)
{ {
m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); // m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
string capsPath = "/CAPS/VS/" + UUID.Random(); string capsPath = "/CAPS/VS/" + UUID.Random();
caps.RegisterHandler("ViewerStats", caps.RegisterHandler("ViewerStats",
new RestStreamHandler("POST", capsPath, new RestStreamHandler("POST", capsPath,
@ -318,7 +318,6 @@ namespace OpenSim.Region.UserStatistics
public void OnDeRegisterCaps(UUID agentID, Caps caps) public void OnDeRegisterCaps(UUID agentID, Caps caps)
{ {
} }
protected virtual void AddHandlers() protected virtual void AddHandlers()
@ -368,7 +367,6 @@ namespace OpenSim.Region.UserStatistics
public void OnMakeChildAgent(ScenePresence agent) public void OnMakeChildAgent(ScenePresence agent)
{ {
} }
public void OnClientClosed(UUID agentID, Scene scene) public void OnClientClosed(UUID agentID, Scene scene)
@ -430,6 +428,7 @@ namespace OpenSim.Region.UserStatistics
return scene.RegionInfo.RegionID; return scene.RegionInfo.RegionID;
} }
} }
return UUID.Zero; return UUID.Zero;
} }
@ -458,14 +457,14 @@ namespace OpenSim.Region.UserStatistics
UserSessionData usd; UserSessionData usd;
OSD message = OSDParser.DeserializeLLSDXml(request); OSD message = OSDParser.DeserializeLLSDXml(request);
OSDMap mmap; OSDMap mmap;
lock (m_sessions) lock (m_sessions)
{ {
if (agentID != UUID.Zero) if (agentID != UUID.Zero)
{ {
if (!m_sessions.ContainsKey(agentID)) if (!m_sessions.ContainsKey(agentID))
{ {
m_log.Warn("[WEB STATS MODULE]: no session for stat disclosure"); m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID);
return new UserSessionID(); return new UserSessionID();
} }
uid = m_sessions[agentID]; uid = m_sessions[agentID];
@ -585,8 +584,6 @@ namespace OpenSim.Region.UserStatistics
usd.n_out_kb = (float)net_out["kbytes"].AsReal(); usd.n_out_kb = (float)net_out["kbytes"].AsReal();
usd.n_out_pk = net_out["packets"].AsInteger(); usd.n_out_pk = net_out["packets"].AsInteger();
} }
} }
} }
@ -602,7 +599,8 @@ namespace OpenSim.Region.UserStatistics
lock (db) lock (db)
{ {
SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db); using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db))
{
updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString())); updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString()));
updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString())); updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString()));
updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString())); updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString()));
@ -656,29 +654,35 @@ namespace OpenSim.Region.UserStatistics
updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet)); updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString())); updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString()));
updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString())); // m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id);
// m_log.Debug("UPDATE");
int result = updatecmd.ExecuteNonQuery(); int result = updatecmd.ExecuteNonQuery();
if (result == 0) if (result == 0)
{ {
// m_log.Debug("INSERT"); // m_log.DebugFormat("[WEB STATS MODULE]: Database stats insert for {0}", uid.session_data.agent_id);
updatecmd.CommandText = SQL_STATS_TABLE_INSERT; updatecmd.CommandText = SQL_STATS_TABLE_INSERT;
// StringBuilder parameters = new StringBuilder();
// SqliteParameterCollection spc = updatecmd.Parameters;
// foreach (SqliteParameter sp in spc)
// parameters.AppendFormat("{0}={1},", sp.ParameterName, sp.Value);
//
// m_log.DebugFormat("[WEB STATS MODULE]: Parameters {0}", parameters);
try try
{ {
updatecmd.ExecuteNonQuery(); updatecmd.ExecuteNonQuery();
} }
catch (SqliteExecutionException) catch (SqliteExecutionException e)
{ {
m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage Execution Exception"); m_log.WarnFormat(
"[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}",
uid.session_data.agent_id, e.Message, e.StackTrace);
} }
catch (SqliteSyntaxException)
{
m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage SQL Syntax Exception");
} }
} }
} }
} }
@ -802,7 +806,7 @@ set session_id=:session_id,
f_off_circuit=:f_off_circuit, f_off_circuit=:f_off_circuit,
f_resent=:f_resent, f_resent=:f_resent,
f_send_packet=:f_send_packet f_send_packet=:f_send_packet
WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"; WHERE session_id=:session_key";
#endregion #endregion
} }

View File

@ -73,6 +73,20 @@ namespace OpenSim.Server.Handlers.Login
if (requestData != null) if (requestData != null)
{ {
// Debug code to show exactly what login parameters the viewer is sending us.
// TODO: Extract into a method that can be generally applied if one doesn't already exist.
// foreach (string key in requestData.Keys)
// {
// object value = requestData[key];
// Console.WriteLine("{0}:{1}", key, value);
// if (value is ArrayList)
// {
// ICollection col = value as ICollection;
// foreach (object item in col)
// Console.WriteLine(" {0}", item);
// }
// }
if (requestData.ContainsKey("first") && requestData["first"] != null && if (requestData.ContainsKey("first") && requestData["first"] != null &&
requestData.ContainsKey("last") && requestData["last"] != null && ( requestData.ContainsKey("last") && requestData["last"] != null && (
(requestData.ContainsKey("passwd") && requestData["passwd"] != null) || (requestData.ContainsKey("passwd") && requestData["passwd"] != null) ||

View File

@ -94,6 +94,5 @@ namespace OpenSim.Server.Handlers.Login
server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
} }
} }
} }

View File

@ -296,8 +296,9 @@ namespace OpenSim.Services.HypergridService
aCircuit.firstname = account.FirstName; aCircuit.firstname = account.FirstName;
aCircuit.lastname = account.LastName; aCircuit.lastname = account.LastName;
} }
if (account == null && !aCircuit.lastname.StartsWith("@")) if (account == null)
{ {
if (!aCircuit.lastname.StartsWith("@"))
aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
try try
{ {

View File

@ -386,7 +386,7 @@ namespace OpenSim.Services.InventoryService
public virtual bool AddItem(InventoryItemBase item) public virtual bool AddItem(InventoryItemBase item)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[XINVENTORY SERVICE]: Adding item {0} to folder {1} for {2}", item.ID, item.Folder, item.Owner); // "[XINVENTORY SERVICE]: Adding item {0} {1} to folder {2} for {3}", item.Name, item.ID, item.Folder, item.Owner);
return m_Database.StoreItem(ConvertFromOpenSim(item)); return m_Database.StoreItem(ConvertFromOpenSim(item));
} }

View File

@ -521,7 +521,7 @@ namespace OpenSim.Services.UserAccountService
else else
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[USER ACCOUNT SERVICE]; Created user inventory for {0} {1}", firstName, lastName); "[USER ACCOUNT SERVICE]: Created user inventory for {0} {1}", firstName, lastName);
} }
if (m_CreateDefaultAvatarEntries) if (m_CreateDefaultAvatarEntries)

View File

@ -56,6 +56,10 @@ namespace pCampBot
{ {
Help(); Help();
} }
else if (config.Get("firstname") == null || config.Get("lastname") == null || config.Get("password") == null)
{
Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots.");
}
else else
{ {
int botcount = config.GetInt("botcount", 1); int botcount = config.GetInt("botcount", 1);

Binary file not shown.

View File

@ -209,49 +209,6 @@ namespace Prebuild.Core.Targets
ss.WriteLine(" <target name=\"{0}\">", "build"); ss.WriteLine(" <target name=\"{0}\">", "build");
ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />"); ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />"); ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">");
ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
foreach (ReferenceNode refr in project.References)
{
if (refr.LocalCopy)
{
ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/'));
}
}
ss.WriteLine(" </fileset>");
ss.WriteLine(" </copy>");
if (project.ConfigFile != null && project.ConfigFile.Length!=0)
{
ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
{
ss.Write(".dll.config\"");
}
else
{
ss.Write(".exe.config\"");
}
ss.WriteLine(" />");
}
// Add the content files to just be copied
ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">");
ss.WriteLine(" {0}", "<fileset basedir=\".\">");
foreach (string file in project.Files)
{
// Ignore if we aren't content
if (project.Files.GetBuildAction(file) != BuildAction.Content)
continue;
// Create a include tag
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
}
ss.WriteLine(" {0}", "</fileset>");
ss.WriteLine(" {0}", "</copy>");
ss.Write(" <csc "); ss.Write(" <csc ");
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower()); ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
<configuration> <configuration>
<dllmap os="osx" dll="sqlite3" target="./libsqlite3.dylib" /> <dllmap os="osx" dll="sqlite3" target="lib64/libsqlite3.dylib" />
<dllmap os="!windows,osx" cpu="x86-64,ia64" wordsize="64" dll="sqlite3" target="./libsqlite3_64.so" /> <dllmap os="!windows,osx" cpu="x86-64,ia64" wordsize="64" dll="sqlite3" target="lib64/libsqlite3_64.so" />
<dllmap os="!windows,osx" cpu="x86" wordsize="32" dll="sqlite3" target="./libsqlite3_32.so" /> <dllmap os="!windows,osx" cpu="x86" wordsize="32" dll="sqlite3" target="lib32/libsqlite3_32.so" />
</configuration> </configuration>

View File

@ -1,7 +1,7 @@
<configuration> <configuration>
<dllmap os="osx" dll="ode" target="libode.dylib" /> <dllmap os="osx" dll="ode" target="lib64/libode.dylib" />
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="ode" target="libode-x86_64" /> <dllmap os="!windows,osx" cpu="x86-64,ia64" dll="ode" target="lib64/libode-x86_64" />
<dllmap os="!windows,osx" cpu="x86" dll="ode" target="libode" /> <dllmap os="!windows,osx" cpu="x86" dll="ode" target="lib32/libode" />
<dllmap os="!windows,osx" cpu="ppc64" dll="ode" target="libode-ppc64" /> <dllmap os="!windows,osx" cpu="ppc64" dll="ode" target="lib64/libode-ppc64" />
<dllmap os="!windows,osx" cpu="s390x" dll="ode" target="libode-s390x" /> <dllmap os="!windows,osx" cpu="s390x" dll="ode" target="lib64/libode-s390x" />
</configuration> </configuration>

View File

@ -1,7 +1,7 @@
<configuration> <configuration>
<dllmap os="osx" dll="openjpeg-dotnet.dll" target="libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib" /> <dllmap os="osx" dll="openjpeg-dotnet.dll" target="lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib" />
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet.dll" target="libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64" /> <dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet.dll" target="lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64" />
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet-x86_64.dll" target="libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64" /> <dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet-x86_64.dll" target="lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64" />
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet.dll" target="libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686" /> <dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet.dll" target="lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686" />
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet-x86_64.dll" target="libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686" /> <dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet-x86_64.dll" target="lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686" />
</configuration> </configuration>

View File

@ -36,7 +36,6 @@
[Startup] [Startup]
;# {ConsolePrompt} {} {ConsolePrompt} {} "Region (\R) " ;# {ConsolePrompt} {} {ConsolePrompt} {} "Region (\R) "
;; Console prompt ;; Console prompt
;; Certain special characters can be used to customize the prompt ;; Certain special characters can be used to customize the prompt
@ -173,6 +172,7 @@
;# {permissionmodules} {} {Permission modules to use (may specify multiple modules, separated by comma} {} DefaultPermissionsModule ;# {permissionmodules} {} {Permission modules to use (may specify multiple modules, separated by comma} {} DefaultPermissionsModule
;; Permission modules to use, separated by comma. ;; Permission modules to use, separated by comma.
;; Possible modules are DefaultPermissionsModule, PrimLimitsModule
; permissionmodules = DefaultPermissionsModule ; permissionmodules = DefaultPermissionsModule
;# {serverside_object_permissions} {permissionmodules:DefaultPermissionsModule} {Activate permission handling by the sim?} {true false} true ;# {serverside_object_permissions} {permissionmodules:DefaultPermissionsModule} {Activate permission handling by the sim?} {true false} true
@ -194,6 +194,15 @@
; region_manager_is_god = false ; region_manager_is_god = false
; parcel_owner_is_god = true ; parcel_owner_is_god = true
;; More control over permissions
;; This is definitely not SL!
; Provides a simple control for land owners to give build rights to specific avatars
; in publicly accessible parcels that disallow object creation in general.
; Owners specific avatars by adding them to the Access List of the parcel
; without having to use the Groups feature
; simple_build_permissions = false
;; Default script engine to use. Currently, we only have XEngine ;; Default script engine to use. Currently, we only have XEngine
; DefaultScriptEngine = "XEngine" ; DefaultScriptEngine = "XEngine"
@ -773,11 +782,9 @@
;# {Enabled} {} {Enable Non Player Character (NPC) facilities} {true false} false ;# {Enabled} {} {Enable Non Player Character (NPC) facilities} {true false} false
; Enabled = false ; Enabled = false
[Terrain]
[PrimLimitsModule] ;# {InitialTerrain} {} {Initial terrain type} {pinhead-island flat} pinhead-island
;# {EnforcePrimLimits} {} {Enforce parcel prim limits} {true false} false ; InitialTerrain = "pinhead-island"
;; Enable parcel prim limits. Off by default to emulate pre-existing behavior.
; EnforcePrimLimits = false
[Architecture] [Architecture]

View File

@ -260,6 +260,14 @@
; Default value is all ; Default value is all
; allowed_script_editors = all ; allowed_script_editors = all
; Provides a simple control for land owners to give build rights to specific avatars
; in publicly accessible parcels that disallow object creation in general.
; Owners specific avatars by adding them to the Access List of the parcel
; without having to use the Groups feature
; Disabled by default
; simple_build_permissions = False
; ## ; ##
; ## SCRIPT ENGINE ; ## SCRIPT ENGINE
; ## ; ##
@ -579,13 +587,12 @@
Cap_ViewerStartAuction = "" Cap_ViewerStartAuction = ""
Cap_ViewerStats = "" Cap_ViewerStats = ""
; The various fetch inventory caps are supported by OpenSim, but may ; Capabilities for fetching inventory over HTTP rather than UDP
; lead to poor sim performance if served by the simulators,
; so they are currently disabled by default.
; FetchInventoryDescendents2 and FetchInventory2 are the ones used in the latest Linden Lab viewers (from some point in the v2 series and above) ; FetchInventoryDescendents2 and FetchInventory2 are the ones used in the latest Linden Lab viewers (from some point in the v2 series and above)
; It appears that Linden Lab viewer 3.3.1 onwards will not work properly if FetchInventoryDescendents2 and FetchInventory2 are not enabled
Cap_WebFetchInventoryDescendents = "" Cap_WebFetchInventoryDescendents = ""
Cap_FetchInventoryDescendents2 = "" Cap_FetchInventoryDescendents2 = "localhost"
Cap_FetchInventory2 = "" Cap_FetchInventory2 = "localhost"
[Chat] [Chat]
@ -1512,6 +1519,9 @@
;; Enable Non Player Character (NPC) facilities ;; Enable Non Player Character (NPC) facilities
Enabled = false Enabled = false
[Terrain]
InitialTerrain = "pinhead-island"
;; ;;
;; If you are using a simian grid frontend you can enable ;; If you are using a simian grid frontend you can enable
;; this module to upload tile images for the mapping fn ;; this module to upload tile images for the mapping fn

Binary file not shown.

View File

@ -14,6 +14,7 @@
AvatarServices = "RemoteAvatarServicesConnector" AvatarServices = "RemoteAvatarServicesConnector"
NeighbourServices = "RemoteNeighbourServicesConnector" NeighbourServices = "RemoteNeighbourServicesConnector"
AuthenticationServices = "RemoteAuthenticationServicesConnector" AuthenticationServices = "RemoteAuthenticationServicesConnector"
AuthorizationServices = "LocalAuthorizationServicesConnector"
PresenceServices = "RemotePresenceServicesConnector" PresenceServices = "RemotePresenceServicesConnector"
UserAccountServices = "RemoteUserAccountServicesConnector" UserAccountServices = "RemoteUserAccountServicesConnector"
GridUserServices = "RemoteGridUserServicesConnector" GridUserServices = "RemoteGridUserServicesConnector"

View File

@ -146,3 +146,13 @@
[MapImageService] [MapImageService]
MapImageServerURI = "http://mygridserver.com:8003" MapImageServerURI = "http://mygridserver.com:8003"
[AuthorizationService]
; If you have regions with access restrictions
; specify them here using the convention
; Region_<Region_Name> = <flags>
; Valid flags are:
; DisallowForeigners -- HG visitors not allowed
; DisallowResidents -- only Admins and Managers allowed
; Example:
; Region_Test_1 = "DisallowForeigners"

View File

@ -17,6 +17,7 @@
AvatarServices = "RemoteAvatarServicesConnector" AvatarServices = "RemoteAvatarServicesConnector"
NeighbourServices = "RemoteNeighbourServicesConnector" NeighbourServices = "RemoteNeighbourServicesConnector"
AuthenticationServices = "RemoteAuthenticationServicesConnector" AuthenticationServices = "RemoteAuthenticationServicesConnector"
AuthorizationServices = "LocalAuthorizationServicesConnector"
PresenceServices = "RemotePresenceServicesConnector" PresenceServices = "RemotePresenceServicesConnector"
UserAccountServices = "RemoteUserAccountServicesConnector" UserAccountServices = "RemoteUserAccountServicesConnector"
GridUserServices = "RemoteGridUserServicesConnector" GridUserServices = "RemoteGridUserServicesConnector"

View File

@ -9,6 +9,7 @@
InventoryServices = "LocalInventoryServicesConnector" InventoryServices = "LocalInventoryServicesConnector"
NeighbourServices = "LocalNeighbourServicesConnector" NeighbourServices = "LocalNeighbourServicesConnector"
AuthenticationServices = "LocalAuthenticationServicesConnector" AuthenticationServices = "LocalAuthenticationServicesConnector"
AuthorizationServices = "LocalAuthorizationServicesConnector"
GridServices = "LocalGridServicesConnector" GridServices = "LocalGridServicesConnector"
PresenceServices = "LocalPresenceServicesConnector" PresenceServices = "LocalPresenceServicesConnector"
UserAccountServices = "LocalUserAccountServicesConnector" UserAccountServices = "LocalUserAccountServicesConnector"
@ -47,9 +48,6 @@
[AvatarService] [AvatarService]
LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService" LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService"
[AuthorizationService]
LocalServiceModule = "OpenSim.Services.AuthorizationService.dll:AuthorizationService"
[AuthenticationService] [AuthenticationService]
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"

View File

@ -231,3 +231,13 @@
[MapImageService] [MapImageService]
; Set this if you want to change the default ; Set this if you want to change the default
; TilesStoragePath = "maptiles" ; TilesStoragePath = "maptiles"
[AuthorizationService]
; If you have regions with access restrictions
; specify them here using the convention
; Region_<Region_Name> = <flags>
; Valid flags are:
; DisallowForeigners -- HG visitors not allowed
; DisallowResidents -- only Admins and Managers allowed
; Example:
; Region_Test_1 = "DisallowForeigners"

View File

@ -12,6 +12,7 @@
InventoryServices = "HGInventoryBroker" InventoryServices = "HGInventoryBroker"
NeighbourServices = "LocalNeighbourServicesConnector" NeighbourServices = "LocalNeighbourServicesConnector"
AuthenticationServices = "LocalAuthenticationServicesConnector" AuthenticationServices = "LocalAuthenticationServicesConnector"
AuthorizationServices = "LocalAuthorizationServicesConnector"
GridServices = "LocalGridServicesConnector" GridServices = "LocalGridServicesConnector"
PresenceServices = "LocalPresenceServicesConnector" PresenceServices = "LocalPresenceServicesConnector"
UserAccountServices = "LocalUserAccountServicesConnector" UserAccountServices = "LocalUserAccountServicesConnector"
@ -68,9 +69,6 @@
LibraryName = "OpenSim Library" LibraryName = "OpenSim Library"
DefaultLibrary = "./inventory/Libraries.xml" DefaultLibrary = "./inventory/Libraries.xml"
[AuthorizationService]
LocalServiceModule = "OpenSim.Services.AuthorizationService.dll:AuthorizationService"
[AuthenticationService] [AuthenticationService]
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"

Some files were not shown because too many files have changed in this diff Show More