Compare commits

..

646 Commits

Author SHA1 Message Date
UbitUmarov 4f00fb2659 flotsam: minor log message change 2020-07-30 21:18:58 +01:00
UbitUmarov 87b55a0627 flotsam: still bad 2020-07-30 21:14:15 +01:00
UbitUmarov 3b06891252 dont break asset cache folders spread more than needed 2020-07-30 18:10:06 +01:00
UbitUmarov 111c741f1b flotsam: change the changes 2020-07-30 01:40:54 +01:00
UbitUmarov 1c37f357b3 flotsam: more changes 2020-07-30 01:39:04 +01:00
UbitUmarov c19a0cc21f flotsam: deeper changes on files expire 2020-07-30 00:02:02 +01:00
UbitUmarov c575c211f9 flotsam: slower... 2020-07-28 21:01:45 +01:00
UbitUmarov bd2476c61e flotsam: slow it a lot more, make some debug log visible 2020-07-28 04:26:13 +01:00
UbitUmarov d52b794828 flotsam add a cooldown on files expire/deletes also 2020-07-28 02:57:41 +01:00
UbitUmarov cbc8974245 duuhhhh what was in my coffe ? 2020-07-27 18:17:09 +01:00
UbitUmarov e2982fbadc make clear that MaxRegionsViewDistance can be set to zero, disabling nearby regions visibility and crossings 2020-07-27 18:05:38 +01:00
UbitUmarov c4a0b8fa3f fix the option name on the ini file 2020-07-27 16:39:40 +01:00
UbitUmarov be5c2bb212 Xengine: remove option CompactMemOnLoad, that wasn't that good; add option AttachmentsDomainLoading to allow attachments to load on own appdomain even if AppDomainLoading is false. Scripts will be slower, use more memory but will be disposed on avatar leave, if gc is in good mood. This may be usefull on regions with a lot of traffic, sure use Yengine even better, 2020-07-27 16:13:09 +01:00
UbitUmarov 0c716cbd73 remove async await no longer used 2020-07-24 19:24:34 +01:00
UbitUmarov e08ca7402c reduce default http keepalive to just 30s because to viewers connections flood. 2020-07-24 19:19:16 +01:00
UbitUmarov d9a680703f cosmetics on http server 2020-07-24 17:12:38 +01:00
UbitUmarov e0aff5e640 avoid some null refs 2020-07-24 13:24:55 +01:00
UbitUmarov bb56157c92 remove a forgotten gc collect on flotsam cache 2020-07-23 23:11:59 +01:00
UbitUmarov 6fafb7462d avoid ethernal references 2020-07-23 19:39:45 +01:00
UbitUmarov c077cfdd78 bad c&p 2020-07-23 19:08:25 +01:00
UbitUmarov c2af3a5474 avoid ethernal references 2020-07-23 19:04:56 +01:00
UbitUmarov 25582af3dc lludpclient: use jobengine again, keeping less ethernal references 2020-07-23 18:35:34 +01:00
UbitUmarov 03e3078a9f add fixed skys to opensim library 2020-07-21 18:17:00 +01:00
UbitUmarov 6e15cf41a4 fix new sky ambient color; Rainbow texture with retouch fro AI Austin (red side gradient) 2020-07-21 17:38:11 +01:00
UbitUmarov 53b9f87da6 change defauld sky cloud D parameter 2020-07-19 21:50:56 +01:00
UbitUmarov baa95b8707 add/change some assets 2020-07-19 10:45:02 +01:00
UbitUmarov 730c864df8 add another asset. This may not be that good still :( 2020-07-16 23:27:03 +01:00
UbitUmarov ce92ee1057 cache bad folders requests for 30s. Suitcase can induce a ton of this, and viewers keep requesting 2020-07-16 18:23:17 +01:00
UbitUmarov 7a55f82f74 add a expire cache for simple items that can be a stored on a dictionary key, not value 2020-07-16 18:17:04 +01:00
UbitUmarov 1f822c6077 allow the use of Sky or water from a asset, not just full daycycle. This may need more work 2020-07-15 22:56:09 +01:00
UbitUmarov f7104a66a5 change parcel env group power check to only parcel environment modify 2020-07-15 22:52:47 +01:00
UbitUmarov 4176e1491e missing file 2020-07-15 19:42:40 +01:00
UbitUmarov 4bc74139a4 dispose prematurely discon sockets 2020-07-15 19:15:11 +01:00
UbitUmarov 402186844c cosmetics 2020-07-15 19:13:22 +01:00
UbitUmarov 6a27f3fb20 useless changes 2020-07-15 05:15:32 +01:00
UbitUmarov 6c5bf4ed25 useless cosmetics 2020-07-15 01:40:53 +01:00
UbitUmarov f32c0ead05 avoid c# fun things, plus cosmetics 2020-07-14 17:54:58 +01:00
UbitUmarov b2068fd39f give up calling gc.collect on flotsamcache. Did nothing visible and has negative side effects 2020-07-13 23:26:09 +01:00
UbitUmarov ba972b50ed disable console command restart, that currently will just break everything ( there is also the restart module that will do the same if used ) 2020-07-13 21:35:50 +01:00
UbitUmarov fe7d9625aa cosmetics 2020-07-13 06:16:11 +01:00
UbitUmarov 6ba5b78851 check local grid before doing hg fetch asset metadata 2020-07-11 20:48:50 +01:00
UbitUmarov 541cb15751 fix a bug on flotsam getfilename 2020-07-11 20:03:31 +01:00
UbitUmarov ebf5b69283 mantis 8725: increase channeldigger smooth strength, tanks Datapanic 2020-07-10 20:14:14 +01:00
UbitUmarov 82ccf57533 take some asset classes out of ViewerEnvironment.cs to own files 2020-07-10 19:54:40 +01:00
UbitUmarov fe5e6d4189 avoid a null ref during shutdown (one of them..) 2020-07-10 19:35:39 +01:00
UbitUmarov 01b4f83421 change the 4 fixed skys for eep viewers again (sorry). This also fixes the issue of viewers not showing the selected fixed sky. Clear viewer cache. On regions use fcache deletedefaultassets so updated grid ones are used. In alternative use fcache cachedefaultassets to override all default assets by the ones on this commit. Note that this hides the grid ones, and this is lost if you clear the region asset cache 2020-07-10 00:12:36 +01:00
UbitUmarov f334c1206f change Midday asset (uuid 6c83e853-e7f8-cad7-8ee6-5f31c453721c) fixing its water. eep viewers cache needs to be clear, region asset cache needs this entry removed (comand fcache deletedefaultassets will remove default assets from region cache, forcing reload from grid). Normal robust asset services should update it grid side. Otherwise, if already present, you will need to change directly on db 2020-07-09 18:40:48 +01:00
UbitUmarov 107ece1ce0 change default (in code) waterFogDensity 2020-07-09 17:38:31 +01:00
UbitUmarov af6fa37cc2 mantis 8675: flotsam cache only log missing files if log level >= 2 (thanks mewtwo0641 ) this log will include things that may not even be assets due to how gatherer works; change a bit filename composition 2020-07-09 16:27:11 +01:00
UbitUmarov 28fcbc65f9 add GC.collect to flotsam cache expire. This is ugly but so is GC 2020-07-07 17:35:27 +01:00
UbitUmarov e5c2bd505c fix a bug on region eep env set permission 2020-06-30 20:23:51 +01:00
UbitUmarov 5b596bb29e update script syntax 2020-06-30 13:29:42 +01:00
UbitUmarov c4f05016d7 of course merge did messup libomv 2020-06-29 01:30:40 +01:00
UbitUmarov fb35f31078 fix the merge 2020-06-29 01:29:58 +01:00
UbitUmarov 7cf329c846 Merge branch 'master' into uglysky
# Conflicts:
#	OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
#	bin/OpenMetaverse.Rendering.Meshmerizer.dll
#	bin/OpenMetaverse.StructuredData.dll
#	bin/OpenMetaverse.dll
#	bin/OpenMetaverseTypes.dll
2020-06-29 01:28:33 +01:00
UbitUmarov 1c4300ff91 fix a flag name 2020-06-29 01:16:12 +01:00
UbitUmarov 34fa6abc00 do not trust ms documentation about inner stream dispose 2020-06-29 01:03:00 +01:00
UbitUmarov d7fb822533 Merge branch 'master' into uglysky 2020-06-27 13:34:49 +01:00
UbitUmarov 16cfb3deab mantis 8717: fix local heap use account (will automatlic recompile scripts) 2020-06-27 13:33:11 +01:00
UbitUmarov 27a81d4909 minor moon rotation change 2020-06-27 13:16:28 +01:00
UbitUmarov a568b759bc sunphase depends on the env where av is or has 2020-06-26 11:29:31 +01:00
UbitUmarov 71d8bcd90c missed other 2020-06-25 21:47:57 +01:00
UbitUmarov 86bd9ca255 missing changed test files 2020-06-25 21:24:51 +01:00
UbitUmarov e2ffc17d1f fix sqlite region migrations 2020-06-25 17:44:23 +01:00
UbitUmarov 73754670ca small change on wl converter 2020-06-25 17:20:56 +01:00
UbitUmarov b7750e52d6 lang env on PGSQL 2020-06-24 11:36:34 +01:00
UbitUmarov 63ae8a09c6 removed the disabled region settings from tests 2020-06-24 08:18:50 +01:00
UbitUmarov 768f506a23 work around sunlight_color mess 2020-06-23 16:07:25 +01:00
UbitUmarov 60da45b715 lang env on sqlite 2020-06-23 14:28:34 +01:00
UbitUmarov 1d42d8ab6e still not good, add more spaghetti 2020-06-22 18:51:10 +01:00
UbitUmarov f3eb71113e still not good, add more spaghetti 2020-06-22 18:16:48 +01:00
UbitUmarov 7b3ac662dc on load, store the env via the module, so it is stored. This api is still a bit incoerent 2020-06-22 16:47:20 +01:00
UbitUmarov 16c18c0855 actually just go back to extension settings.bin. Actual name it totally irrelevant, as long it is unique 2020-06-22 16:27:21 +01:00
UbitUmarov eec92454b0 define again asset file extention settings.bin for bw comp 2020-06-22 16:23:49 +01:00
UbitUmarov 8fe2cd6c46 save/load environments to/from oars 2020-06-22 15:46:39 +01:00
UbitUmarov 7b77609537 shut up HG STATUS NOTIFIER 2020-06-21 17:09:33 +01:00
UbitUmarov 7da23b6714 missing files 2020-06-21 14:59:20 +01:00
UbitUmarov 53b0ee242d add a 3 to 1 daycycle and make it the default 2020-06-21 14:27:24 +01:00
UbitUmarov 5b87347476 and add some untested ossl 2020-06-21 12:41:10 +01:00
UbitUmarov e04af236f2 forced still bad 2020-06-21 02:56:20 +01:00
UbitUmarov 29bf9522e2 forced still bad 2020-06-21 02:31:57 +01:00
UbitUmarov bcacd2ff21 cancel forced env on make child agent 2020-06-21 01:46:36 +01:00
UbitUmarov 5b56a09cb2 some fixes on env protocol, forced env, etc 2020-06-21 01:41:14 +01:00
UbitUmarov 17e7e9b354 enable threat check on the new ossl method 2020-06-19 21:17:26 +01:00
UbitUmarov edf93abdbc try adding a clear init 2020-06-19 20:06:59 +01:00
UbitUmarov e3ecf0ddbe add LSL_Integer osReplaceAgentEnvironment(LSL_Key agentkey, LSL_Integer transition, LSL_String environment). note this is a hack, we cant do the ll* one 2020-06-19 19:55:40 +01:00
UbitUmarov d322248fd1 fix send parcel env version 2020-06-19 02:06:58 +01:00
UbitUmarov dd2495be9d remove dead config options 2020-06-18 16:52:45 +01:00
UbitUmarov 1b870131d4 give/use the new group power 2020-06-18 14:33:14 +01:00
UbitUmarov 362025be38 update libomv 2020-06-18 14:23:24 +01:00
UbitUmarov 3c8b4423b1 missing file 2020-06-18 13:49:46 +01:00
UbitUmarov cca383b452 more to go, fix lsl funtions for parcels env 2020-06-18 13:47:34 +01:00
UbitUmarov f708b413a1 more to go 2020-06-18 13:18:08 +01:00
UbitUmarov 6cb2cb40cc a ton more to go 2020-06-18 12:16:00 +01:00
UbitUmarov 8f79439558 a ton more to go 2020-06-18 12:11:36 +01:00
UbitUmarov 44c90bf294 misspell all across the board 2020-06-18 12:01:53 +01:00
UbitUmarov 104f7f0eb2 store parcel uglysky on mysql region db (others one day..) 2020-06-18 01:36:01 +01:00
UbitUmarov 369a2e1453 clear parcels uglysky on clearing override flag 2020-06-17 21:08:52 +01:00
UbitUmarov e7807d4359 missing files 2020-06-17 16:12:24 +01:00
UbitUmarov e538628dec 2first dirty version and non persistent parcel uglysky 2020-06-17 15:49:13 +01:00
UbitUmarov 7a9e03876a block some region/estate settings no longer avaiable 2020-06-17 12:34:38 +01:00
UbitUmarov 24689f064c disable cap EstateChangeInfo, currently broken on viewers 2020-06-17 11:46:56 +01:00
UbitUmarov 46dce3cedb speeup time update a bit ( this will be a conf option) 2020-06-16 16:12:14 +01:00
UbitUmarov 70f867a518 yeack, revert that... for now we do need to use diferent notification methods 2020-06-16 15:27:43 +01:00
UbitUmarov 24a0f0f6da send event message WindlightRefresh for all viewers 2020-06-16 13:47:44 +01:00
UbitUmarov 833ae02121 update libomv 2020-06-16 04:18:14 +01:00
UbitUmarov 00b2837d30 fix wl lightnorm 2020-06-16 01:58:08 +01:00
UbitUmarov 9ae867abd3 missing file 2020-06-15 04:06:24 +01:00
UbitUmarov 4329f5962a stop sending sun direction, recent viewers should not need it, and it costs cpu 2020-06-15 04:03:06 +01:00
UbitUmarov b3ce8e9fc7 big numbers need more bits.. 2020-06-14 21:41:50 +01:00
UbitUmarov 3a5d5fd50e store as llsd notation on region db, plus a few more changes 2020-06-14 20:45:09 +01:00
UbitUmarov dfa69b1869 add some assets 2020-06-14 01:18:59 +01:00
UbitUmarov d1c78564bb Merge branch 'master' into uglysky 2020-06-14 00:01:38 +01:00
UbitUmarov d7089bcff2 mantis 8715: fix peer http port. thanks GuduleLapointe 2020-06-13 23:59:55 +01:00
UbitUmarov 05dc8594f0 corner cases.. 2020-06-13 19:06:17 +01:00
UbitUmarov 1980c01eb8 change legacy altitudes 2020-06-13 18:08:48 +01:00
UbitUmarov 9a18678fec and of course i missed a file.. 2020-06-13 15:51:17 +01:00
UbitUmarov b37141182a more on SendViewerTime() 2020-06-13 15:48:35 +01:00
UbitUmarov 3bf0f6c407 do not display 0:xx:xx PM 2020-06-12 20:02:55 +01:00
UbitUmarov e404d671c8 better keep some things sorted 2020-06-12 10:16:59 +01:00
UbitUmarov d1ecccfaca add some ossl 2020-06-11 19:55:12 +01:00
UbitUmarov e407f69b2c add other env time function 2020-06-11 19:52:59 +01:00
UbitUmarov e8b9735f95 add some lsl functions 2020-06-11 17:12:22 +01:00
UbitUmarov 02ccbd0bbd some more changes; add some interface functions 2020-06-11 17:08:39 +01:00
UbitUmarov c6fcc33e49 a few more changes on sun position 2020-06-11 06:08:21 +01:00
UbitUmarov 13ed40d9f6 replace sun module 2020-06-11 00:01:43 +01:00
UbitUmarov 9ce70be5ce env asset can be any llsd type 2020-06-10 20:32:30 +01:00
UbitUmarov 2179aa14e0 Merge branch 'master' into uglysky 2020-06-10 20:21:07 +01:00
UbitUmarov efb2b67456 update libomv 2020-06-10 20:19:48 +01:00
UbitUmarov fa0a87f1c0 Merge branch 'master' into uglysky 2020-06-10 12:37:40 +01:00
UbitUmarov a61b5d5d38 revert some changes to groups V2 that will break external modules, with no special gain 2020-06-10 12:36:10 +01:00
UbitUmarov 8d2b502393 missing file 2020-06-10 09:37:28 +01:00
UbitUmarov e2be90caaf replace lightshare early work 2020-06-10 09:26:55 +01:00
UbitUmarov 0d76635113 do store a new flag on region db 2020-06-09 19:44:57 +01:00
UbitUmarov bde4354c15 some changes on viewer caps detection 2020-06-09 18:43:26 +01:00
UbitUmarov fa0044fb6c webutil remove some not that usefull timing logs, plust some cosmetics 2020-06-09 13:39:30 +01:00
UbitUmarov f4dfe2159c xinventory connector, remove a garbage dictionary copy. remove naive retry option 2020-06-09 13:32:42 +01:00
UbitUmarov 444a6b707b also allow purge/delete of LostAndFound folder, or we can not clean it with recent viewers 2020-06-09 04:20:18 +01:00
UbitUmarov 5b338fb31a fix a typo 2020-06-09 03:11:05 +01:00
UbitUmarov e1b234d9d0 change show uptime to 24hour format 2020-06-09 02:20:35 +01:00
UbitUmarov d3cb210080 apply similar changes to groups V2 2020-06-09 01:03:27 +01:00
UbitUmarov 351235f78e XmlRpcGroup: minor change 2020-06-09 00:53:03 +01:00
UbitUmarov 9c55c5bdb2 XmlRpcGroup: fix groupNoticesEnabled check 2020-06-09 00:04:01 +01:00
UbitUmarov 1a57abebfc XmlRpcGroup: try to improve notices attachments 2020-06-08 23:17:41 +01:00
UbitUmarov 775420c46a set object select on demand, not when it is created 2020-06-05 01:57:17 +01:00
UbitUmarov b440a9534d AgentCircuitManager: always remove possible old one on add 2020-06-04 20:19:05 +01:00
UbitUmarov 38fc68ac0c some changes to AgentCircuitManager 2020-06-04 19:58:07 +01:00
UbitUmarov 7ef69edf33 flotsam: also expire weakreferences 2020-06-04 19:52:34 +01:00
UbitUmarov 7a07731371 on simple cases no need to parse at all 2020-06-04 02:50:39 +01:00
UbitUmarov 84a3ff37ab don't load a full xml doc when we just want a single forward parse 2020-06-04 02:37:27 +01:00
UbitUmarov 301f28cfd4 add some heap variation to floatsam optional cache expire log 2020-06-03 14:34:11 +01:00
UbitUmarov 2efa53af52 also show total number of a avatar prims on attachments show 2020-06-03 01:19:42 +01:00
UbitUmarov 0a22bde6d1 replace a clear attachments by a full delete 2020-06-03 00:36:03 +01:00
UbitUmarov 3188db7041 force Yengine scripts recompile 2020-06-02 22:18:28 +01:00
UbitUmarov 06bdfc48d0 move the ToUpper to where it belongs 2020-06-02 18:25:13 +01:00
UbitUmarov 239c07ed9d oops ToUpper is needed on default animation names 2020-06-02 18:17:53 +01:00
UbitUmarov 8cebc84de7 let objects use default animations 2020-06-02 18:05:22 +01:00
UbitUmarov fde3727453 avoid null refs on part inventory, that can happen if only using default animations names for example 2020-06-02 17:02:42 +01:00
UbitUmarov 9b09bd255c change osNpcSaveAppearance to save huds by default like before, so its coerent with past and the other save app methods 2020-06-01 21:31:18 +01:00
UbitUmarov 9bd5310fe8 expose the option to save HUDs into notecard on the API 2020-06-01 21:05:57 +01:00
UbitUmarov 873b3b0af6 do not store HUDs on appearence notecards 2020-06-01 19:07:49 +01:00
UbitUmarov 190acf093a finally enable cap GetAsset(ViewerAssets) by default. Note that users with FS6.0.x will have issues. They need to upgrade 2020-06-01 18:12:32 +01:00
UbitUmarov 43094592d5 show number of prims on attachments show command 2020-06-01 02:02:00 +01:00
UbitUmarov e0c49c42e3 and more changes on uuid gatherer and libomv 2020-05-31 14:21:50 +01:00
UbitUmarov 41d9441512 fix typo 2020-05-31 02:17:51 +01:00
UbitUmarov f0581ff1ff and more changes on uuid gatherer and libomv 2020-05-31 01:35:03 +01:00
UbitUmarov 8ac70b6155 and more changes on uuid gatherer and libomv 2020-05-30 21:34:13 +01:00
UbitUmarov 42b75021b6 more changes on uuid gatherer 2020-05-30 19:44:11 +01:00
UbitUmarov 5ac1fff43e update libomv 2020-05-30 19:43:41 +01:00
UbitUmarov b541de034c make some limit use of new libomv things 2020-05-30 15:51:01 +01:00
UbitUmarov 7b8db526b3 update libomv 2020-05-30 15:28:44 +01:00
UbitUmarov 9896224605 agent preferences needs to work without backend storage 2020-05-30 14:13:07 +01:00
UbitUmarov 8f39405380 err ok not so fast 2020-05-27 00:18:32 +01:00
UbitUmarov 563d5d30ee some more suport for a new inventory and asset type 2020-05-27 00:04:19 +01:00
UbitUmarov 182b266ec4 avoid potencial null ref 2020-05-26 15:16:37 +01:00
UbitUmarov d2dbe3f4d0 Yeackk bad bad typo 2020-05-26 14:46:15 +01:00
UbitUmarov 8a9ebe48ce mantis 8708: dont bother updating something abotu to be deleted ( and that was also wrong) 2020-05-26 13:23:06 +01:00
UbitUmarov 0a48da85a3 SOP to xml: don't waste space with some unset optional parameters. 2020-05-26 12:48:08 +01:00
UbitUmarov d460a3fc86 missing file 2020-05-25 14:50:10 +01:00
UbitUmarov 1c5b9e5af8 missing file 2020-05-25 14:45:53 +01:00
UbitUmarov 66eb8a2c2e let engines Suspend and resume scripts return false if script not on that engine 2020-05-25 14:41:59 +01:00
UbitUmarov 5f52de2578 mantis 8706: avoid spurius logs on Yengine during object delete 2020-05-24 15:04:44 +01:00
UbitUmarov cc4e14a88d add missing ';' on mysql connection strings 2020-05-23 17:06:19 +01:00
UbitUmarov b598573f41 fix DataSnapShot 2020-05-22 16:55:20 +01:00
UbitUmarov 4679ede2f2 missing file 2020-05-22 14:03:28 +01:00
UbitUmarov f326cc8901 reduce garbage on WebFetchInvDesc 2020-05-22 14:00:12 +01:00
UbitUmarov 3c33d5c448 change nullterm arg default true 2020-05-22 00:55:54 +01:00
UbitUmarov 86d8f9963c make a bit more use of it 2020-05-22 00:29:01 +01:00
UbitUmarov 8d8ead9776 add own version of utf8 getbytes. More recent .net versions (core?) do have similar, but not want got there now, besides only similar.. 2020-05-21 22:41:15 +01:00
UbitUmarov 6e0d82f584 add 2 minor speedups on allow parcel owner more restrive checks 2020-05-21 21:55:23 +01:00
UbitUmarov 35b0b77656 update libomv 2020-05-20 13:51:42 +01:00
UbitUmarov 0bfacb7892 change hg link request log message 2020-05-20 03:02:01 +01:00
UbitUmarov fffac7d531 mantis 8704: fix issues on YEngine 2020-05-20 00:35:51 +01:00
UbitUmarov 5167bd097b mantis 8250: a few more changes 2020-05-19 21:50:21 +01:00
UbitUmarov 337832ecbe mantis 8250: if flying, stay flying 2020-05-19 17:01:32 +01:00
UbitUmarov 822fea4a99 missing file, of course 2020-05-19 16:05:43 +01:00
UbitUmarov aca62392ac mantis 8250: make same changes to avatar move to target (still no new OSSL) 2020-05-19 15:59:53 +01:00
UbitUmarov 28b22a4fc1 revert the use of direct data on xml decode, for now 2020-05-18 04:31:11 +01:00
UbitUmarov aca5728ab2 try to work around missing BOM 2020-05-18 02:37:03 +01:00
UbitUmarov e308ab8843 .net xml things don't like null terminated strings 2020-05-18 01:12:40 +01:00
UbitUmarov 9ecee558b5 whatever... 2020-05-18 00:28:24 +01:00
UbitUmarov 4fa8e20aab add more cooldown to flotsam cache files expire 2020-05-18 00:20:28 +01:00
UbitUmarov fe72b54652 cosmetics 2020-05-17 17:16:29 +01:00
UbitUmarov 9ce52ed2fc cosmetics 2020-05-16 03:01:44 +01:00
UbitUmarov dc5a0244fc cosmetics 2020-05-16 02:22:01 +01:00
UbitUmarov cfe1285869 missing files 2020-05-16 02:14:13 +01:00
UbitUmarov 65ca238cd7 do unpack appearence cacheitems on tps 2020-05-16 01:52:53 +01:00
UbitUmarov baf5c61387 simplify GruntWork on getassets (needs more) 2020-05-16 01:16:19 +01:00
UbitUmarov 48892ad8a7 timestamp http requests 2020-05-15 23:40:19 +01:00
UbitUmarov 7098091616 avoid null ref 2020-05-15 18:17:13 +01:00
UbitUmarov c0597e278b update libomv 2020-05-15 15:12:34 +01:00
UbitUmarov 79bb22eaf6 fix typo 2020-05-15 15:11:06 +01:00
UbitUmarov 214cf5d60b llsdXml: do direct base64 encode 2020-05-15 14:41:38 +01:00
UbitUmarov 5848d3a6bb make scenepresence IDisposable 2020-05-14 13:36:27 +01:00
UbitUmarov 67bc086782 add sog TemporaryInstance flag 2020-05-14 12:51:55 +01:00
UbitUmarov 8b77162020 make sog, sop and sop inventory IDisposable 2020-05-14 12:02:46 +01:00
UbitUmarov dd55a3d19c fix a bug on part inventory locking 2020-05-14 11:51:57 +01:00
UbitUmarov af1e20d054 missing file 2020-05-13 14:58:26 +01:00
UbitUmarov 4c7107dfda cosmetics 2020-05-13 14:51:05 +01:00
UbitUmarov f15c6be20c update libomv 2020-05-13 13:55:13 +01:00
UbitUmarov a2c7a13065 silly bug 2020-05-12 20:42:31 +01:00
UbitUmarov 51bc19f1ab no need to clone something Idisposable when we just want to see values 2020-05-12 18:58:07 +01:00
UbitUmarov d613287a77 mk TaskInventoryDictionary IDisposable 2020-05-12 18:52:33 +01:00
UbitUmarov c63fabe054 well and it does get all assets, grrr 2020-05-12 04:19:45 +01:00
UbitUmarov 48df8869e8 duuhh windows does not update lastaccesstime 2020-05-12 03:03:31 +01:00
UbitUmarov 6a4564869b flotsam file touch before expire: gatherer.GatherAll already touchs and tries to fecth all assets. This is nasty to use anyway.. avoid it 2020-05-12 00:56:47 +01:00
UbitUmarov 7c0b3387dd give up on simplehandler for root default get for now 2020-05-11 23:28:59 +01:00
UbitUmarov c40b297fc7 (TEST) add a default root uri GET handler. this may be usefull for some cases. 2020-05-11 23:07:29 +01:00
UbitUmarov 4bf4c76a64 cosmetics 2020-05-11 19:35:13 +01:00
UbitUmarov 8da733c485 test xbakes async/await store 2020-05-11 19:06:09 +01:00
UbitUmarov 713c222ec8 remove some redundancy 2020-05-11 15:12:21 +01:00
UbitUmarov 7f3bb9267a oops a bad end slash 2020-05-11 13:38:59 +01:00
UbitUmarov 6d92b75452 more on end slash and uri handler determination 2020-05-11 13:01:27 +01:00
UbitUmarov 2629d9d901 comment out estimatedLocalCost test 2020-05-10 21:30:34 +01:00
UbitUmarov c15869438c move currency-base-uri simulator feature to global settings, based on [Economy] economy setting on opensim.ini. make sampleMoney honour it 2020-05-10 21:27:23 +01:00
UbitUmarov aafc6579a1 remove end slash from most URLs we send to viewers 2020-05-10 21:14:52 +01:00
UbitUmarov c1d69018bd some viewers send '//' at end of url plus cosmetics 2020-05-09 18:54:51 +01:00
UbitUmarov a367828a85 clean a few more things before giving a socket to websockets. (this would happen later anyway) 2020-05-09 00:16:01 +01:00
UbitUmarov ea11f1aeb8 SampleMoneyModule: remove last '/' on currency-base-uri 2020-05-08 17:30:46 +01:00
UbitUmarov bcb9ab29d7 SampleMoneyModule: suport viewers new opensimextra currency-base-uri sim feature override for helperURI (that we call economy on some ini files, just because) 2020-05-08 17:00:43 +01:00
UbitUmarov fa5b4dc5d8 add AddOpenSimExtraFeature to simulator features, so it is done under proper locking. Fix gridservice extra features merge (they override older). This does need a future cleanup 2020-05-08 16:54:18 +01:00
UbitUmarov 72c1c923f8 SampleMoneyModule: add private xmlrpc methods 2020-05-08 14:50:46 +01:00
UbitUmarov c2c00c5d84 add httpserver HandleXmlRpcRequests with local set of xlmrpc methods 2020-05-08 14:37:08 +01:00
UbitUmarov f38c5d7ac2 SampleMoneyModule: add the needed php fake uris, since we no longer folish look for xmlrpc on everything not decoded, return back the reqeusted amount or viewers get confused. 2020-05-08 05:35:47 +01:00
UbitUmarov bf218f2cef make httpserver HandleXmlRpcRequests public 2020-05-08 05:26:25 +01:00
UbitUmarov f70f0b5ffd cosmetics 2020-05-07 14:26:07 +01:00
UbitUmarov f0fc1f628f another missing file 2020-05-07 02:33:54 +01:00
UbitUmarov 1908c095d3 missing file 2020-05-07 02:31:05 +01:00
UbitUmarov 58a4f45712 change eventqueue queues type, move event methods to other file (using partial class) 2020-05-07 02:26:25 +01:00
UbitUmarov 6c49f16132 minor changes 2020-05-07 02:15:25 +01:00
UbitUmarov ac7187eada avoid a null ref, plus some cleanup 2020-05-07 02:02:50 +01:00
UbitUmarov d5baeb4690 add SslMode=None to some connection strings 2020-05-07 00:37:25 +01:00
UbitUmarov 1e8e59e635 also override Output(string format) on remoteConsole 2020-05-02 18:31:02 +01:00
UbitUmarov 41d7d2f2f4 do dispose requests in context queue 2020-05-02 17:32:14 +01:00
UbitUmarov 0b0b5111df simplify PollServiceRequestManager, now that low level does serielaze requests 2020-05-02 15:25:05 +01:00
UbitUmarov 6d030e2f2b try to shutup some errors dunring shutdown, due to .net mess 2020-05-02 14:25:57 +01:00
UbitUmarov 1ad3a256f2 do http requests serialization at lower level 2020-05-02 14:23:52 +01:00
UbitUmarov ab14241871 mantis 8678: try fix rest console client 2020-05-01 17:49:11 +01:00
UbitUmarov 929fa3efbd dispose of jobengine queue 2020-05-01 15:42:02 +01:00
UbitUmarov 5fa81a6ca9 give viewers more time to start uploading assets 2020-04-30 17:02:37 +01:00
UbitUmarov 22c28a0260 make Caps IDisposable 2020-04-30 03:37:28 +01:00
UbitUmarov 36d005e1cc update circuit child status when it changes 2020-04-30 02:32:41 +01:00
UbitUmarov 003b109561 move DynamicMenuModule to simpleh.., 2020-04-30 01:59:36 +01:00
UbitUmarov b023914cc0 move RegionConsoleModule to simpleh.., and try to fix it 2020-04-30 01:31:34 +01:00
UbitUmarov 715c7a4825 fix localconsole so viewer one can display things 2020-04-30 00:47:53 +01:00
UbitUmarov 52f50d2035 move UploadObjectAsset to simpleh.. 2020-04-29 23:17:36 +01:00
UbitUmarov 88a81a9ca4 move ObjectAdd to simpleh.. 2020-04-29 22:55:02 +01:00
UbitUmarov c289b83250 remove dead code 2020-04-29 16:57:58 +01:00
UbitUmarov 5da135a90b a few changes to updateitemasset things 2020-04-29 16:52:54 +01:00
UbitUmarov ae15b75f79 change UploadBakedTextureModule. Make it shared and self contained 2020-04-29 16:29:20 +01:00
UbitUmarov b0e1347cd0 silly typo... 2020-04-29 13:44:44 +01:00
UbitUmarov 693adf9ecf hide handler types not in use from show http-handlers 2020-04-29 13:41:57 +01:00
UbitUmarov 6c349e6534 let show caps list display the avatar name 2020-04-29 13:32:02 +01:00
UbitUmarov d42c7e5e32 change CopyInventoryFromNotecard to simpleh.. 2020-04-29 13:18:50 +01:00
UbitUmarov b069b668e4 make some use of those 2020-04-29 12:34:48 +01:00
UbitUmarov c39ffa4dd1 add some utf8 getbytes help functions 2020-04-29 12:24:45 +01:00
UbitUmarov 7b5934ea26 add timeouts and placehold for future code 2020-04-29 10:39:36 +01:00
UbitUmarov 3a21d4de1e split the Upload* caps per asset type. We will need that one day. move uploadtaskscript to simpleh 2020-04-29 09:58:17 +01:00
UbitUmarov 7a8a7c7168 missing file 2020-04-28 21:38:03 +01:00
UbitUmarov bff6be4f66 give up on baked flag (test) 2020-04-28 21:34:54 +01:00
UbitUmarov f9e3c9adab clear baked flag on uploaded npc baked. This may cause issues on older grids (test) 2020-04-28 20:41:47 +01:00
UbitUmarov 3482259518 add SimpleBinaryHandler 2020-04-28 16:21:03 +01:00
UbitUmarov 1f7286fb95 do things in the right order 2020-04-28 15:53:50 +01:00
UbitUmarov 0b29bff512 restore lost things in the process 2020-04-28 15:47:13 +01:00
UbitUmarov 1abc6149bb split file bunchofcaps a bit 2020-04-28 15:43:07 +01:00
UbitUmarov d8b182afff change the http handler of those update* caps to simplehandler 2020-04-28 14:29:37 +01:00
UbitUmarov b6a02269f7 change update of agent or object inventory items assets. This may need better check 2020-04-28 13:48:49 +01:00
UbitUmarov dee822208a make FetchInventory2 a shared module 2020-04-28 01:39:10 +01:00
UbitUmarov 7e2ed9ee2b change FetchInventory2 region handler 2020-04-28 01:15:18 +01:00
UbitUmarov bfcbdc8a93 change voice modules handlers 2020-04-27 21:42:35 +01:00
UbitUmarov 5929e43c2c change MoapModule 2020-04-27 20:02:10 +01:00
UbitUmarov 27ea249194 change meshUploadFlagModule 2020-04-27 20:00:03 +01:00
UbitUmarov b4fc5c33ec rename wrong RegionSimpleStatsHandler as RegionStatsSimpleHandler 2020-04-27 18:06:27 +01:00
UbitUmarov 04b28f206a mantis 8688: put RegionStatsHandler : BaseStreamHandler tempory back, to give time for external modules to update 2020-04-27 18:00:37 +01:00
UbitUmarov 6d66770228 change the RemoteParcelRequest cap 2020-04-27 17:46:33 +01:00
UbitUmarov b5067baa4a it is nice to actually send the options back 2020-04-27 17:40:55 +01:00
UbitUmarov 89dee19060 move httpMethod OPTIONS handling to top, this needs to be chacked 2020-04-27 17:25:55 +01:00
UbitUmarov fa844d7e6e add soem try/catch (and yes..yes right on last commit should hed been write... 2020-04-27 16:40:54 +01:00
UbitUmarov 0518b397a3 add SimpleOSDMapHandler, for caps that have just one httpmethod and body should be decoded as OSDMap, so we don't right the same things all pver 2020-04-27 15:46:31 +01:00
UbitUmarov a3cd0cbfcb no need for stream hanlder description 2020-04-27 14:52:43 +01:00
UbitUmarov 9d08f8307e recover LLSD login handler 2020-04-27 14:35:19 +01:00
UbitUmarov 6ffb5bcf23 move RegionStatsHandler 2020-04-27 00:54:32 +01:00
UbitUmarov 8526f938f7 move /friends handler 2020-04-27 00:23:59 +01:00
UbitUmarov 8900d1139e xmlrpc and josonrpc only allowed on uri root, and only those there 2020-04-26 23:05:27 +01:00
UbitUmarov 6050eff683 improve show http-handlers 2020-04-26 21:51:15 +01:00
UbitUmarov b68748507d move /estate handler 2020-04-26 20:05:10 +01:00
UbitUmarov c07f4f3c41 change NeighbourHandlers whatever they are... 2020-04-26 19:13:35 +01:00
UbitUmarov 05f098be56 change region objecthandlers 2020-04-26 18:11:34 +01:00
UbitUmarov 473dba93e8 update show http-handlers 2020-04-26 17:03:16 +01:00
UbitUmarov e0418da6e1 change region avatarhandlers 2020-04-26 16:54:58 +01:00
UbitUmarov e63231887b move map to that 2020-04-25 23:25:29 +01:00
UbitUmarov dcc2f764f2 add a /index.php fake handler, for map. only does ?method=.. but can be extended) 2020-04-25 23:24:00 +01:00
UbitUmarov 70d2878d0a simplify default 404 message, removing wrong(missing) host info 2020-04-25 21:13:54 +01:00
UbitUmarov cafe49d44b change ParcelPropertiesUpdate 2020-04-25 20:49:13 +01:00
UbitUmarov d44baf20cd fix map image encoder parameter 2020-04-25 20:25:38 +01:00
UbitUmarov 2d1900165b change GodsModule 2020-04-25 19:44:25 +01:00
UbitUmarov 0348c01ce7 change SimulatorFeaturesModule 2020-04-25 19:19:19 +01:00
UbitUmarov 830b034b81 change EstateAccess 2020-04-25 18:54:01 +01:00
UbitUmarov 8fb4b2f4e3 change AvatarPickerSearchModule 2020-04-25 18:03:50 +01:00
UbitUmarov 5bde41b30f remove obsole code 2020-04-25 17:00:07 +01:00
UbitUmarov 605a01fe6e move monitor stats handlers to simpleStreamHandler 2020-04-25 15:54:44 +01:00
UbitUmarov 99658309ce missing file 2020-04-25 15:32:21 +01:00
UbitUmarov ee77a6d80b move some region base handlers to simpleStreamHandler 2020-04-25 15:31:30 +01:00
UbitUmarov 80de74e127 cancel keepalive if http status not OK, this maybe a bit 2 hardm but ok for now 2020-04-25 14:27:44 +01:00
UbitUmarov 7f2cfe734b null uri path is already checked at low level 2020-04-25 14:10:59 +01:00
UbitUmarov eae9928961 null method is already checked at low level, remove optional status 500 message 2020-04-25 13:45:45 +01:00
UbitUmarov 288dffcda1 change cap CreateInventoryCategory 2020-04-25 12:55:02 +01:00
UbitUmarov e48d2f2c1f move worlmap handlers to simpleStreamHandler 2020-04-24 21:40:14 +01:00
UbitUmarov 23961abf8a move EstateChangeInfo cap to simpleStreamHandler 2020-04-24 20:01:03 +01:00
UbitUmarov bac6890391 we can speedup some not simple StreamHandler a bit 2020-04-24 18:14:41 +01:00
UbitUmarov 07caee4956 move a materials cap to simpleStreamHandler 2020-04-24 17:50:13 +01:00
UbitUmarov 84cd4b4808 move a few more caps to simpleStreamHandler 2020-04-24 16:09:23 +01:00
UbitUmarov 3d09ff57f0 move a few more caps to simpleStreamHandler 2020-04-24 13:56:16 +01:00
UbitUmarov 7856192da6 move SEED cap to simpleStreamHandler 2020-04-24 02:37:50 +01:00
UbitUmarov ba8d188a0d remove another wrong ':' 2020-04-24 01:07:58 +01:00
UbitUmarov 76019258e3 remove wrong ':' 2020-04-24 01:06:52 +01:00
UbitUmarov 899620bc13 remove some '/' just wasting space 2020-04-24 00:54:21 +01:00
UbitUmarov f955482dfd move ServerReleaseNotes module to simpleStreamHandler 2020-04-24 00:40:52 +01:00
UbitUmarov 8d2f90a8e2 let show http-handlers list simpleStreamHandlers 2020-04-24 00:24:02 +01:00
UbitUmarov 9000240238 change GetCapsDetails(..) 2020-04-23 23:58:06 +01:00
UbitUmarov ca5756a100 fix agentpreferences cap path 2020-04-23 23:54:57 +01:00
UbitUmarov f2a025bc41 Oppps better clear the online before returning 2020-04-23 23:36:34 +01:00
UbitUmarov 6cd822fd83 clear online status from gridUserService when killing dup presences 2020-04-23 23:32:33 +01:00
UbitUmarov 7a24d8af52 change AgentPreferencesModule to use SimpleStreamHandler, as a simple first test 2020-04-23 22:35:31 +01:00
UbitUmarov 9a5a811c7d extend Caps to use SimpleStreamHandler 2020-04-23 22:32:18 +01:00
UbitUmarov 426d83c535 change SimpleStreamHandler to have a processor method argument 2020-04-23 22:30:40 +01:00
UbitUmarov 46162e620a change response content lengh when using rawbuffer 2020-04-23 22:28:27 +01:00
UbitUmarov 10988fe980 exclude root path from SimpleStremHandler 2020-04-23 18:29:45 +01:00
UbitUmarov 0fe51f34c2 add SimpleStrem(Request)Handler, for simple uripaths, any method or query 2020-04-23 18:23:43 +01:00
UbitUmarov e818c570bb expose uripath 2020-04-23 18:16:56 +01:00
UbitUmarov 5a51553e7d missing file 2020-04-23 16:08:16 +01:00
UbitUmarov fefcda52f5 use concurrentdic on pollhandlers, simplify a bit 2020-04-23 16:04:54 +01:00
UbitUmarov 92518129ee remove redundant code 2020-04-23 13:24:08 +01:00
UbitUmarov 212c25f906 fix http version 2020-04-22 00:00:24 +01:00
UbitUmarov 6b6baa9e51 reduce ServicePointManager.DefaultConnectionLimit back 12 for os other than windows 2020-04-21 23:05:53 +01:00
UbitUmarov 1475b83699 risk reduncing iddle timeout again, because it is needed on current framework 2020-04-21 15:46:41 +01:00
UbitUmarov 50b81258a9 change event pool timeout handling 2020-04-21 00:19:19 +01:00
UbitUmarov 43fdbf87d4 remove some useless code form http low level; delay normal connection close, to let client do it instead 2020-04-21 00:13:02 +01:00
UbitUmarov c097f148dd locate default anims also by uuid, rename/chage a few things 2020-04-18 17:26:25 +01:00
UbitUmarov e2f84f0c1f send 100 continue code the way ms seems to want 2020-04-16 02:13:03 +01:00
UbitUmarov 4ab8da01bc flush sslstreams in keepalive case ( should not be needed but well ) 2020-04-16 01:51:57 +01:00
UbitUmarov bdddedc550 let samplemoneymodule see EconomyModule config setting 2020-04-16 01:40:39 +01:00
UbitUmarov e859985cfa actually commit the uri fix 2020-04-15 21:23:13 +01:00
UbitUmarov 7572a60993 avoid a null ref on get log level 2020-04-15 11:48:52 +01:00
UbitUmarov a6abc3d2b6 mantis 8688: fix uri parsing in secure case ; add tls11 and tls12 to list of protocols (.net.46 ones) 2020-04-15 11:48:03 +01:00
UbitUmarov 944f3dd7ec sleep a script by 1second on non fatal OSSL errors 2020-04-14 17:01:35 +01:00
UbitUmarov f20845c89e sleep a script by 1second on non fatal LSL errors 2020-04-14 16:56:53 +01:00
UbitUmarov 8baab939d2 oops fix query handling on getassets 2020-04-13 15:37:12 +01:00
UbitUmarov 920a26eeec add request QueryFlags 2020-04-13 15:01:04 +01:00
UbitUmarov b419f71a68 also expose the request client IP as seen by server port 2020-04-13 14:34:03 +01:00
UbitUmarov e0ba96055c change osrequest Query back to hashtable, add QueryAsDictionary as new better option. (recover compatibily with current external modules 2020-04-13 14:24:22 +01:00
UbitUmarov 745a469af8 fix recent bug on Urlmodule 2020-04-13 13:53:37 +01:00
UbitUmarov d1f1324a2d update scriptSyntax 2020-04-12 23:19:34 +01:00
UbitUmarov bbc5d5bc2d ate least one viewer for androide does not decode correctly llsd, go back send more useless data, to suport them. this should be reverted one day 2020-04-12 18:10:20 +01:00
UbitUmarov f95925e0fd http server change remote endpoint handling 2020-04-11 19:57:34 +01:00
UbitUmarov 7ce9f890b1 http server useless changes 2020-04-11 16:41:39 +01:00
UbitUmarov 0d940df4e2 http server: change uri query handling 2020-04-11 15:18:49 +01:00
UbitUmarov 1c6d454691 remove excess garbage 2020-04-10 22:52:25 +01:00
UbitUmarov 6fea9dafaf yeack increase TimeoutMaxIdle again for now 2020-04-09 18:43:55 +01:00
UbitUmarov 50cd0ab982 missing file 2020-04-09 16:19:37 +01:00
UbitUmarov 0a1e1ae9e0 http asset send: prioritize baked textures 2020-04-09 16:18:27 +01:00
UbitUmarov 7ecc9408a9 flag baked texture assets 2020-04-09 16:08:44 +01:00
UbitUmarov 05c77f9342 cosmetics 2020-04-09 14:01:15 +01:00
UbitUmarov c99014991b cosmetics 2020-04-09 13:41:41 +01:00
UbitUmarov 523d6dd2da stop a vivox error 2020-04-08 16:38:07 +01:00
UbitUmarov f976d10de2 more changes on http server low level 2020-04-08 14:35:31 +01:00
UbitUmarov f0f067d05c missing file 2020-04-08 00:09:23 +01:00
UbitUmarov b4eb5d6cca send parcels onwership change updates to all avatars that may want it 2020-04-08 00:01:05 +01:00
UbitUmarov 29f59fe407 reduce httppipeline depth 2020-04-06 16:53:28 +01:00
UbitUmarov 3989dbac31 fix rez time on inworld object copy 2020-04-06 12:02:36 +01:00
UbitUmarov 0a4232430b remove some dead code 2020-04-03 03:54:32 +01:00
UbitUmarov 50b8c90b42 change response m_body send (currently not in use) 2020-04-03 03:20:47 +01:00
UbitUmarov f1761a5b6c remove a log message under cond comp 2020-04-02 23:05:22 +01:00
UbitUmarov 4af5dfa0d0 update a license file 2020-04-02 22:33:25 +01:00
UbitUmarov 1e083c38ad nissing files 2020-04-02 21:54:18 +01:00
UbitUmarov fe9df55410 nissing files 2020-04-02 21:52:31 +01:00
UbitUmarov 67cd5efab3 replace external httpserver by embedded one (based on same code) - This may still be very bad; clean solution and runprebuild, or clone to clan folder 2020-04-02 21:44:34 +01:00
UbitUmarov 650b051cdf httpserver send now has priority, use it 2020-03-31 22:03:43 +01:00
UbitUmarov 817c2b3bb9 httpserver send is now async 2020-03-31 22:01:45 +01:00
UbitUmarov e558dd3ac6 update httpserver.dll this needs testing. May not be that nice... 2020-03-31 21:43:40 +01:00
UbitUmarov ef49ac7049 do hide hidden groups on profile 2020-03-30 18:18:36 +01:00
UbitUmarov 2e66f8dbdf store sop pseudocrc and region cacheID on sqlite 2020-03-28 16:18:31 +00:00
UbitUmarov 0958eceadd store sop pseudocrc and region cacheID on PGSQL ( others later) 2020-03-28 01:31:00 +00:00
UbitUmarov 87646f340b store sop pseudocrc and region cacheID on mysql ( others later) 2020-03-27 17:34:05 +00:00
UbitUmarov 1002987aea invalidate region cacheid on oar load 2020-03-27 17:27:54 +00:00
UbitUmarov 918f56d682 fix lludp to read pseudocrc from SOP; move region cacheID to region settings 2020-03-27 17:26:49 +00:00
UbitUmarov 8e6fc69a11 let pseudoCRC (for objcache) be per part and not just per SOG 2020-03-27 17:22:18 +00:00
UbitUmarov 0a4a3199f5 update libomv again (arm issues) 2020-03-20 21:09:00 +00:00
UbitUmarov f1204e2147 contrary to some docs, PROCESSOR_ARCHITECTURE is not defined on linux 2020-03-20 16:18:36 +00:00
UbitUmarov 9ce4b8914b LevelUpload setting is now on [Permissions], so look for it there also 2020-03-20 10:54:10 +00:00
UbitUmarov 010f091dd4 mantis 8675: delay material delete (the reported log message may still happen, but less 2020-03-20 10:50:56 +00:00
UbitUmarov 9864d1abfc tell detected endian also 2020-03-18 19:09:59 +00:00
UbitUmarov f2c0957f5a update libomv 2020-03-18 18:46:54 +00:00
UbitUmarov ac43124a93 duhhh 2020-03-18 17:59:35 +00:00
UbitUmarov 59d3f9fa62 log processor arch 2020-03-18 17:41:29 +00:00
UbitUmarov 5401e323dc update libomv 2020-03-18 14:42:14 +00:00
UbitUmarov cfef190424 mantis 8674: give up asking viewers to use htts on vivox. Several just fail 2020-03-15 22:13:31 +00:00
UbitUmarov 63c5da539f minor change to legacy mesh stream cost estimation, so small lowest lod does not give excessive contribution 2020-03-15 17:47:27 +00:00
UbitUmarov 5f76a62d29 cosmetics 2020-03-13 21:27:57 +00:00
UbitUmarov b292950b1c fix a lock i missed.. 2020-03-11 16:04:02 +00:00
UbitUmarov beee52032e current vivox server certs are invalid 2020-03-10 13:42:09 +00:00
UbitUmarov c172adbaec minor patching to outdated vivox suport. This can't be updated without proper API spec, that vivox is refusing to provide to me 2020-03-10 03:52:38 +00:00
UbitUmarov e4f7a1c07a a few missing files 2020-03-07 21:13:42 +00:00
UbitUmarov 033f6f889d a few changes to flotsam asset cache 2020-03-07 20:34:56 +00:00
UbitUmarov 2e9417bd01 mantis 8670: replace bom fallback textures with ones havign alpha channel, now done with older j2k compressor 2020-03-07 20:30:24 +00:00
UbitUmarov cf5630f2f7 mantis 8670: replace bom fallback textures with ones havign alpha channel 2020-03-07 15:43:29 +00:00
UbitUmarov 3956fbe496 missed only line on last commit 2020-03-06 19:31:07 +00:00
UbitUmarov 98de42eedc flotsam: add comands deletedefaultassets to delete local default assets (on folder bin/assets) from cache so they can be refreshed from grid and cachedefaultassets to load those local assets into cache. This comands may cause desync with grid or other regions. Viewers will need to clear cache so see effects. Use with care 2020-03-06 19:20:12 +00:00
UbitUmarov 38b93a0f50 define Mr Opensim data on Constants 2020-03-06 16:00:40 +00:00
UbitUmarov abe26f39f6 yeackk silly bug on new avaterpickeravaterpicker 2020-03-05 00:00:08 +00:00
UbitUmarov 1df06f459a avoid duplicated udpbuffer free that may still happen 2020-03-04 22:39:44 +00:00
UbitUmarov 8728e4cf2f missing file 2020-03-04 20:04:08 +00:00
UbitUmarov ad601c9502 take lludp out of usermanagement module 2020-03-04 20:02:45 +00:00
UbitUmarov 20b974cff0 place the try/catch in right place on profiles process. This is still bad. Last code changes moved from blocking a user for a long time, to block profiles for all, for a long time. This because some viewers like firestorm, ask for the profiles of all user friends to show their ugly 1st life pictures. thats hundred requests taking from 500ms to more than 30s each 2020-03-04 17:19:12 +00:00
UbitUmarov ed34c00956 add catch log to profiles process 2020-03-04 04:50:54 +00:00
UbitUmarov d0ba9f84df add some async work to profiles module, take profile out of groups v2, not its job 2020-03-04 02:45:10 +00:00
UbitUmarov 248d56d3ad add LSL_Integer osClearObjectAnimations() to remove all animations on a prim, returning the number it had; some clean on sending 2020-03-03 23:21:05 +00:00
UbitUmarov 6684c35bb0 fix object animation updates when also moving 2020-03-03 22:25:24 +00:00
UbitUmarov 25b4a310f5 mantis 8668: invalidate part VOC on lsl scale change 2020-03-03 11:37:23 +00:00
UbitUmarov c30cb8a9cf change root part physics type none to apply physics 2020-03-02 04:05:18 +00:00
UbitUmarov be16cf9531 sync some more things with work copy 2020-03-02 01:56:34 +00:00
UbitUmarov 97cb6254ef cosmetics, rename a few vars, etc 2020-03-02 01:32:33 +00:00
UbitUmarov 904553cdb3 update libomv 2020-03-02 01:04:15 +00:00
UbitUmarov d3b1465444 mantis 8667: remove wildcards from a very limited test of a very limited thing 2020-03-02 00:07:02 +00:00
UbitUmarov cf948d56a1 pesty warning 2020-03-01 22:03:33 +00:00
UbitUmarov 7e9ce0929d missing file 2020-03-01 21:46:31 +00:00
UbitUmarov 693492a3f1 several changes to lludp FetchInventoryDescendents 2020-03-01 21:45:28 +00:00
UbitUmarov dc225e348d several changes to lludp FetchInventory 2020-03-01 18:56:07 +00:00
UbitUmarov 71b5ca95e6 change Async object delete to inventory threading model 2020-03-01 16:16:09 +00:00
UbitUmarov e76006aff5 avoid a null ref at shutdown 2020-03-01 03:22:58 +00:00
UbitUmarov 49386d34e5 pesty warning 2020-03-01 03:05:14 +00:00
UbitUmarov af7d09c6b5 more cosmetics (and possible more typos) 2020-03-01 02:27:48 +00:00
UbitUmarov 4d67fdfa9d cosmetics (and possible lots of typos) 2020-03-01 01:19:09 +00:00
UbitUmarov 3707301c59 changes to load oar with --merge: with option --mergeReplaceObjects it will replace objects already in region, without it, skip; with opetion merge-parcels will try to merge them, without it ignores oar parcels. as before without --merge all is replaced. renamed the options force* as merge* since they are merge suboptions 2020-02-28 18:36:52 +00:00
UbitUmarov 665037e366 cosmetics 2020-02-28 00:53:51 +00:00
UbitUmarov 22e201bb49 add harder restrictions to llGiveInventoryList. permissions per item as giveinventory, target avatar must see the prim region. Add 3seconds delay 2020-02-27 23:10:16 +00:00
UbitUmarov 7ef657c415 LSL add a translation layer btw lsl permitions and internal permissions 2020-02-27 21:37:23 +00:00
UbitUmarov d1df9c9ee5 some lsl cleanup 2020-02-27 21:07:35 +00:00
UbitUmarov 8c74e47557 a few changes to objects permissions 2020-02-26 20:33:29 +00:00
UbitUmarov c2ca5a699d missing file.. 2020-02-26 19:33:55 +00:00
UbitUmarov ad5aff2d17 more on scripts *target* events 2020-02-26 19:18:07 +00:00
UbitUmarov 94f88e330b one more case 2020-02-26 18:24:40 +00:00
UbitUmarov ea8eeaa307 do no append zero when clipping strings ( may still happen on other places) 2020-02-26 16:58:41 +00:00
UbitUmarov 7d7fc8f06a Yengine script, don't dispose twice 2020-02-26 05:17:46 +00:00
UbitUmarov 20d77d3905 mantis 8665: avoid crash at shutdown, that line should not be needed 2020-02-26 05:09:04 +00:00
UbitUmarov 771381558e index targets by scriptID 2020-02-26 04:50:55 +00:00
UbitUmarov 6dd5ea0c96 it is a good idea to actually change the respective source file... 2020-02-26 03:28:23 +00:00
UbitUmarov 828a3bb7f8 yeack, scripts can set targets, not having the events 2020-02-26 03:26:44 +00:00
UbitUmarov ca48bf4117 those events are per script not per part 2020-02-26 03:18:22 +00:00
UbitUmarov c9137912c9 missing file 2020-02-25 23:08:17 +00:00
UbitUmarov ceb9289f13 change (not)at_(rot)target checks 2020-02-25 23:02:38 +00:00
UbitUmarov d47ce25b5b change lsl say/whisper/shout text lenght limit 2020-02-24 05:57:54 +00:00
UbitUmarov 6cadcb8bdf try save a few ns on chat to objects 2020-02-24 05:37:42 +00:00
UbitUmarov df2536c407 try save a few ns on chat to avatars 2020-02-24 05:36:05 +00:00
UbitUmarov 1de010e969 change pending messages for scripts listeners queue type 2020-02-24 03:06:35 +00:00
UbitUmarov 72d38b267e small text format change 2020-02-24 03:01:46 +00:00
UbitUmarov 5f232077a7 give a tiny more time for deattach event to trigger 2020-02-24 03:00:09 +00:00
UbitUmarov 270a3e3836 do release controls on some objects delete 2020-02-21 19:19:19 +00:00
UbitUmarov c887446b7e sog DelinkFromGroup: change order of some operations 2020-02-21 19:15:08 +00:00
UbitUmarov 60a924f3c6 change part inventory adding some scripts speed up and controls release 2020-02-21 19:11:29 +00:00
UbitUmarov 0e6a7c3dac cosmetics 2020-02-20 21:50:07 +00:00
UbitUmarov 6c94f5d432 fix HandleRevokePermissions() 2020-02-20 08:29:09 +00:00
UbitUmarov 7c977f9e27 fix release controls on deattach 2020-02-20 08:27:42 +00:00
UbitUmarov d7671f3c01 a few changes to script engines releasecontrols 2020-02-20 08:20:15 +00:00
UbitUmarov 8d8b5b756f mantis 8663: add CertificateValidationCallback set. Thanks Manni 2020-02-18 20:23:14 +00:00
UbitUmarov 6d2bb27ef7 fix a test 2020-02-17 22:05:27 +00:00
UbitUmarov c8a95e21ee mysql region store: do not use double to store float 2020-02-17 21:11:21 +00:00
UbitUmarov b9cf2244a4 stop some log spam on shutdown that happens on linux 2020-02-17 17:54:56 +00:00
UbitUmarov c11249f1ca yeack ... // is not a ini file comment 2020-02-17 14:53:39 +00:00
UbitUmarov 23aae75563 add osslDefaultEnable.ini and osslEnable.ini.example. Similar use as opensimDefaults and opensim. Second files do local overrides to defautl settings. This should easy upgrades to versions that are compatible (most cases). (Dan Banner idea and request) 2020-02-17 00:53:30 +00:00
UbitUmarov e155ab7814 patch a test 2020-02-14 20:17:52 +00:00
UbitUmarov 59414467e2 several changes to (task)inventory offering 2020-02-14 19:47:57 +00:00
UbitUmarov 55333a5171 fix axis rotation on sog bounding box 2020-02-14 19:34:32 +00:00
UbitUmarov a42085f1a9 fix llGiveInventoryList notification on a group owned prim also 2020-02-13 05:20:00 +00:00
UbitUmarov 20a08c9f41 make a message more readable 2020-02-13 04:59:17 +00:00
UbitUmarov fa4602e048 improve TaskInventoryAccepted (that is also decline) 2020-02-13 04:58:20 +00:00
UbitUmarov 0e7c19e181 fix llGiveInventory notification on a group owned prim 2020-02-13 04:41:50 +00:00
UbitUmarov 75e5217fff fix a group owned permission 2020-02-13 02:58:32 +00:00
UbitUmarov e1d5892f78 notecards text len is in bytes not chars 2020-02-13 00:38:02 +00:00
UbitUmarov f3238781cc oops 2020-02-10 02:19:35 +00:00
UbitUmarov fb2380efd6 fix handling of materials maps clear and total removal with SLSL 2020-02-09 19:14:17 +00:00
UbitUmarov 11c49c211c change a log message 2020-02-08 19:03:24 +00:00
UbitUmarov c239269762 change uuids on scripts gather 2020-02-08 18:45:38 +00:00
UbitUmarov ce72aa2eac ignore some assets on gather 2020-02-08 17:45:51 +00:00
UbitUmarov b97237b513 missed another file 2020-02-08 16:31:23 +00:00
UbitUmarov 8cbe743440 missing file and remove dead code 2020-02-08 16:27:30 +00:00
UbitUmarov 68e7e65e2e scritps can not read notecards with embedded items 2020-02-08 16:09:12 +00:00
UbitUmarov 9478e607db fix a typo on useraccount store 2020-02-08 13:05:23 +00:00
UbitUmarov 22227fa0b8 reduce some more spam on log 2020-02-08 01:10:30 +00:00
UbitUmarov c2ab11a51e reduce some spam on log 2020-02-08 00:29:41 +00:00
UbitUmarov 169f161576 cosmetics 2020-02-07 22:44:14 +00:00
UbitUmarov 43fea6530f yeack, better not break other notecards HG; improve TestNotecardAsset() 2020-02-07 22:39:36 +00:00
UbitUmarov c245ce3c25 change string terminator check 2020-02-06 22:54:17 +00:00
UbitUmarov b2ef1545e5 oops, some fixes 2020-02-06 22:39:04 +00:00
UbitUmarov 88d91b68f7 TestNotecardAsset() does not even create a valid notecard. Disable it for now 2020-02-06 19:29:00 +00:00
UbitUmarov 8060d132b9 mantis 8651: try to improve notecards HG sharing ( not tested) 2020-02-06 19:16:23 +00:00
UbitUmarov 7a79a6ddfe mantis 8651: clean code a bit 2020-02-06 16:13:32 +00:00
UbitUmarov 4de3dc2860 mantis 8651: change embedded decode a bit 2020-02-06 15:27:53 +00:00
UbitUmarov 18f2e25b23 mantis 8651: try to fix items embedded in notecards. This may need more work 2020-02-06 06:12:51 +00:00
UbitUmarov 3196d2fa6f mantis 8547: allow volume detectors to tell detector prim link number. Note that this is not as spec, also that the name llDetectedLinkNumber should actually be llDetectorLinkNumber since it refers to the detector not detected object 2020-02-03 13:25:00 +00:00
UbitUmarov 662c41ddee clear sell data when selling a object copy 2020-02-02 20:16:33 +00:00
UbitUmarov a22acd1c5c remove a few more references to simianGrid 2020-02-02 17:31:43 +00:00
UbitUmarov 9a5844fdb9 remove folder addin-db-002 on runprebuild 2020-02-02 17:01:27 +00:00
UbitUmarov 441b4e01f6 remove also caps with method DELETE; NOTE: to update existent regions with last commit you need to clean the solution, run prebuild, and delete folder bin/addin-db-002 2020-02-02 16:37:45 +00:00
UbitUmarov 941b65b44a removed outdated suport for simianGrid. Simian was a web/php alternative to Robust (https://code.google.com/archive/p/openmetaverse) 2020-02-02 16:18:08 +00:00
UbitUmarov fdecf80016 mantis 8654: exclude NPCs from some Friends ops 2020-02-01 15:26:58 +00:00
UbitUmarov 016886b3c6 changes on sqlite estatedata 2020-01-31 13:09:37 +00:00
UbitUmarov f89afd2aa8 fix some sqlite regionstore tables 2020-01-31 00:08:51 +00:00
UbitUmarov fb1911d409 revert 8cc02916ab. allow physics sit on
phanton to fall back to ugly sit because some objects depend on it
2020-01-29 21:23:30 +00:00
UbitUmarov 8075c1e363 do store UserCountry 2020-01-28 19:49:45 +00:00
UbitUmarov 53c9473100 mantis 8653 fix npc movement updates 2020-01-28 15:45:47 +00:00
UbitUmarov 76987fb647 ... osSetLinkStandTarget 2020-01-25 15:51:36 +00:00
UbitUmarov 8df27ba2a1 forgot again sintaxe 2020-01-25 15:32:03 +00:00
UbitUmarov 868c05fdf6 why not also osGetLinkStandTarget 2020-01-25 15:29:59 +00:00
UbitUmarov 5bb96cf18e update sintaxe 2020-01-25 14:26:00 +00:00
UbitUmarov 004cab9289 add osGetLinkSitActiveRange 2020-01-25 14:24:53 +00:00
UbitUmarov 64c7e1de5b add osSetLinkSitActiveRange 2020-01-25 13:32:52 +00:00
UbitUmarov 598ba5d6ae fix the dbs migrations 2020-01-23 11:14:12 +00:00
UbitUmarov f61b83b1ea store the new variables on sqlite and pgsql ( could not test) 2020-01-23 10:47:09 +00:00
UbitUmarov 2a38210fe9 serialize the new variables 2020-01-22 22:01:05 +00:00
UbitUmarov 33eabf1069 store the new variables on mysql 2020-01-22 21:32:40 +00:00
UbitUmarov da0ba17d1a fix bug on sit active range check 2020-01-22 21:19:38 +00:00
UbitUmarov 59f41598db limit unscripted and not done by physics sits to 10m distance again 2020-01-22 18:37:32 +00:00
UbitUmarov 7adaede14a mantis 8634: add osSetSitActiveRange(float range) , osSetStandTarget(vector feetAproxPosition) and respective get functions. range <0 disables sits on the prim, = 0 uses region default,feetAproxPosition is in prim local frame. <0,0,0> disables it. Still no persistance. feedback required! 2020-01-22 18:23:35 +00:00
UbitUmarov 8db60ba3aa back to sits and stands 2020-01-22 00:15:23 +00:00
UbitUmarov 8cc02916ab don't let physics sit on phantom fall back to ugly default 2020-01-20 19:26:12 +00:00
UbitUmarov 3f601c9267 don't allow viewer to change rotation on sit 2020-01-20 19:01:15 +00:00
UbitUmarov 0bd102a397 tell viewers to autopilot on sit, but bypass it, so camera does get set 2020-01-20 18:25:59 +00:00
UbitUmarov 0e1e247289 ok ok reduce stand jump a bit 2020-01-20 16:12:59 +00:00
UbitUmarov b70d44eb7e try to cache cof is a waste of time 2020-01-20 16:11:20 +00:00
UbitUmarov 80fe0c640b do not use viewer autopilot on physics sits also. Viewer side autopilot needs more work to avoid desyncs, that we never had 2020-01-20 16:09:45 +00:00
UbitUmarov 54370169bc remove usage of lludp highpriority send queue. It causes more issues than good 2020-01-20 16:01:21 +00:00
UbitUmarov ad6499cc09 fix last log message, and change things a bit 2020-01-20 11:48:32 +00:00
UbitUmarov ddef089eaa catch more error exception cases on fetchinventory req parsing 2020-01-19 20:10:08 +00:00
UbitUmarov f85e932f59 oops i still did not updated libomv with new flag name 2020-01-19 16:44:27 +00:00
UbitUmarov ba174b777c send allowaccessoverride flag on regionhandshake 2020-01-19 16:30:02 +00:00
UbitUmarov 28db80f100 mantis 8647: try to not lose materials on fast objects take, but without changing a lot of files 2020-01-19 00:31:28 +00:00
UbitUmarov 8db2ddb07f mantis 8645: change sqlite to just flag row delete, for commit to work 2020-01-18 21:09:41 +00:00
UbitUmarov 550f64cb2d mantis 8645: change sqlite (not exactly as provided patch) 2020-01-18 18:01:38 +00:00
UbitUmarov 2b2b5d8bff update httpserver.dll 2020-01-18 14:53:47 +00:00
UbitUmarov 5ad62558b3 mantis 8643: invert the meaning of internal flag TEXFREE true value to mean NOT allow parcel owner to be more restrictive than estate. This should reduce the impact of this feature on new and current regions, specially since some viewers still do not suport it. (yes still lazy to rename the thing) 2020-01-17 09:35:42 +00:00
UbitUmarov 1899a36105 add another kick to GC after map generation at run time 2020-01-13 18:46:25 +00:00
UbitUmarov 62f3892cd7 add a real transparent texure for default transparency and avatar alphas transparency. Asset 3a367d1c-bef1-6d43-7595-e88c1e3aadb3 must be rempoved by hand from current regions cache (at bin/assetcache/3a3) and viewers cache clean 2020-01-12 21:29:25 +00:00
UbitUmarov 6f5b7957a9 fix attachment point changes detection 2020-01-12 10:45:10 +00:00
UbitUmarov f417a647db exclude NPCs on adults and anonymous parcel access check 2020-01-11 17:32:33 +00:00
UbitUmarov c2cef470f5 Estate age and payment (anonimous) access control override parcel settings. Enforce it at parcel level (a bit heavy for now, needs revison) 2020-01-11 16:26:56 +00:00
UbitUmarov b9e74dd504 change IgnoreEstatePaymentAccessControl and IgnoreEstateMinorAccessControl default to true, since this require flags to be set on dbs, and enforcing was not working well 2020-01-11 16:16:49 +00:00
UbitUmarov 29a6c1d0c8 fix IgnoreEstatePaymentAccessControl option 2020-01-11 14:57:43 +00:00
UbitUmarov ea7dd150b1 disable parcels access control if disabled at estate ( not that estate flag is still named TAXFREE 2020-01-11 14:11:46 +00:00
UbitUmarov d92ef598c5 EstateAccess get: do send empty arrays 2020-01-11 12:58:46 +00:00
UbitUmarov ac32188978 add a silly GatekeeperURIAlias example 2020-01-10 01:44:10 +00:00
UbitUmarov 5dbcb7a99e add config option GatekeeperURIAlias to list other FQDN or ips of same local grid 2020-01-10 01:38:41 +00:00
UbitUmarov 42afa8429e mantis 8639: recover object selected state in case of lludp object updates packet size overflow; 2020-01-08 10:25:59 +00:00
UbitUmarov c54460b6f0 update release notes url 2020-01-07 17:30:23 +00:00
UbitUmarov d9d763c8f8 change version 2020-01-07 15:18:49 +00:00
UbitUmarov 7bdc408cac change some lsl flag constants to Hexa 2020-01-07 14:51:07 +00:00
UbitUmarov 066a6fbaa1 changes on lludp acks and resends 2019-12-18 23:26:13 +00:00
UbitUmarov 7516288634 missing files 2019-12-16 16:12:04 +00:00
UbitUmarov 60473ff44e update libomv 2019-12-16 16:05:46 +00:00
UbitUmarov 8c21b30a51 do dispatch RequestLure ims 2019-12-16 01:27:49 +00:00
UbitUmarov d400b2c545 add a formal lock object 2019-12-10 12:36:29 +00:00
UbitUmarov 449bd9beab enforce invariant culture on landmarks 2019-12-10 12:33:56 +00:00
UbitUmarov 052e4a060c mantis 8632: stop trigering Changed on just scale checks 2019-12-03 14:27:31 +00:00
UbitUmarov 5c5e4bd830 a few changes on check targets for lsl 2019-11-27 16:44:45 +00:00
UbitUmarov b3db90db92 and yes mono-addins .... 2019-11-24 20:08:00 +00:00
UbitUmarov bd15005d77 and yes mono-addins again 2019-11-24 18:43:50 +00:00
UbitUmarov e8d1493777 mantis 8631: and another try... 2019-11-24 11:40:04 +00:00
UbitUmarov 17e4b52171 mantis 8631: the missing file 2019-11-24 11:09:25 +00:00
UbitUmarov 9aa0f21ffa mantis 8631: mono addins again (one file missing) 2019-11-24 11:07:55 +00:00
UbitUmarov 6e2b5ac238 fix identation 2019-11-23 01:21:36 +00:00
UbitUmarov 14270e316a fix xml decode of kfm in single prims case 2019-11-23 01:17:03 +00:00
UbitUmarov 2a508edcb4 YEngine: change some startup log messages 2019-11-22 07:42:00 +00:00
UbitUmarov 943d0935a6 YEngine, change default number of exec threads to 2 of priority Normal. Let the threads priority a option on ini files 2019-11-22 07:01:17 +00:00
UbitUmarov d5f918f945 Oooopss 2019-11-22 06:07:28 +00:00
UbitUmarov 9b7ad30ee1 more changes on YEngine scripts heap usage 2019-11-22 04:09:05 +00:00
UbitUmarov 647622bb02 cosmetics 2019-11-20 23:29:24 +00:00
UbitUmarov bd12d60e80 cosmetics 2019-11-20 23:16:20 +00:00
UbitUmarov 0cf3ec553a fix the block of teleport to same region handle 2019-11-18 20:17:48 +00:00
UbitUmarov 730a35eedc Yengine: more on constants operations reduction 2019-11-18 19:07:03 +00:00
UbitUmarov bf0697d5f4 mantis 8551: Simplify Yengine heap usage control 2019-11-18 17:33:02 +00:00
UbitUmarov 496a2228f5 update mono addins again 2019-11-18 04:13:46 +00:00
UbitUmarov b5d2a6088c revert to previus ICSharpCode.SharpZipLib.dll that was .net4.6 unlike new one 2019-11-18 03:49:57 +00:00
UbitUmarov 3708f504a6 fix a info message 2019-11-18 03:18:23 +00:00
Diva Canto 72362dd09c Mono addins uses this, and the version was now incompatible. 2019-11-17 15:19:15 -08:00
Crista Lopes 9fd2b239d9 Replaced mono addins dlls and mautil.exe with the patch 2019-11-17 14:33:00 -08:00
UbitUmarov 7dd5c9ccad update mono addins ( need to runprebuidl and recomp opensim) 2019-11-17 21:40:02 +00:00
UbitUmarov 103ebac082 terrain: make sure modify does get unblocked 2019-11-17 15:01:21 +00:00
UbitUmarov 61f918cbda remove some llUDP options 2019-11-16 22:19:46 +00:00
UbitUmarov cb97ab5c6f make attachments WearReplacesAll option visible 2019-11-14 22:34:39 +00:00
UbitUmarov 45625a02a2 update contributors 2019-11-14 06:49:13 +00:00
UbitUmarov 31aef4e82b work on previus 2 patchs 2019-11-14 06:34:44 +00:00
Terry 999a068172 Complete PostGres from previous commit - (Not Tested)
Signed-off-by: Terry <terry@digiworldz.com>
Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
2019-11-14 05:28:57 +00:00
Terry 2f79f463ea Attempt to fix the issue where, when logging into the grid, the user supplies a region name, but instead of going to the specific region, they are sent to a region "Like" the one specified.
Signed-off-by: Terry <terry@digiworldz.com>
Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
2019-11-14 05:26:54 +00:00
UbitUmarov eabf9a7c04 mantis 8627: handle the case constant compareOp constant on Yengine 2019-11-13 23:26:22 +00:00
UbitUmarov d9d78c3423 Terrain: more double to float 2019-11-13 19:53:15 +00:00
UbitUmarov 5d2ffdc35b limit max number of attachments to 38. All can be on same point 2019-11-13 18:44:58 +00:00
UbitUmarov 2828aa3e9b Reduce Max region size to 4096m 2019-11-13 18:00:45 +00:00
UbitUmarov 8fcecc93a6 missed a few 2019-11-12 18:24:56 +00:00
UbitUmarov d10f11d310 terrain replace double by float 2019-11-12 18:19:12 +00:00
UbitUmarov 9eb5fd4330 more changes on terrain edit. Silent ignore comand if busy (large area smooth can take ages), brush changes, etc 2019-11-12 03:16:53 +00:00
UbitUmarov 01832b3e3c missing file, of course 2019-11-11 12:54:42 +00:00
UbitUmarov e87dfd48bf Yengine: we also need to cancel timer events in queue, because some bad scripts that do work on X 2019-11-11 12:51:09 +00:00
UbitUmarov 38a77a8bb5 terraforming changes: try recover llmodifyland previus behaviur 2019-11-10 21:12:52 +00:00
UbitUmarov ee68085628 SIO_UDP_CONNRESET should work on macs now, thx Gavin 2019-11-10 19:14:12 +00:00
UbitUmarov 435c30c038 terraforming changes: comment a debug message 2019-11-10 04:37:41 +00:00
UbitUmarov b4d9f7ffe8 terraforming changes: support selected parcel edit; fix area smooth 2019-11-10 02:48:54 +00:00
UbitUmarov f6ea22647d terraforming changes: make jenkis happy 2019-11-10 00:47:40 +00:00
UbitUmarov 727216044b terraforming changes: missing file 2019-11-10 00:03:39 +00:00
UbitUmarov 53339d2970 terraforming changes: make sliders work, remove some brushs, etc. Feedback needed (run prebuild) 2019-11-09 23:59:19 +00:00
UbitUmarov 4b5a3308ad cosmetics 2019-11-08 17:43:22 +00:00
UbitUmarov ca4bb8c492 let autopilot also stand from a object 2019-11-07 03:53:05 +00:00
UbitUmarov bd9f6ae3f0 avoid a null ref 2019-11-07 03:01:07 +00:00
UbitUmarov 8ed0680bb9 handle null refs on llSubStringIndex() 2019-11-06 23:40:53 +00:00
UbitUmarov 926e4ea95e mantis 8624: replace native code libs for Mac by ones signed by Geir Nøklebye (Gavin Hird). Ths again Gavin 2019-11-05 15:39:44 +00:00
UbitUmarov 11a357d7fa YEngine: fix credits comment 2019-11-05 15:08:58 +00:00
UbitUmarov 040c8d5e9a dynamic textures: add ' lossless: [true|false] ', default false, extraParam 2019-11-04 20:17:12 +00:00
UbitUmarov 21f86c453d YEngine: fix wrong language detection on some comments in first line 2019-11-04 17:22:42 +00:00
UbitUmarov bae7b21e87 update libopenmetaverse ( attach points) 2019-11-04 10:44:29 +00:00
UbitUmarov f2cf3b201b avoid a null ref 2019-11-02 21:53:12 +00:00
UbitUmarov 26b5affb04 FlotSamAssetcache write to disk needs be sync. 2019-11-01 15:00:22 +00:00
UbitUmarov 3236e24c74 a disabled module has no caps to tell viewers (cameraonlymoduel) 2019-10-31 16:41:28 +00:00
UbitUmarov 5a3ba2afbb always allow part deselect 2019-10-30 04:46:47 +00:00
UbitUmarov 9d6a1e01f9 fix some mysql timestamps default value 2019-10-29 22:55:51 +00:00
UbitUmarov defa235859 update server release notes default URL 2019-10-29 14:37:41 +00:00
UbitUmarov 4797f8210c update version name 2019-10-28 16:41:26 +00:00
UbitUmarov b073d2ae6b change version 2019-10-28 11:28:00 +00:00
476 changed files with 27650 additions and 27423 deletions

View File

@ -185,15 +185,18 @@ what it is today.
* SpotOn3D
* Stefan_Boom / stoehr
* Steven Zielinski (MOSES)
* Stolen Ruby
* Strawberry Fride
* Talun
* TechplexEngineer (Blake Bourque)
* TBG Renfold
* Terry Ford
* tglion
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
* TomDataWorks
* TomTheDragon (muckwaddle)
* tyre
* uriesk
* Vegaslon <vegaslon@gmail.com>
* Vincent Sylvester
* VikingErik

View File

@ -252,7 +252,7 @@ namespace OpenSim.Groups
m_debugEnabled = verbose;
MainConsole.Instance.Output("{0} verbose logging set to {1}", null, Name, m_debugEnabled);
MainConsole.Instance.Output("{0} verbose logging set to {1}", Name, m_debugEnabled);
}
/// <summary>
@ -599,13 +599,16 @@ namespace OpenSim.Groups
{
if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: Sending chatterbox invite instant message");
UUID fromAgent = new UUID(msg.fromAgentID);
// Force? open the group session dialog???
// and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
eq.ChatterboxInvitation(
GroupID
, groupInfo.GroupName
, new UUID(msg.fromAgentID)
, fromAgent
, msg.message
, AgentID
, msg.fromAgentName
@ -620,15 +623,10 @@ namespace OpenSim.Groups
, OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
);
eq.ChatterBoxSessionAgentListUpdates(
new UUID(GroupID)
, AgentID
, new UUID(msg.toAgentID)
, false //canVoiceChat
, false //isModerator
, false //text mute
, true // Enter
);
var update = new GroupChatListAgentUpdateData(AgentID);
var updates = new List<GroupChatListAgentUpdateData> { update };
eq.ChatterBoxSessionAgentListUpdates(GroupID, new UUID(msg.toAgentID), updates);
}
}
}
}
@ -663,15 +661,12 @@ namespace OpenSim.Groups
ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
queue.ChatterBoxSessionAgentListUpdates(
GroupID
, AgentID
, new UUID(im.toAgentID)
, false //canVoiceChat
, false //isModerator
, false //text mute
, true
);
if (queue != null)
{
var update = new GroupChatListAgentUpdateData(AgentID);
var updates = new List<GroupChatListAgentUpdateData> { update };
queue.ChatterBoxSessionAgentListUpdates(GroupID, remoteClient.AgentId, updates);
}
}
}
@ -713,11 +708,7 @@ namespace OpenSim.Groups
bodyMap.Add("session_info", sessionMap);
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
if (queue != null)
{
queue.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
}
queue?.Enqueue(queue.BuildEvent("ChatterBoxSessionStartReply", bodyMap), remoteClient.AgentId);
}
private void DebugGridInstantMessage(GridInstantMessage im)

View File

@ -38,7 +38,7 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
using PermissionMask = OpenSim.Framework.PermissionMask;
namespace OpenSim.Groups
{
@ -127,7 +127,7 @@ namespace OpenSim.Groups
m_debugEnabled = verbose;
MainConsole.Instance.Output("{0} verbose logging set to {1}", null, Name, m_debugEnabled);
MainConsole.Instance.Output("{0} verbose logging set to {1}", Name, m_debugEnabled);
}
public void RegionLoaded(Scene scene)
@ -233,7 +233,7 @@ namespace OpenSim.Groups
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
client.OnRequestAvatarProperties += OnRequestAvatarProperties;
//client.OnRequestAvatarProperties += OnRequestAvatarProperties;
}
@ -261,7 +261,7 @@ namespace OpenSim.Groups
// Used for Notices and Group Invites/Accept/Reject
sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
}
/*
private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@ -269,7 +269,7 @@ namespace OpenSim.Groups
GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID);
remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups);
}
*/
private void OnClientClosed(UUID AgentId, Scene scene)
{
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@ -281,7 +281,7 @@ namespace OpenSim.Groups
if (client != null)
{
client.OnAgentDataUpdateRequest -= OnAgentDataUpdateRequest;
client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
//client.OnRequestAvatarProperties -= OnRequestAvatarProperties;
// make child possible not called?
client.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
client.OnInstantMessage -= OnInstantMessage;
@ -344,14 +344,24 @@ namespace OpenSim.Groups
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
if (m_debugEnabled)
m_log.DebugFormat("[Groups]: OnInstantMessage called");
if(remoteClient == null || !remoteClient.IsActive || remoteClient.AgentId == UUID.Zero)
return;
Scene scene = (Scene)remoteClient.Scene;
if (scene == null)
return;
string remoteAgentIDstr = remoteClient.AgentId.ToString();
//m_log.DebugFormat("[Groups]: IM From {0} to {1} msg {2} type {3}", im.fromAgentID, im.toAgentID, im.message, (InstantMessageDialog)im.dialog);
// Group invitations
if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
{
UUID inviteID = new UUID(im.imSessionID);
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(remoteAgentIDstr, inviteID);
if (inviteInfo == null)
{
@ -374,7 +384,7 @@ namespace OpenSim.Groups
// and the sessionid is the role
string reason = string.Empty;
if (!m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), invitee.ToString(), inviteInfo.GroupID, inviteInfo.RoleID, string.Empty, out reason))
if (!m_groupData.AddAgentToGroup(remoteAgentIDstr, invitee.ToString(), inviteInfo.GroupID, inviteInfo.RoleID, string.Empty, out reason))
remoteClient.SendAgentAlertMessage("Unable to add you to the group: " + reason, false);
else
{
@ -401,104 +411,155 @@ namespace OpenSim.Groups
}
}
m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
m_groupData.RemoveAgentToGroupInvite(remoteAgentIDstr, inviteID);
}
// Reject
if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: Received a reject invite notice.");
m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentIDStr(remoteClient), inviteID);
if (m_debugEnabled)
m_log.DebugFormat("[Groups]: Received a reject invite notice.");
m_groupData.RemoveAgentFromGroup(GetRequestingAgentIDStr(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID);
m_groupData.RemoveAgentToGroupInvite(remoteAgentIDstr, inviteID);
m_groupData.RemoveAgentFromGroup(remoteAgentIDstr, inviteInfo.AgentID, inviteInfo.GroupID);
}
}
}
// Group notices
if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
else if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
{
if (!m_groupNoticesEnabled)
return;
UUID GroupID = new UUID(im.toAgentID);
GroupMembershipData grpMemberData = m_groupData.GetAgentGroupMembership(remoteAgentIDstr, remoteAgentIDstr, GroupID);
if (grpMemberData == null)
{
remoteClient.SendAgentAlertMessage("Group membership not found", false);
return;
}
UUID GroupID = new UUID(im.toAgentID);
if (m_groupData.GetGroupRecord(GetRequestingAgentIDStr(remoteClient), GroupID, null) != null)
if ((grpMemberData.GroupPowers & (ulong)GroupPowers.SendNotices) == 0)
{
remoteClient.SendAgentAlertMessage("No permission to send notice to group", false);
return;
}
int index = im.message.IndexOf('|');
if (index < 0)
return;
string Subject = im.message.Substring(0, index);
string Message = im.message.Substring(index + 1);
UUID NoticeID = UUID.Random();
string Subject = im.message.Substring(0, im.message.IndexOf('|'));
string Message = im.message.Substring(Subject.Length + 1);
InventoryItemBase item = null;
bool hasAttachment = false;
if (im.binaryBucket.Length >= 1 && im.binaryBucket[0] > 0)
{
hasAttachment = true;
string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket);
binBucket = binBucket.Remove(0, 14).Trim();
OSD binBucketOSD = OSDParser.DeserializeLLSDXml(binBucket);
if (binBucketOSD is OSDMap)
UUID itemID = UUID.Zero;
UUID ownerID = UUID.Zero;
try
{
OSDMap binBucketMap = (OSDMap)binBucketOSD;
string binBucket = Utils.BytesToString(im.binaryBucket);
binBucket = binBucket.Substring(15); // remove extra LLSD pre header
UUID itemID = binBucketMap["item_id"].AsUUID();
UUID ownerID = binBucketMap["owner_id"].AsUUID();
item = m_sceneList[0].InventoryService.GetItem(ownerID, itemID);
OSDMap binBucketMAP = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket);
itemID = binBucketMAP["item_id"].AsUUID();
ownerID = binBucketMAP["owner_id"].AsUUID();
}
else
m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType());
catch
{
m_log.DebugFormat("[GROUPS]: failed to decode group notice bucket");
return;
}
if (m_groupData.AddGroupNotice(GetRequestingAgentIDStr(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message,
if (itemID != UUID.Zero && ownerID != UUID.Zero)
{
item = scene.InventoryService.GetItem(ownerID, itemID);
if(item != null)
{
if ((item.CurrentPermissions & (uint)(PermissionMask.Transfer | PermissionMask.Copy)) !=
(uint)(PermissionMask.Transfer | PermissionMask.Copy))
{
remoteClient.SendAgentAlertMessage("Item must be have Copy and Transfer rights to attach to group notice", false);
return;
}
}
hasAttachment = true;
}
}
if (m_groupData.AddGroupNotice(remoteAgentIDstr, GroupID, NoticeID, im.fromAgentName, Subject, Message,
hasAttachment,
(byte)(item == null ? 0 : item.AssetType),
item == null ? null : item.Name,
item == null ? UUID.Zero : item.ID,
item == null ? UUID.Zero.ToString() : item.Owner.ToString()))
{
if (OnNewGroupNotice != null)
{
OnNewGroupNotice(GroupID, NoticeID);
}
OnNewGroupNotice?.Invoke(GroupID, NoticeID);
// Send notice out to everyone that wants notices
foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentIDStr(remoteClient), GroupID))
foreach (GroupMembersData member in m_groupData.GetGroupMembers(remoteAgentIDstr, GroupID))
{
GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)InstantMessageDialog.GroupNotice);
if (member.AcceptNotices)
{
// Build notice IIM, one of reach, because the sending may be async
GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
msg.toAgentID = member.AgentID.Guid;
OutgoingInstantMessage(msg, member.AgentID);
}
}
}
}
}
if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryAccepted)
{
if (im.binaryBucket.Length < 16) // Invalid
if (!m_groupNoticesEnabled)
return;
//// 16 bytes are the UUID. Maybe.
// UUID folderID = new UUID(im.binaryBucket, 0);
UUID noticeID = new UUID(im.imSessionID);
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID);
if (notice != null)
if (m_debugEnabled)
m_log.DebugFormat("[xmlGROUPS]: Accepted notice {0} for {1}", noticeID, remoteClient.AgentId);
if (noticeID == UUID.Zero)
return;
UUID folderID = UUID.Zero;
try
{
if (im.binaryBucket != null && im.binaryBucket.Length >= 16)
folderID = new UUID(im.binaryBucket, 0);
}
catch
{
m_log.DebugFormat("[xmlGROUPS]: GroupNoticeInventoryAccepted failed to decode target folder");
return;
}
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteAgentIDstr, noticeID);
if (notice == null)
{
if (m_debugEnabled)
m_log.DebugFormat(
"[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
noticeID, remoteClient.AgentId);
return;
}
string tmp;
UUID giver = new UUID(im.toAgentID);
string tmp = string.Empty;
Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp);
m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
string message;
InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
giver, notice.noticeData.AttachmentItemID, out message);
string message = "Could not find group notice attached item";
InventoryItemBase itemCopy = scene.GiveInventoryItem(remoteClient.AgentId,
giver, notice.noticeData.AttachmentItemID, folderID, out message);
if (itemCopy == null)
{
@ -508,14 +569,79 @@ namespace OpenSim.Groups
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
}
else if (im.dialog == (byte)InstantMessageDialog.GroupNoticeInventoryDeclined)
{
if (!m_groupNoticesEnabled)
return;
UUID noticeID = new UUID(im.imSessionID);
if (m_debugEnabled)
m_log.DebugFormat("[GROUPS]: Accepted notice {0} for {1}", noticeID, remoteAgentIDstr);
if (noticeID == UUID.Zero)
return;
UUID remoteAgentID = remoteClient.AgentId;
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteAgentIDstr, noticeID);
if (notice == null)
{
if (m_debugEnabled)
m_log.DebugFormat(
"[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
noticeID, remoteClient.AgentId);
return;
}
string giver = notice.noticeData.AttachmentOwnerID;
UUID attachmentUUID = notice.noticeData.AttachmentItemID;
if (attachmentUUID == null ||
attachmentUUID == UUID.Zero ||
giver == null ||
giver == UUID.Zero.ToString()
)
return;
if (m_debugEnabled)
m_log.DebugFormat("[xmlGroups]: Deny inventory from {0} to {1}", giver, remoteAgentIDstr);
string message = String.Empty;
InventoryItemBase itemCopy = scene.InventoryService.GetItem(remoteAgentID, attachmentUUID);
if (itemCopy == null)
return;
InventoryFolderBase trash = scene.InventoryService.GetFolderForType(remoteAgentID, FolderType.Trash);
if (trash == null)
{
m_log.DebugFormat("[GROUPS]: failed to find trash folder for {0} ", remoteAgentID);
return;
}
if (itemCopy.Folder == trash.ID || remoteAgentIDstr == notice.noticeData.AttachmentOwnerID)
return;
itemCopy.Folder = trash.ID;
scene.InventoryService.MoveItems(itemCopy.Owner, new List<InventoryItemBase>() { itemCopy });
if (itemCopy == null)
{
remoteClient.SendAgentAlertMessage(message, false);
return;
}
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
}
// Interop, received special 210 code for ejecting a group member
// this only works within the comms servers domain, and won't work hypergrid
// TODO:FIXME: Use a presense server of some kind to find out where the
// client actually is, and try contacting that region directly to notify them,
// or provide the notification via xmlrpc update queue
if ((im.dialog == 210))
else if ((im.dialog == 210))
{
// This is sent from the region that the ejectee was ejected from
// if it's being delivered here, then the ejectee is here
@ -949,6 +1075,7 @@ namespace OpenSim.Groups
bucket = new byte[19 + name.Length];
bucket[0] = 1; // has attachment?
bucket[1] = info.noticeData.AttachmentType; // attachment type
info.GroupID.ToBytes(bucket, 2);
name.CopyTo(bucket, 18);
}
else
@ -959,7 +1086,6 @@ namespace OpenSim.Groups
bucket[18] = 0; // null terminated
}
info.GroupID.ToBytes(bucket, 2);
msg.binaryBucket = bucket;
}
else
@ -1208,7 +1334,7 @@ namespace OpenSim.Groups
public List<DirGroupsReplyData> FindGroups(IClientAPI remoteClient, string query)
{
return m_groupData.FindGroups(GetRequestingAgentIDStr(remoteClient), query);
return m_groupData.FindGroups(remoteClient.AgentId.ToString(), query);
}
#endregion

View File

@ -246,9 +246,9 @@ namespace OpenSim.Groups
return null;
}
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
{
return m_LocalGroupsConnector.FindGroups(AgentUUI(RequestingAgentID), search);
return m_LocalGroupsConnector.FindGroups(RequestingAgentIDstr, search);
}
public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)

View File

@ -39,7 +39,7 @@ namespace OpenSim.Groups
bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee,
bool openEnrollment, bool allowPublish, bool maturePublish, out string reason);
ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName);
List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search);
List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search);
List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID);
bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason);

View File

@ -173,9 +173,9 @@ namespace OpenSim.Groups
return null;
}
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
{
return m_GroupsService.FindGroups(RequestingAgentID, search);
return m_GroupsService.FindGroups(RequestingAgentIDstr, search);
}
public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)

View File

@ -153,7 +153,7 @@ namespace OpenSim.Groups
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
}
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string query)
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string query)
{
List<DirGroupsReplyData> hits = new List<DirGroupsReplyData>();
if (string.IsNullOrEmpty(query))
@ -161,7 +161,7 @@ namespace OpenSim.Groups
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["Query"] = query;
sendData["RequestingAgentID"] = RequestingAgentID;
sendData["RequestingAgentID"] = RequestingAgentIDstr;
Dictionary<string, object> ret = MakeRequest("FINDGROUPS", sendData);

View File

@ -192,10 +192,10 @@ namespace OpenSim.Groups
});
}
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string search)
{
// TODO!
return m_GroupsService.FindGroups(RequestingAgentID, search);
return m_GroupsService.FindGroups(RequestingAgentIDstr, search);
}
public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)

View File

@ -68,6 +68,7 @@ namespace OpenSim.Groups
GroupPowers.LandDeed |
GroupPowers.LandDivideJoin |
GroupPowers.LandEdit |
GroupPowers.AllowEnvironment |
GroupPowers.LandEjectAndFreeze |
GroupPowers.LandGardening |
GroupPowers.LandManageAllowed |

View File

@ -110,10 +110,9 @@ namespace OpenSim.OfflineIM
{
m_serializer.Serialize(writer, im);
writer.Flush();
}
imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray());
}
}
OfflineIMData data = new OfflineIMData();
data.PrincipalID = principalID;

View File

@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.IO;
using System.Reflection;
using System.Threading;
@ -49,9 +50,9 @@ namespace OpenSim.Framework.Capabilities
/// </summary>
public delegate IClientAPI GetClientDelegate(UUID agentID);
public class Caps
public class Caps : IDisposable
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_httpListenerHostName;
private uint m_httpListenPort;
@ -64,8 +65,8 @@ namespace OpenSim.Framework.Capabilities
private CapsHandlers m_capsHandlers;
private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
= new Dictionary<string, PollServiceEventArgs>();
private ConcurrentDictionary<string, PollServiceEventArgs> m_pollServiceHandlers
= new ConcurrentDictionary<string, PollServiceEventArgs>();
private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>();
@ -125,7 +126,9 @@ namespace OpenSim.Framework.Capabilities
None = 0,
SentSeeds = 1,
ObjectAnim = 0x10
ObjectAnim = 0x100,
WLEnv = 0x200,
AdvEnv = 0x400
}
public CapsFlags Flags { get; set;}
@ -163,6 +166,23 @@ namespace OpenSim.Framework.Capabilities
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public void Dispose(bool disposing)
{
Flags = CapsFlags.None;
if (m_capsActive != null)
{
DeregisterHandlers();
m_capsActive.Dispose();
m_capsActive = null;
}
}
/// <summary>
/// Register a handler. This allows modules to register handlers.
/// </summary>
@ -174,15 +194,27 @@ namespace OpenSim.Framework.Capabilities
m_capsHandlers[capName] = handler;
}
public void RegisterSimpleHandler(string capName, ISimpleStreamHandler handler, bool addToListener = true)
{
//m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
m_capsHandlers.AddSimpleHandler(capName, handler, addToListener);
}
public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
{
// m_log.DebugFormat(
// "[CAPS]: Registering handler with name {0}, url {1} for {2}",
// capName, pollServiceHandler.Url, m_agentID, m_regionName);
m_pollServiceHandlers.Add(capName, pollServiceHandler);
if(!m_pollServiceHandlers.TryAdd(capName, pollServiceHandler))
{
m_log.ErrorFormat(
"[CAPS]: Handler with name {0} already registered (ulr {1}, agent {2}, region {3}",
capName, pollServiceHandler.Url, m_agentID, m_regionName);
return;
}
m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler.Url, pollServiceHandler);
m_httpListener.AddPollServiceHTTPHandler(pollServiceHandler);
// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
// string protocol = "http";
@ -222,7 +254,7 @@ namespace OpenSim.Framework.Capabilities
foreach (PollServiceEventArgs handler in m_pollServiceHandlers.Values)
{
m_httpListener.RemovePollServiceHTTPHandler("", handler.Url);
m_httpListener.RemovePollServiceHTTPHandler(handler.Url);
}
m_pollServiceHandlers.Clear();
}
@ -263,9 +295,6 @@ namespace OpenSim.Framework.Capabilities
port = MainServer.Instance.SSLPort;
protocol = "https";
}
//
// caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
caps[kvp.Key] = string.Format("{0}://{1}:{2}{3}", protocol, hostName, port, kvp.Value.Url);
}
}
@ -279,7 +308,7 @@ namespace OpenSim.Framework.Capabilities
caps[kvp.Key] = kvp.Value;
}
Flags |= CapsFlags.SentSeeds;
return caps;
}

View File

@ -27,6 +27,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Concurrent;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
@ -40,6 +41,7 @@ namespace OpenSim.Framework.Capabilities
public class CapsHandlers
{
private Dictionary<string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>();
private ConcurrentDictionary<string, ISimpleStreamHandler> m_capsSimpleHandlers = new ConcurrentDictionary<string, ISimpleStreamHandler>();
private IHttpServer m_httpListener;
private string m_httpListenerHostName;
private uint m_httpListenerPort;
@ -72,18 +74,36 @@ namespace OpenSim.Framework.Capabilities
public void Remove(string capsName)
{
lock (m_capsHandlers)
{
if(m_capsHandlers.ContainsKey(capsName))
{
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
m_httpListener.RemoveStreamHandler("PUT", m_capsHandlers[capsName].Path);
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path);
m_httpListener.RemoveStreamHandler("DELETE", m_capsHandlers[capsName].Path);
m_capsHandlers.Remove(capsName);
}
}
if(m_capsSimpleHandlers.TryRemove(capsName, out ISimpleStreamHandler hdr))
{
m_httpListener.RemoveSimpleStreamHandler(hdr.Path);
}
}
public void AddSimpleHandler(string capName, ISimpleStreamHandler handler, bool addToListener = true)
{
if(ContainsCap(capName))
Remove(capName);
if(m_capsSimpleHandlers.TryAdd(capName, handler) && addToListener)
m_httpListener.AddSimpleStreamHandler(handler);
}
public bool ContainsCap(string cap)
{
lock (m_capsHandlers)
return m_capsHandlers.ContainsKey(cap);
if (m_capsHandlers.ContainsKey(cap))
return true;
return m_capsSimpleHandlers.ContainsKey(cap);
}
/// <summary>
@ -110,6 +130,9 @@ namespace OpenSim.Framework.Capabilities
if (m_capsHandlers.ContainsKey(idx))
{
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
m_httpListener.RemoveStreamHandler("PUT", m_capsHandlers[idx].Path);
m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[idx].Path);
m_httpListener.RemoveStreamHandler("DELETE", m_capsHandlers[idx].Path);
m_capsHandlers.Remove(idx);
}
@ -131,8 +154,9 @@ namespace OpenSim.Framework.Capabilities
{
lock (m_capsHandlers)
{
string[] __keys = new string[m_capsHandlers.Keys.Count];
string[] __keys = new string[m_capsHandlers.Keys.Count + m_capsSimpleHandlers.Keys.Count];
m_capsHandlers.Keys.CopyTo(__keys, 0);
m_capsSimpleHandlers.Keys.CopyTo(__keys, m_capsHandlers.Keys.Count);
return __keys;
}
}
@ -146,24 +170,39 @@ namespace OpenSim.Framework.Capabilities
public Hashtable GetCapsDetails(bool excludeSeed, List<string> requestedCaps)
{
Hashtable caps = new Hashtable();
string protocol = "http://";
if (m_useSSL)
protocol = "https://";
string protocol = m_useSSL ? "https://" : "http://";
string baseUrl = protocol + m_httpListenerHostName + ":" + m_httpListenerPort.ToString();
if (requestedCaps == null)
{
lock (m_capsHandlers)
{
foreach (KeyValuePair<string, ISimpleStreamHandler> kvp in m_capsSimpleHandlers)
caps[kvp.Key] = baseUrl + kvp.Value.Path;
foreach (KeyValuePair<string, IRequestHandler> kvp in m_capsHandlers)
caps[kvp.Key] = baseUrl + kvp.Value.Path;
}
return caps;
}
lock (m_capsHandlers)
{
foreach (string capsName in m_capsHandlers.Keys)
for(int i = 0; i < requestedCaps.Count; ++i)
{
string capsName = requestedCaps[i];
if (excludeSeed && "SEED" == capsName)
continue;
if (requestedCaps != null && !requestedCaps.Contains(capsName))
if (m_capsSimpleHandlers.TryGetValue(capsName, out ISimpleStreamHandler shdr))
{
caps[capsName] = baseUrl + shdr.Path;
continue;
caps[capsName] = baseUrl + m_capsHandlers[capsName].Path;
}
if (m_capsHandlers.TryGetValue(capsName, out IRequestHandler chdr))
{
caps[capsName] = baseUrl + chdr.Path;
}
}
}

View File

@ -1,116 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Reflection;
using System.Web;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
//using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers
{
public class AvatarPickerSearchHandler : BaseStreamHandler
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IPeople m_PeopleService;
public AvatarPickerSearchHandler(string path, IPeople peopleService, string name, string description)
: base("GET", path, name, description)
{
m_PeopleService = peopleService;
}
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Try to parse the texture ID from the request URL
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
string names = query.GetOne("names");
string psize = query.GetOne("page_size");
string pnumber = query.GetOne("page");
if (m_PeopleService == null)
return FailureResponse(names, (int)System.Net.HttpStatusCode.InternalServerError, httpResponse);
if (string.IsNullOrEmpty(names) || names.Length < 3)
return FailureResponse(names, (int)System.Net.HttpStatusCode.BadRequest, httpResponse);
m_log.DebugFormat("[AVATAR PICKER SEARCH]: search for {0}", names);
int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
// Full content request
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
//httpResponse.ContentLength = ??;
httpResponse.ContentType = "application/llsd+xml";
List<UserData> users = m_PeopleService.GetUserData(names, page_size, page_number);
LLSDAvatarPicker osdReply = new LLSDAvatarPicker();
osdReply.next_page_url = httpRequest.RawUrl;
foreach (UserData u in users)
osdReply.agents.Array.Add(ConvertUserData(u));
string reply = LLSDHelpers.SerialiseLLSDReply(osdReply);
return System.Text.Encoding.UTF8.GetBytes(reply);
}
private LLSDPerson ConvertUserData(UserData user)
{
LLSDPerson p = new LLSDPerson();
p.legacy_first_name = user.FirstName;
p.legacy_last_name = user.LastName;
p.display_name = user.FirstName + " " + user.LastName;
if (user.LastName.StartsWith("@"))
p.username = user.FirstName.ToLower() + user.LastName.ToLower();
else
p.username = user.FirstName.ToLower() + "." + user.LastName.ToLower();
p.id = user.Id;
p.is_display_name_default = false;
return p;
}
private byte[] FailureResponse(string names, int statuscode, IOSHttpResponse httpResponse)
{
m_log.Error("[AVATAR PICKER SEARCH]: Error searching for " + names);
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
return System.Text.Encoding.UTF8.GetBytes(string.Empty);
}
}
}

View File

@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
@ -37,10 +38,10 @@ using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Framework.Capabilities;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
namespace OpenSim.Capabilities.Handlers
{
@ -49,10 +50,10 @@ namespace OpenSim.Capabilities.Handlers
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static byte[] EmptyResponse = Util.UTF8NBGetbytes("<llsd><map><key>folders</key><array /></map></llsd>");
private IInventoryService m_InventoryService;
private ILibraryService m_LibraryService;
private IScene m_Scene;
// private object m_fetchLock = new Object();
public FetchInvDescHandler(IInventoryService invService, ILibraryService libService, IScene s)
{
@ -61,52 +62,86 @@ namespace OpenSim.Capabilities.Handlers
m_Scene = s;
}
public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
public void FetchInventoryDescendentsRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, ExpiringKey<UUID> BadRequests)
{
//m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request);
Hashtable hash = new Hashtable();
List<LLSDFetchInventoryDescendents> folders = null;
List<UUID> bad_folders = new List<UUID>();
try
{
hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
}
catch (LLSD.LLSDParseException e)
OSDArray foldersrequested = null;
OSD tmp = OSDParser.DeserializeLLSDXml(httpRequest.InputStream);
OSDMap map = (OSDMap)tmp;
if(map.TryGetValue("folders", out tmp) && tmp is OSDArray)
foldersrequested = tmp as OSDArray;
if (foldersrequested == null || foldersrequested.Count == 0)
{
m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
m_log.Error("Request: " + request);
httpResponse.RawBuffer = EmptyResponse;
return;
}
ArrayList foldersrequested = (ArrayList)hash["folders"];
hash.Clear();
List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>();
folders = new List<LLSDFetchInventoryDescendents>(foldersrequested.Count);
for (int i = 0; i < foldersrequested.Count; i++)
{
Hashtable inventoryhash = (Hashtable)foldersrequested[i];
OSDMap mfolder = foldersrequested[i] as OSDMap;
UUID id = mfolder["folder_id"].AsUUID();
if(BadRequests.ContainsKey(id))
{
bad_folders.Add(id);
}
else
{
LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();
try
{
LLSDHelpers.DeserialiseOSDMap(inventoryhash, llsdRequest);
llsdRequest.folder_id = id;
llsdRequest.owner_id = mfolder["owner_id"].AsUUID();
llsdRequest.sort_order = mfolder["sort_order"].AsInteger();
llsdRequest.fetch_folders = mfolder["fetch_folders"].AsBoolean();
llsdRequest.fetch_items = mfolder["fetch_items"].AsBoolean();
}
catch (Exception e)
{
m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e);
m_log.Debug("[WEB FETCH INV DESC HANDLER]: caught exception doing OSD deserialize" + e.Message);
continue;
}
folders.Add(llsdRequest);
}
}
foldersrequested = null;
tmp = null;
}
catch (Exception e)
{
m_log.ErrorFormat("[FETCH INV DESC]: fail parsing request: {0}", e.Message);
httpResponse.RawBuffer = EmptyResponse;
return;
}
foldersrequested.Clear();
if(folders.Count == 0)
return "<llsd><map><key>folders</key><array /></map></llsd>";
List<UUID> bad_folders = new List<UUID>();
if (folders == null || folders.Count == 0)
{
if(bad_folders.Count == 0)
{
httpResponse.RawBuffer = EmptyResponse;
return;
}
StringBuilder sb = osStringBuilderCache.Acquire();
sb.Append("<llsd><map><key>folders</key><array /></map><map><key>bad_folders</key><array>");
foreach (UUID bad in bad_folders)
{
sb.Append("<map><key>folder_id</key><uuid>");
sb.Append(bad.ToString());
sb.Append("</uuid><key>error</key><string>Unknown</string></map>");
}
sb.Append("</array></map></llsd>");
httpResponse.RawBuffer = Util.UTF8NBGetbytes(osStringBuilderCache.GetStringAndRelease(sb));
}
int total_folders = 0;
int total_items = 0;
List<InventoryCollection> invcollSet = Fetch(folders, bad_folders, ref total_folders, ref total_items);
//m_log.DebugFormat("[XXX]: Got {0} folders from a request of {1}", invcollSet.Count, folders.Count);
@ -191,6 +226,7 @@ namespace OpenSim.Capabilities.Handlers
lastresponse.Append("<map><key>bad_folders</key><array>");
foreach (UUID bad in bad_folders)
{
BadRequests.Add(bad);
lastresponse.Append("<map><key>folder_id</key><uuid>");
lastresponse.Append(bad.ToString());
lastresponse.Append("</uuid><key>error</key><string>Unknown</string></map>");
@ -199,7 +235,7 @@ namespace OpenSim.Capabilities.Handlers
}
lastresponse.Append("</llsd>");
return lastresponse.ToString();
httpResponse.RawBuffer = Util.UTF8NBGetbytes(lastresponse.ToString());
}
private void AddLibraryFolders(List<LLSDFetchInventoryDescendents> libFolders, List<InventoryCollection> result, ref int total_folders, ref int total_items)
@ -389,7 +425,7 @@ namespace OpenSim.Capabilities.Handlers
if (linked != null)
{
List<InventoryItemBase> linkedItems = new List<InventoryItemBase>();
List<InventoryItemBase> linkedItems = new List<InventoryItemBase>(linked.Length);
// check for broken
foreach (InventoryItemBase linkedItem in linked)
{

View File

@ -29,9 +29,12 @@ using System;
using Nini.Config;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Capabilities.Handlers
{
@ -67,16 +70,16 @@ namespace OpenSim.Capabilities.Handlers
m_LibraryService =
ServerUtils.LoadPlugin<ILibraryService>(libService, args);
FetchInvDescHandler webFetchHandler = new FetchInvDescHandler(m_InventoryService, m_LibraryService, null);
IRequestHandler reqHandler
= new RestStreamHandler(
"POST",
"/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/,
webFetchHandler.FetchInventoryDescendentsRequest,
"FetchInvDescendents",
null);
server.AddStreamHandler(reqHandler);
}
ExpiringKey<UUID> m_badRequests = new ExpiringKey<UUID>(30000);
FetchInvDescHandler webFetchHandler = new FetchInvDescHandler(m_InventoryService, m_LibraryService, null);
ISimpleStreamHandler reqHandler
= new SimpleStreamHandler("/CAPS/WebFetchInvDesc/", delegate(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
webFetchHandler.FetchInventoryDescendentsRequest(httpRequest, httpResponse, m_badRequests);
});
server.AddSimpleStreamHandler(reqHandler);
}
}
}

View File

@ -25,12 +25,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Net;
using System.Reflection;
using System.Text;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
@ -105,7 +105,62 @@ namespace OpenSim.Capabilities.Handlers
}
LLSDxmlEncode.AddEndMap(lsl);
return LLSDxmlEncode.End(lsl);;
return LLSDxmlEncode.End(lsl);
}
public void FetchInventorySimpleRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap requestmap, ExpiringKey<UUID> BadRequests)
{
//m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request);
if(BadRequests == null)
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
return;
}
OSDArray itemsRequested = (OSDArray)requestmap["items"];
UUID[] itemIDs = new UUID[itemsRequested.Count];
int i = 0;
foreach (OSDMap osdItemId in itemsRequested)
{
UUID id = osdItemId["item_id"].AsUUID();
if(!BadRequests.ContainsKey(id))
itemIDs[i++] = id;
}
InventoryItemBase[] items = null;
try
{
// badrequests still not filled
items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs);
}
catch{ }
StringBuilder lsl = LLSDxmlEncode.Start(4096);
LLSDxmlEncode.AddMap(lsl);
LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
if (items == null || items.Length == 0)
{
LLSDxmlEncode.AddEmptyArray("items", lsl);
}
else
{
LLSDxmlEncode.AddArray("items", lsl);
foreach (InventoryItemBase item in items)
{
if (item != null)
item.ToLLSDxml(lsl, 0xff);
}
LLSDxmlEncode.AddEndArray(lsl);
}
LLSDxmlEncode.AddEndMap(lsl);
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDxmlEncode.End(lsl));
httpResponse.StatusCode = (int)HttpStatusCode.OK;
}
}
}

View File

@ -28,7 +28,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using log4net;
using log4net.Config;
@ -127,6 +127,19 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
Console.WriteLine("Number of descendents: " + m_rootDescendents);
}
private string dorequest(FetchInvDescHandler handler, string request)
{
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
using(ExpiringKey<UUID> bad = new ExpiringKey<UUID>(5000)) // bad but this is test
using (MemoryStream ms = new MemoryStream(Utils.StringToBytes(request), false))
{
req.InputStream = ms;
handler.FetchInventoryDescendentsRequest(req, resp, bad);
}
return Util.UTF8.GetString(resp.RawBuffer);
}
[Test]
public void Test_001_SimpleFolder()
{
@ -135,8 +148,6 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
Init();
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
request += m_rootFolderID;
@ -144,7 +155,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
request += m_userID.ToString();
request += "</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
string llsdresponse = dorequest(handler, request);
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");
@ -161,8 +172,6 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
TestHelpers.InMethod();
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
string request = "<llsd><map><key>folders</key><array>";
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
@ -173,7 +182,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000001</uuid><key>sort_order</key><integer>1</integer></map>";
request += "</array></map></llsd>";
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
string llsdresponse = dorequest(handler, request);
Console.WriteLine(llsdresponse);
string descendents = "descendents</key><integer>" + m_rootDescendents + "</integer>";
@ -191,14 +200,12 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
TestHelpers.InMethod();
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
request += "f0000000-0000-0000-0000-00000000000f";
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000001</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
string llsdresponse = dorequest(handler, request);
Console.WriteLine(llsdresponse);
string descendents = "descendents</key><integer>2</integer>";
@ -235,8 +242,6 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
TestHelpers.InMethod();
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
string request = "<llsd><map><key>folders</key><array>";
request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
@ -253,7 +258,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>";
request += "</array></map></llsd>";
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
string llsdresponse = dorequest(handler, request);
Console.WriteLine(llsdresponse);
string root_folder = "<key>folder_id</key><uuid>" + m_rootFolderID + "</uuid>";
@ -276,14 +281,12 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
Init();
FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null, m_scene);
TestOSHttpRequest req = new TestOSHttpRequest();
TestOSHttpResponse resp = new TestOSHttpResponse();
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
request += UUID.Zero;
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
string llsdresponse = dorequest(handler, request);
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response");

View File

@ -28,10 +28,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Net;
using System.Reflection;
using System.IO;
using System.Web;
using log4net;
using Nini.Config;
using OpenMetaverse;
@ -68,7 +66,8 @@ namespace OpenSim.Capabilities.Handlers
{"jpeg_id", AssetType.ImageJPEG},
{"animatn_id", AssetType.Animation},
{"gesture_id", AssetType.Gesture},
{"mesh_id", AssetType.Mesh}
{"mesh_id", AssetType.Mesh},
{"settings_id", AssetType.Settings}
};
private IAssetService m_assetService;
@ -78,82 +77,68 @@ namespace OpenSim.Capabilities.Handlers
m_assetService = assService;
}
public Hashtable Handle(Hashtable request)
public void Handle(OSHttpRequest req, OSHttpResponse response)
{
Hashtable responsedata = new Hashtable();
responsedata["content_type"] = "text/plain";
responsedata["int_bytes"] = 0;
response.ContentType = "text/plain";
if (m_assetService == null)
{
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.ServiceUnavailable;
responsedata["str_response_string"] = "The asset service is unavailable";
responsedata["keepalive"] = false;
return responsedata;
response.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
response.KeepAlive = false;
return;
}
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.BadRequest;
response.StatusCode = (int)HttpStatusCode.BadRequest;
string[] queries = null;
if(request.Contains("querystringkeys"))
queries = (string[])request["querystringkeys"];
if(queries == null || queries.Length == 0)
return responsedata;
string query = queries[0];
if(!queryTypes.ContainsKey(query))
{
m_log.Warn("[GETASSET]: Unknown type: " + query);
return responsedata;
}
AssetType type = queryTypes[query];
var queries = req.QueryAsDictionary;
if(queries.Count == 0)
return;
AssetType type = AssetType.Unknown;
string assetStr = string.Empty;
if (request.ContainsKey(query))
assetStr = request[query].ToString();
foreach (KeyValuePair<string,string> kvp in queries)
{
if (queryTypes.ContainsKey(kvp.Key))
{
type = queryTypes[kvp.Key];
assetStr = kvp.Value;
break;
}
}
if(type == AssetType.Unknown)
{
//m_log.Warn("[GETASSET]: Unknown type: " + query);
m_log.Warn("[GETASSET]: Unknown type");
response.StatusCode = (int)HttpStatusCode.NotFound;
return;
}
if (String.IsNullOrEmpty(assetStr))
return responsedata;
return;
UUID assetID = UUID.Zero;
if(!UUID.TryParse(assetStr, out assetID))
return responsedata;
return;
AssetBase asset = m_assetService.Get(assetID.ToString());
if(asset == null)
{
// m_log.Warn("[GETASSET]: not found: " + query + " " + assetStr);
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
responsedata["str_response_string"] = "Asset not found.";
return responsedata;
response.StatusCode = (int)HttpStatusCode.NotFound;
return;
}
if (asset.Type != (sbyte)type)
{
responsedata["str_response_string"] = "Got wrong asset type";
return responsedata;
}
return;
if(type == AssetType.Mesh || type == AssetType.Texture)
responsedata["throttle"] = true;
int len = asset.Data.Length;
responsedata["content_type"] = asset.Metadata.ContentType;
responsedata["bin_response_data"] = asset.Data;
responsedata["int_bytes"] = asset.Data.Length;
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
string range = String.Empty;
if (((Hashtable)request["headers"])["range"] != null)
range = (string)((Hashtable)request["headers"])["range"];
else if (((Hashtable)request["headers"])["Range"] != null)
range = (string)((Hashtable)request["headers"])["Range"];
else
return responsedata; // full asset
if (String.IsNullOrEmpty(range))
return responsedata; // full asset
string range = null;
if (req.Headers["Range"] != null)
range = req.Headers["Range"];
else if (req.Headers["range"] != null)
range = req.Headers["range"];
// range request
int start, end;
@ -163,8 +148,8 @@ namespace OpenSim.Capabilities.Handlers
// sending back the last byte instead of an error status
if (start >= asset.Data.Length)
{
responsedata["str_response_string"] = "This range doesnt exist.";
return responsedata;
response.StatusCode = (int)HttpStatusCode.RequestedRangeNotSatisfiable;
return;
}
if (end == -1)
@ -173,20 +158,33 @@ namespace OpenSim.Capabilities.Handlers
end = Utils.Clamp(end, 0, asset.Data.Length - 1);
start = Utils.Clamp(start, 0, end);
int len = end - start + 1;
len = end - start + 1;
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
Hashtable headers = new Hashtable();
headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end, asset.Data.Length);
responsedata["headers"] = headers;
responsedata["int_response_code"] = (int)System.Net.HttpStatusCode.PartialContent;
responsedata["bin_start"] = start;
responsedata["int_bytes"] = len;
return responsedata;
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, asset.Data.Length));
response.StatusCode = (int)HttpStatusCode.PartialContent;
response.RawBufferStart = start;
}
else
response.StatusCode = (int)HttpStatusCode.OK;
m_log.Warn("[GETASSETS]: Failed to parse a range, sending full asset: " + assetStr);
return responsedata;
response.ContentType = asset.Metadata.ContentType;
response.RawBuffer = asset.Data;
response.RawBufferLen = len;
if (type == AssetType.Mesh || type == AssetType.Texture)
{
if(len > 8196)
{
//if(type == AssetType.Texture && ((asset.Flags & AssetFlags.AvatarBake)!= 0))
// responsedata["prio"] = 1;
//else
response.Priority = 2;
}
else
response.Priority = 1;
}
else
response.Priority = -1;
}
}
}

View File

@ -1,117 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Reflection;
using System.IO;
using System.Web;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
namespace OpenSim.Capabilities.Handlers
{
public class GetDisplayNamesHandler : BaseStreamHandler
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected IUserManagement m_UserManagement;
public GetDisplayNamesHandler(string path, IUserManagement umService, string name, string description)
: base("GET", path, name, description)
{
m_UserManagement = umService;
}
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[GET_DISPLAY_NAMES]: called {0}", httpRequest.Url.Query);
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
string[] ids = query.GetValues("ids");
if (m_UserManagement == null)
{
m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component");
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
return new byte[0];
}
Dictionary<UUID,string> names = m_UserManagement.GetUsersNames(ids, UUID.Zero);
OSDMap osdReply = new OSDMap();
OSDArray agents = new OSDArray();
osdReply["agents"] = agents;
foreach (KeyValuePair<UUID,string> kvp in names)
{
if (string.IsNullOrEmpty(kvp.Value))
continue;
if(kvp.Key == UUID.Zero)
continue;
string[] parts = kvp.Value.Split(new char[] {' '});
OSDMap osdname = new OSDMap();
if(parts[0] == "Unknown")
{
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1));
osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2));
}
else
{
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));
osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1));
}
osdname["display_name"] = OSD.FromString(kvp.Value);
osdname["legacy_first_name"] = parts[0];
osdname["legacy_last_name"] = parts[1];
osdname["username"] = OSD.FromString(kvp.Value);
osdname["id"] = OSD.FromUUID(kvp.Key);
osdname["is_display_name_default"] = OSD.FromBoolean(true);
agents.Add(osdname);
}
// Full content request
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
//httpResponse.ContentLength = ??;
httpResponse.ContentType = "application/llsd+xml";
string reply = OSDParser.SerializeLLSDXmlString(osdReply);
return System.Text.Encoding.UTF8.GetBytes(reply);
}
}
}

View File

@ -1,69 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using Nini.Config;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;
using OpenMetaverse;
namespace OpenSim.Capabilities.Handlers
{
public class GetDisplayNamesServerConnector : ServiceConnector
{
private IUserManagement m_UserManagement;
private string m_ConfigName = "CapsService";
public GetDisplayNamesServerConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
if (configName != String.Empty)
m_ConfigName = configName;
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
string umService = serverConfig.GetString("AssetService", String.Empty);
if (umService == String.Empty)
throw new Exception("No AssetService in config file");
Object[] args = new Object[] { config };
m_UserManagement =
ServerUtils.LoadPlugin<IUserManagement>(umService, args);
if (m_UserManagement == null)
throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName));
server.AddStreamHandler(
new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null));
}
}
}

View File

@ -68,7 +68,7 @@ namespace OpenSim.Capabilities.Handlers
IRequestHandler reqHandler
= new RestHTTPHandler(
"GET",
"/CAPS/" + UUID.Random(),
"/" + UUID.Random(),
httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
"GetMesh",
null);

View File

@ -32,6 +32,7 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
using System.IO;
using System.Net;
using System.Web;
using log4net;
using Nini.Config;
@ -136,8 +137,8 @@ namespace OpenSim.Capabilities.Handlers
{
string textureUrl = m_RedirectURL + "?texture_id=" + textureID.ToString();
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently;
httpResponse.RedirectLocation = textureUrl;
httpResponse.StatusCode = (int)HttpStatusCode.Moved;
httpResponse.AddHeader("Location:", textureUrl);
return true;
}
@ -238,8 +239,9 @@ namespace OpenSim.Capabilities.Handlers
response.ContentLength = len;
response.ContentType = texture.Metadata.ContentType;
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
response.Body.Write(texture.Data, start, len);
response.RawBuffer = texture.Data;
response.RawBufferStart = start;
response.RawBufferLen = len;
}
}
else
@ -257,7 +259,9 @@ namespace OpenSim.Capabilities.Handlers
response.ContentType = texture.Metadata.ContentType;
else
response.ContentType = "image/" + format;
response.Body.Write(texture.Data, 0, texture.Data.Length);
response.RawBuffer = texture.Data;
response.RawBufferStart = 0;
response.RawBufferLen = texture.Data.Length;
}
// if (response.StatusCode < 200 || response.StatusCode > 299)

View File

@ -66,7 +66,7 @@ namespace OpenSim.Capabilities.Handlers
string rurl = serverConfig.GetString("GetTextureRedirectURL");
;
server.AddStreamHandler(
new GetTextureRobustHandler("/CAPS/GetTexture/", m_AssetService, "GetTexture", null, rurl));
new GetTextureRobustHandler("/CAPS/GetTexture", m_AssetService, "GetTexture", null, rurl));
}
}
}

View File

@ -1,171 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Capabilities.Handlers
{
public class UploadBakedTextureHandler
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Caps m_HostCapsObj;
private IAssetService m_assetService;
public UploadBakedTextureHandler(Caps caps, IAssetService assetService)
{
m_HostCapsObj = caps;
m_assetService = assetService;
}
/// <summary>
/// Handle a request from the client for a Uri to upload a baked texture.
/// </summary>
/// <param name="request"></param>
/// <param name="path"></param>
/// <param name="param"></param>
/// <param name="httpRequest"></param>
/// <param name="httpResponse"></param>
/// <returns>The upload response if the request is successful, null otherwise.</returns>
public string UploadBakedTexture(
string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
try
{
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
BakedTextureUploader uploader =
new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID);
uploader.OnUpLoad += BakedTextureUploaded;
m_HostCapsObj.HttpListener.AddStreamHandler(
new BinaryStreamHandler(
"POST", capsBase + uploaderPath, uploader.uploaderCaps, "UploadBakedTexture", null));
string protocol = "http://";
if (m_HostCapsObj.SSLCaps)
protocol = "https://";
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" +
m_HostCapsObj.Port.ToString() + capsBase + uploaderPath;
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
uploadResponse.uploader = uploaderURL;
uploadResponse.state = "upload";
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
}
catch (Exception e)
{
m_log.ErrorFormat("[UPLOAD BAKED TEXTURE HANDLER]: {0}{1}", e.Message, e.StackTrace);
}
return null;
}
/// <summary>
/// Called when a baked texture has been successfully uploaded by a client.
/// </summary>
/// <param name="assetID"></param>
/// <param name="data"></param>
private void BakedTextureUploaded(UUID assetID, byte[] data)
{
m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString());
AssetBase asset;
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
asset.Data = data;
asset.Temporary = true;
asset.Local = true;
m_assetService.Store(asset);
}
}
class BakedTextureUploader
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event Action<UUID, byte[]> OnUpLoad;
private string uploaderPath = String.Empty;
private UUID newAssetID;
private IHttpServer httpListener;
private UUID AgentId = UUID.Zero;
public BakedTextureUploader(string path, IHttpServer httpServer, UUID uUID)
{
newAssetID = UUID.Random();
uploaderPath = path;
httpListener = httpServer;
AgentId = uUID;
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
}
/// <summary>
/// Handle raw uploaded baked texture data.
/// </summary>
/// <param name="data"></param>
/// <param name="path"></param>
/// <param name="param"></param>
/// <returns></returns>
public string uploaderCaps(byte[] data, string path, string param)
{
Action<UUID, byte[]> handlerUpLoad = OnUpLoad;
// Don't do this asynchronously, otherwise it's possible for the client to send set appearance information
// on another thread which might send out avatar updates before the asset has been put into the asset
// service.
if (handlerUpLoad != null)
handlerUpLoad(newAssetID, data);
string res = String.Empty;
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
uploadComplete.new_asset = newAssetID.ToString();
uploadComplete.new_inventory_item = UUID.Zero;
uploadComplete.state = "complete";
res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
httpListener.RemoveStreamHandler("POST", uploaderPath);
// m_log.DebugFormat("[BAKED TEXTURE UPLOADER]: baked texture upload completed for {0}", newAssetID);
return res;
}
}
}

View File

@ -1,76 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using Nini.Config;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;
using OpenMetaverse;
namespace OpenSim.Capabilities.Handlers
{
public class UploadBakedTextureServerConnector : ServiceConnector
{
private IAssetService m_AssetService;
private string m_ConfigName = "CapsService";
public UploadBakedTextureServerConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
if (configName != String.Empty)
m_ConfigName = configName;
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
string assetService = serverConfig.GetString("AssetService", String.Empty);
if (assetService == String.Empty)
throw new Exception("No AssetService in config file");
Object[] args = new Object[] { config };
m_AssetService =
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
if (m_AssetService == null)
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
// NEED TO FIX THIS
OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, "");
server.AddStreamHandler(new RestStreamHandler(
"POST",
"/CAPS/UploadBakedTexture/",
new UploadBakedTextureHandler(caps, m_AssetService).UploadBakedTexture,
"UploadBakedTexture",
"Upload Baked Texture Capability"));
}
}
}

View File

@ -1,41 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenMetaverse;
namespace OpenSim.Framework.Capabilities
{
[OSDMap]
public class LLSDItemUpdate
{
public UUID item_id;
public LLSDItemUpdate()
{
}
}
}

View File

@ -1,51 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System.Collections;
namespace OpenSim.Framework.Capabilities
{
[OSDMap]
public class LLSDParcelVoiceInfoResponse
{
public int parcel_local_id;
public string region_name;
public Hashtable voice_credentials;
public LLSDParcelVoiceInfoResponse()
{
}
public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds)
{
region_name = region;
parcel_local_id = localID;
voice_credentials = creds;
}
}
}

View File

@ -1,50 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenMetaverse;
namespace OpenSim.Framework.Capabilities
{
[OSDMap]
public class LLSDTaskScriptUpdate
{
/// <summary>
/// The item containing the script to update
/// </summary>
public UUID item_id;
/// <summary>
/// The task containing the script
/// </summary>
public UUID task_id;
/// <summary>
/// Signals whether the script is currently active
/// </summary>
public int is_script_running;
}
}

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OpenSim.Framework.Capabilities
{
[OSDMap]
public class LLSDVoiceAccountResponse
{
public string username;
public string password;
public string voice_sip_uri_hostname;
public string voice_account_server_name;
public LLSDVoiceAccountResponse()
{
}
public LLSDVoiceAccountResponse(string user, string pass)
{
username = user;
password = pass;
}
public LLSDVoiceAccountResponse(string user, string pass, string sipUriHost, string accountServer)
{
username = user;
password = pass;
voice_sip_uri_hostname = sipUriHost;
voice_account_server_name = accountServer;
}
}
}

View File

@ -80,7 +80,7 @@ namespace OpenSim.ConsoleClient
while (m_Server.Running)
{
System.Threading.Thread.Sleep(500);
// MainConsole.Instance.Prompt();
MainConsole.Instance.Prompt();
}
if (pidFile != String.Empty)

View File

@ -71,6 +71,8 @@ namespace OpenSim.Data
{
RegionData Get(UUID regionID, UUID ScopeID);
List<RegionData> Get(string regionName, UUID ScopeID);
RegionData GetSpecific(string regionName, UUID ScopeID);
RegionData Get(int x, int y, UUID ScopeID);
List<RegionData> Get(int xStart, int yStart, int xEnd, int yEnd, UUID ScopeID);

View File

@ -81,17 +81,15 @@ namespace OpenSim.Data.MySQL
}
}
public RegionData Get(int posX, int posY, UUID scopeID)
public RegionData GetSpecific(string regionName, UUID scopeID)
{
/* fixed size regions
string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY";
string command = "select * from `" + m_Realm + "` where regionName = ?regionName";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Parameters.AddWithValue("?posX", posX.ToString());
cmd.Parameters.AddWithValue("?posY", posY.ToString());
cmd.Parameters.AddWithValue("?regionName", regionName);
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
List<RegionData> ret = RunCommand(cmd);
@ -100,8 +98,11 @@ namespace OpenSim.Data.MySQL
return ret[0];
}
*/
// extend database search for maximum region size area
}
public RegionData Get(int posX, int posY, UUID scopeID)
{
string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";

View File

@ -29,16 +29,13 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Threading;
using log4net;
using MySql.Data.MySqlClient;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Data;
namespace OpenSim.Data.MySQL
{
@ -130,10 +127,6 @@ namespace OpenSim.Data.MySQL
// Eligibility check
//
// PrimFlags.Temporary is not used in OpenSim code and cannot
// be guaranteed to always be clear. Don't check it.
// if ((flags & (uint)PrimFlags.Temporary) != 0)
// return;
if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
return;
@ -154,16 +147,15 @@ namespace OpenSim.Data.MySQL
"Name, Text, Description, " +
"SitName, TouchName, ObjectFlags, " +
"OwnerMask, NextOwnerMask, GroupMask, " +
"EveryoneMask, BaseMask, PositionX, " +
"PositionY, PositionZ, GroupPositionX, " +
"GroupPositionY, GroupPositionZ, VelocityX, " +
"VelocityY, VelocityZ, AngularVelocityX, " +
"AngularVelocityY, AngularVelocityZ, " +
"AccelerationX, AccelerationY, " +
"AccelerationZ, RotationX, " +
"RotationY, RotationZ, " +
"RotationW, SitTargetOffsetX, " +
"SitTargetOffsetY, SitTargetOffsetZ, " +
"EveryoneMask, BaseMask, " +
"PositionX, PositionY, PositionZ, " +
"GroupPositionX, GroupPositionY, GroupPositionZ, " +
"VelocityX, VelocityY, VelocityZ, " +
"AngularVelocityX, AngularVelocityY, AngularVelocityZ, " +
"AccelerationX, AccelerationY, AccelerationZ, " +
"standtargetx, standtargety, standtargetz, " +
"RotationX, RotationY, RotationZ, RotationW, " +
"SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, " +
"SitTargetOrientW, SitTargetOrientX, " +
"SitTargetOrientY, SitTargetOrientZ, " +
"RegionUUID, CreatorID, " +
@ -189,20 +181,19 @@ namespace OpenSim.Data.MySQL
"AttachedPosY, AttachedPosZ, " +
"PhysicsShapeType, Density, GravityModifier, " +
"Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " +
"RotationAxisLocks, sopanims" +
"RotationAxisLocks, sopanims, sitactrange, pseudocrc" +
") values (" + "?UUID, " +
"?CreationDate, ?Name, ?Text, " +
"?Description, ?SitName, ?TouchName, " +
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
"?GroupMask, ?EveryoneMask, ?BaseMask, " +
"?PositionX, ?PositionY, ?PositionZ, " +
"?GroupPositionX, ?GroupPositionY, " +
"?GroupPositionZ, ?VelocityX, " +
"?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
"?AngularVelocityY, ?AngularVelocityZ, " +
"?AccelerationX, ?AccelerationY, " +
"?AccelerationZ, ?RotationX, " +
"?RotationY, ?RotationZ, " +
"?GroupPositionX, ?GroupPositionY, ?GroupPositionZ, " +
"?VelocityX, ?VelocityY, ?VelocityZ, "+
"?AngularVelocityX, ?AngularVelocityY, ?AngularVelocityZ, " +
"?AccelerationX, ?AccelerationY, ?AccelerationZ, " +
"?standtargetx, ?standtargety, ?standtargetz, " +
"?RotationX, ?RotationY, ?RotationZ, " +
"?RotationW, ?SitTargetOffsetX, " +
"?SitTargetOffsetY, ?SitTargetOffsetZ, " +
"?SitTargetOrientW, ?SitTargetOrientX, " +
@ -226,7 +217,7 @@ namespace OpenSim.Data.MySQL
"?AttachedPosY, ?AttachedPosZ, " +
"?PhysicsShapeType, ?Density, ?GravityModifier, " +
"?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs," +
"?RotationAxisLocks, ?sopanims)";
"?RotationAxisLocks, ?sopanims, ?sitactrange, ?pseudocrc)";
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
@ -830,7 +821,7 @@ namespace OpenSim.Data.MySQL
"UserLookAtX, UserLookAtY, UserLookAtZ, " +
"AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " +
"SeeAVs, AnyAVSounds, GroupAVSounds) values (" +
"SeeAVs, AnyAVSounds, GroupAVSounds, environment) values (" +
"?UUID, ?RegionUUID, " +
"?LocalLandID, ?Bitmap, ?Name, ?Description, " +
"?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@ -842,7 +833,7 @@ namespace OpenSim.Data.MySQL
"?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
"?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia, " +
"?SeeAVs, ?AnyAVSounds, ?GroupAVSounds)";
"?SeeAVs, ?AnyAVSounds, ?GroupAVSounds, ?environment)";
FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@ -869,107 +860,6 @@ namespace OpenSim.Data.MySQL
}
}
public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
{
RegionLightShareData nWP = new RegionLightShareData();
nWP.OnSave += StoreRegionWindlightSettings;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
string command = "select * from `regionwindlight` where region_id = ?regionID";
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Connection = dbcon;
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
using(IDataReader result = ExecuteReader(cmd))
{
if(!result.Read())
{
//No result, so store our default windlight profile and return it
nWP.regionID = regionUUID;
// StoreRegionWindlightSettings(nWP);
return nWP;
}
else
{
nWP.regionID = DBGuid.FromDB(result["region_id"]);
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
UUID.TryParse(result["normal_map_texture"].ToString(),out nWP.normalMapTexture);
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
nWP.valid = true;
}
}
}
dbcon.Close();
}
return nWP;
}
public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
{
RegionSettings rs = null;
@ -1015,127 +905,6 @@ namespace OpenSim.Data.MySQL
return rs;
}
public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "
+ "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "
+ "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "
+ "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "
+ "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "
+ "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "
+ "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "
+ "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "
+ "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "
+ "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "
+ "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "
+ "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "
+ "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "
+ "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "
+ "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "
+ "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "
+ "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "
+ "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "
+ "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "
+ "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "
+ "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "
+ "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "
+ "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "
+ "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "
+ "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"
;
cmd.Parameters.AddWithValue("region_id", wl.regionID);
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
public virtual void RemoveRegionWindlightSettings(UUID regionID)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
#region RegionEnvironmentSettings
public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
@ -1231,7 +1000,7 @@ namespace OpenSim.Data.MySQL
"covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
"sunvectorz, loaded_creation_datetime, " +
"loaded_creation_id, map_tile_ID, block_search, casino, " +
"TelehubObject, parcel_tile_ID) " +
"TelehubObject, parcel_tile_ID, cacheID) " +
"values (?RegionUUID, ?BlockTerraform, " +
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
"?AllowLandResell, ?AllowLandJoinDivide, " +
@ -1248,7 +1017,7 @@ namespace OpenSim.Data.MySQL
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
"?LoadedCreationDateTime, ?LoadedCreationID, " +
"?TerrainImageID, ?block_search, ?casino, " +
"?TelehubObject, ?ParcelImageID)";
"?TelehubObject, ?ParcelImageID, ?cacheID)";
FillRegionSettingsCommand(cmd, rs);
ExecuteNonQuery(cmd);
@ -1352,49 +1121,57 @@ namespace OpenSim.Data.MySQL
// Vectors
prim.OffsetPosition = new Vector3(
(float)(double)row["PositionX"],
(float)(double)row["PositionY"],
(float)(double)row["PositionZ"]
(float)row["PositionX"],
(float)row["PositionY"],
(float)row["PositionZ"]
);
prim.GroupPosition = new Vector3(
(float)(double)row["GroupPositionX"],
(float)(double)row["GroupPositionY"],
(float)(double)row["GroupPositionZ"]
(float)row["GroupPositionX"],
(float)row["GroupPositionY"],
(float)row["GroupPositionZ"]
);
prim.Velocity = new Vector3(
(float)(double)row["VelocityX"],
(float)(double)row["VelocityY"],
(float)(double)row["VelocityZ"]
(float)row["VelocityX"],
(float)row["VelocityY"],
(float)row["VelocityZ"]
);
prim.AngularVelocity = new Vector3(
(float)(double)row["AngularVelocityX"],
(float)(double)row["AngularVelocityY"],
(float)(double)row["AngularVelocityZ"]
(float)row["AngularVelocityX"],
(float)row["AngularVelocityY"],
(float)row["AngularVelocityZ"]
);
prim.Acceleration = new Vector3(
(float)(double)row["AccelerationX"],
(float)(double)row["AccelerationY"],
(float)(double)row["AccelerationZ"]
(float)row["AccelerationX"],
(float)row["AccelerationY"],
(float)row["AccelerationZ"]
);
// quaternions
prim.RotationOffset = new Quaternion(
(float)(double)row["RotationX"],
(float)(double)row["RotationY"],
(float)(double)row["RotationZ"],
(float)(double)row["RotationW"]
(float)row["RotationX"],
(float)row["RotationY"],
(float)row["RotationZ"],
(float)row["RotationW"]
);
prim.SitTargetPositionLL = new Vector3(
(float)(double)row["SitTargetOffsetX"],
(float)(double)row["SitTargetOffsetY"],
(float)(double)row["SitTargetOffsetZ"]
(float)row["SitTargetOffsetX"],
(float)row["SitTargetOffsetY"],
(float)row["SitTargetOffsetZ"]
);
prim.SitTargetOrientationLL = new Quaternion(
(float)(double)row["SitTargetOrientX"],
(float)(double)row["SitTargetOrientY"],
(float)(double)row["SitTargetOrientZ"],
(float)(double)row["SitTargetOrientW"]
(float)row["SitTargetOrientX"],
(float)row["SitTargetOrientY"],
(float)row["SitTargetOrientZ"],
(float)row["SitTargetOrientW"]
);
prim.StandOffset = new Vector3(
(float)row["standtargetx"],
(float)row["standtargety"],
(float)row["standtargetz"]
);
prim.SitActiveRange = (float)row["sitactrange"];
prim.PayPrice[0] = (int)row["PayPrice"];
prim.PayPrice[1] = (int)row["PayButton1"];
prim.PayPrice[2] = (int)row["PayButton2"];
@ -1402,7 +1179,7 @@ namespace OpenSim.Data.MySQL
prim.PayPrice[4] = (int)row["PayButton4"];
prim.Sound = DBGuid.FromDB(row["LoopedSound"].ToString());
prim.SoundGain = (float)(double)row["LoopedSoundGain"];
prim.SoundGain = (float)row["LoopedSoundGain"];
if (prim.Sound != UUID.Zero)
prim.SoundFlags = 1; // If it's persisted at all, it's looped
else
@ -1414,21 +1191,21 @@ namespace OpenSim.Data.MySQL
prim.ParticleSystem = (byte[])row["ParticleSystem"];
prim.AngularVelocity = new Vector3(
(float)(double)row["OmegaX"],
(float)(double)row["OmegaY"],
(float)(double)row["OmegaZ"]
(float)row["OmegaX"],
(float)row["OmegaY"],
(float)row["OmegaZ"]
);
prim.SetCameraEyeOffset(new Vector3(
(float)(double)row["CameraEyeOffsetX"],
(float)(double)row["CameraEyeOffsetY"],
(float)(double)row["CameraEyeOffsetZ"]
(float)row["CameraEyeOffsetX"],
(float)row["CameraEyeOffsetY"],
(float)row["CameraEyeOffsetZ"]
));
prim.SetCameraAtOffset(new Vector3(
(float)(double)row["CameraAtOffsetX"],
(float)(double)row["CameraAtOffsetY"],
(float)(double)row["CameraAtOffsetZ"]
(float)row["CameraAtOffsetX"],
(float)row["CameraAtOffsetY"],
(float)row["CameraAtOffsetZ"]
));
prim.SetForceMouselook((sbyte)row["ForceMouselook"] != 0);
@ -1457,9 +1234,9 @@ namespace OpenSim.Data.MySQL
if (!(row["AttachedPosX"] is System.DBNull))
{
prim.AttachedPos = new Vector3(
(float)(double)row["AttachedPosX"],
(float)(double)row["AttachedPosY"],
(float)(double)row["AttachedPosZ"]
(float)row["AttachedPosX"],
(float)row["AttachedPosY"],
(float)row["AttachedPosZ"]
);
}
@ -1482,10 +1259,10 @@ namespace OpenSim.Data.MySQL
}
prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString());
prim.Density = (float)(double)row["Density"];
prim.GravityModifier = (float)(double)row["GravityModifier"];
prim.Friction = (float)(double)row["Friction"];
prim.Restitution = (float)(double)row["Restitution"];
prim.Density = (float)row["Density"];
prim.GravityModifier = (float)row["GravityModifier"];
prim.Friction = (float)row["Friction"];
prim.Restitution = (float)row["Restitution"];
prim.RotationAxisLocks = (byte)Convert.ToInt32(row["RotationAxisLocks"].ToString());
SOPVehicle vehicle = null;
@ -1515,6 +1292,12 @@ namespace OpenSim.Data.MySQL
prim.Animations = null;
}
prim.SitActiveRange = (float)row["sitactrange"];
int pseudocrc = (int)row["pseudocrc"];
if(pseudocrc != 0)
prim.PseudoCRC = pseudocrc;
return prim;
}
@ -1619,6 +1402,10 @@ namespace OpenSim.Data.MySQL
newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
newSettings.Casino = Convert.ToBoolean(row["casino"]);
if (!(row["cacheID"] is DBNull))
newSettings.CacheID = DBGuid.FromDB(row["cacheID"]);
return newSettings;
}
@ -1702,6 +1489,34 @@ namespace OpenSim.Data.MySQL
if (!(row["GroupAVSounds"] is System.DBNull))
newData.GroupAVSounds = Convert.ToInt32(row["GroupAVSounds"]) != 0 ? true : false;
if (row["environment"] is DBNull)
{
newData.Environment = null;
newData.EnvironmentVersion = -1;
}
else
{
string env = (string)row["environment"];
if(string.IsNullOrEmpty(env))
{
newData.Environment = null;
newData.EnvironmentVersion = -1;
}
else
{
try
{
ViewerEnvironment VEnv = ViewerEnvironment.FromOSDString(env);
newData.Environment = VEnv;
newData.EnvironmentVersion = VEnv.version;
}
catch
{
newData.Environment = null;
newData.EnvironmentVersion = -1;
}
}
}
return newData;
}
@ -1756,38 +1571,43 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("EveryoneMask", prim.EveryoneMask);
cmd.Parameters.AddWithValue("BaseMask", prim.BaseMask);
// vectors
cmd.Parameters.AddWithValue("PositionX", (double)prim.OffsetPosition.X);
cmd.Parameters.AddWithValue("PositionY", (double)prim.OffsetPosition.Y);
cmd.Parameters.AddWithValue("PositionZ", (double)prim.OffsetPosition.Z);
cmd.Parameters.AddWithValue("GroupPositionX", (double)prim.GroupPosition.X);
cmd.Parameters.AddWithValue("GroupPositionY", (double)prim.GroupPosition.Y);
cmd.Parameters.AddWithValue("GroupPositionZ", (double)prim.GroupPosition.Z);
cmd.Parameters.AddWithValue("VelocityX", (double)prim.Velocity.X);
cmd.Parameters.AddWithValue("VelocityY", (double)prim.Velocity.Y);
cmd.Parameters.AddWithValue("VelocityZ", (double)prim.Velocity.Z);
cmd.Parameters.AddWithValue("AngularVelocityX", (double)prim.AngularVelocity.X);
cmd.Parameters.AddWithValue("AngularVelocityY", (double)prim.AngularVelocity.Y);
cmd.Parameters.AddWithValue("AngularVelocityZ", (double)prim.AngularVelocity.Z);
cmd.Parameters.AddWithValue("AccelerationX", (double)prim.Acceleration.X);
cmd.Parameters.AddWithValue("AccelerationY", (double)prim.Acceleration.Y);
cmd.Parameters.AddWithValue("AccelerationZ", (double)prim.Acceleration.Z);
cmd.Parameters.AddWithValue("PositionX", prim.OffsetPosition.X);
cmd.Parameters.AddWithValue("PositionY", prim.OffsetPosition.Y);
cmd.Parameters.AddWithValue("PositionZ", prim.OffsetPosition.Z);
cmd.Parameters.AddWithValue("GroupPositionX", prim.GroupPosition.X);
cmd.Parameters.AddWithValue("GroupPositionY", prim.GroupPosition.Y);
cmd.Parameters.AddWithValue("GroupPositionZ", prim.GroupPosition.Z);
cmd.Parameters.AddWithValue("VelocityX", prim.Velocity.X);
cmd.Parameters.AddWithValue("VelocityY", prim.Velocity.Y);
cmd.Parameters.AddWithValue("VelocityZ", prim.Velocity.Z);
cmd.Parameters.AddWithValue("AngularVelocityX", prim.AngularVelocity.X);
cmd.Parameters.AddWithValue("AngularVelocityY", prim.AngularVelocity.Y);
cmd.Parameters.AddWithValue("AngularVelocityZ", prim.AngularVelocity.Z);
cmd.Parameters.AddWithValue("AccelerationX", prim.Acceleration.X);
cmd.Parameters.AddWithValue("AccelerationY", prim.Acceleration.Y);
cmd.Parameters.AddWithValue("AccelerationZ", prim.Acceleration.Z);
cmd.Parameters.AddWithValue("standtargetx", prim.StandOffset.X);
cmd.Parameters.AddWithValue("standtargety", prim.StandOffset.Y);
cmd.Parameters.AddWithValue("standtargetz", prim.StandOffset.Z);
// quaternions
cmd.Parameters.AddWithValue("RotationX", (double)prim.RotationOffset.X);
cmd.Parameters.AddWithValue("RotationY", (double)prim.RotationOffset.Y);
cmd.Parameters.AddWithValue("RotationZ", (double)prim.RotationOffset.Z);
cmd.Parameters.AddWithValue("RotationW", (double)prim.RotationOffset.W);
cmd.Parameters.AddWithValue("RotationX", prim.RotationOffset.X);
cmd.Parameters.AddWithValue("RotationY", prim.RotationOffset.Y);
cmd.Parameters.AddWithValue("RotationZ", prim.RotationOffset.Z);
cmd.Parameters.AddWithValue("RotationW", prim.RotationOffset.W);
// Sit target
Vector3 sitTargetPos = prim.SitTargetPositionLL;
cmd.Parameters.AddWithValue("SitTargetOffsetX", (double)sitTargetPos.X);
cmd.Parameters.AddWithValue("SitTargetOffsetY", (double)sitTargetPos.Y);
cmd.Parameters.AddWithValue("SitTargetOffsetZ", (double)sitTargetPos.Z);
cmd.Parameters.AddWithValue("SitTargetOffsetX", sitTargetPos.X);
cmd.Parameters.AddWithValue("SitTargetOffsetY", sitTargetPos.Y);
cmd.Parameters.AddWithValue("SitTargetOffsetZ", sitTargetPos.Z);
Quaternion sitTargetOrient = prim.SitTargetOrientationLL;
cmd.Parameters.AddWithValue("SitTargetOrientW", (double)sitTargetOrient.W);
cmd.Parameters.AddWithValue("SitTargetOrientX", (double)sitTargetOrient.X);
cmd.Parameters.AddWithValue("SitTargetOrientY", (double)sitTargetOrient.Y);
cmd.Parameters.AddWithValue("SitTargetOrientZ", (double)sitTargetOrient.Z);
cmd.Parameters.AddWithValue("SitTargetOrientW", sitTargetOrient.W);
cmd.Parameters.AddWithValue("SitTargetOrientX", sitTargetOrient.X);
cmd.Parameters.AddWithValue("SitTargetOrientY", sitTargetOrient.Y);
cmd.Parameters.AddWithValue("SitTargetOrientZ", sitTargetOrient.Z);
cmd.Parameters.AddWithValue("PayPrice", prim.PayPrice[0]);
cmd.Parameters.AddWithValue("PayButton1", prim.PayPrice[1]);
@ -1798,7 +1618,7 @@ namespace OpenSim.Data.MySQL
if ((prim.SoundFlags & 1) != 0) // Looped
{
cmd.Parameters.AddWithValue("LoopedSound", prim.Sound.ToString());
cmd.Parameters.AddWithValue("LoopedSoundGain", prim.SoundGain);
cmd.Parameters.AddWithValue("LoopedSoundGain", (float)prim.SoundGain);
}
else
{
@ -1809,17 +1629,17 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("TextureAnimation", prim.TextureAnimation);
cmd.Parameters.AddWithValue("ParticleSystem", prim.ParticleSystem);
cmd.Parameters.AddWithValue("OmegaX", (double)prim.AngularVelocity.X);
cmd.Parameters.AddWithValue("OmegaY", (double)prim.AngularVelocity.Y);
cmd.Parameters.AddWithValue("OmegaZ", (double)prim.AngularVelocity.Z);
cmd.Parameters.AddWithValue("OmegaX", prim.AngularVelocity.X);
cmd.Parameters.AddWithValue("OmegaY", prim.AngularVelocity.Y);
cmd.Parameters.AddWithValue("OmegaZ", prim.AngularVelocity.Z);
cmd.Parameters.AddWithValue("CameraEyeOffsetX", (double)prim.GetCameraEyeOffset().X);
cmd.Parameters.AddWithValue("CameraEyeOffsetY", (double)prim.GetCameraEyeOffset().Y);
cmd.Parameters.AddWithValue("CameraEyeOffsetZ", (double)prim.GetCameraEyeOffset().Z);
cmd.Parameters.AddWithValue("CameraEyeOffsetX", prim.GetCameraEyeOffset().X);
cmd.Parameters.AddWithValue("CameraEyeOffsetY", prim.GetCameraEyeOffset().Y);
cmd.Parameters.AddWithValue("CameraEyeOffsetZ", prim.GetCameraEyeOffset().Z);
cmd.Parameters.AddWithValue("CameraAtOffsetX", (double)prim.GetCameraAtOffset().X);
cmd.Parameters.AddWithValue("CameraAtOffsetY", (double)prim.GetCameraAtOffset().Y);
cmd.Parameters.AddWithValue("CameraAtOffsetZ", (double)prim.GetCameraAtOffset().Z);
cmd.Parameters.AddWithValue("CameraAtOffsetX", prim.GetCameraAtOffset().X);
cmd.Parameters.AddWithValue("CameraAtOffsetY", prim.GetCameraAtOffset().Y);
cmd.Parameters.AddWithValue("CameraAtOffsetZ", prim.GetCameraAtOffset().Z);
if (prim.GetForceMouselook())
cmd.Parameters.AddWithValue("ForceMouselook", 1);
@ -1863,9 +1683,9 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
if (prim.AttachedPos != null)
{
cmd.Parameters.AddWithValue("AttachedPosX", (double)prim.AttachedPos.X);
cmd.Parameters.AddWithValue("AttachedPosY", (double)prim.AttachedPos.Y);
cmd.Parameters.AddWithValue("AttachedPosZ", (double)prim.AttachedPos.Z);
cmd.Parameters.AddWithValue("AttachedPosX", prim.AttachedPos.X);
cmd.Parameters.AddWithValue("AttachedPosY", prim.AttachedPos.Y);
cmd.Parameters.AddWithValue("AttachedPosZ", prim.AttachedPos.Z);
}
if (prim.KeyframeMotion != null)
@ -1889,16 +1709,19 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("DynAttrs", null);
cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType);
cmd.Parameters.AddWithValue("Density", (double)prim.Density);
cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier);
cmd.Parameters.AddWithValue("Friction", (double)prim.Friction);
cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution);
cmd.Parameters.AddWithValue("Density", prim.Density);
cmd.Parameters.AddWithValue("GravityModifier", prim.GravityModifier);
cmd.Parameters.AddWithValue("Friction", prim.Friction);
cmd.Parameters.AddWithValue("Restitution", prim.Restitution);
cmd.Parameters.AddWithValue("RotationAxisLocks", prim.RotationAxisLocks);
if (prim.Animations!= null)
cmd.Parameters.AddWithValue("sopanims", prim.SerializeAnimations());
else
cmd.Parameters.AddWithValue("sopanims", null);
cmd.Parameters.AddWithValue("sitactrange", prim.SitActiveRange);
cmd.Parameters.AddWithValue("pseudocrc", prim.PseudoCRC);
}
/// <summary>
@ -1982,6 +1805,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID);
cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject);
cmd.Parameters.AddWithValue("cacheID", settings.CacheID);
}
/// <summary>
@ -2039,7 +1863,19 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("SeeAVs", land.SeeAVs ? 1 : 0);
cmd.Parameters.AddWithValue("AnyAVSounds", land.AnyAVSounds ? 1 : 0);
cmd.Parameters.AddWithValue("GroupAVSounds", land.GroupAVSounds ? 1 : 0);
if (land.Environment == null)
cmd.Parameters.AddWithValue("environment", "");
else
{
try
{
cmd.Parameters.AddWithValue("environment", ViewerEnvironment.ToOSDString(land.Environment));
}
catch
{
cmd.Parameters.AddWithValue("environment", "");
}
}
}
/// <summary>

View File

@ -76,3 +76,8 @@ ALTER TABLE `estateban`
ADD COLUMN `banTime` int(11) NOT NULL DEFAULT 0;
COMMIT;
:VERSION 36
BEGIN;
ALTER TABLE `estate_settings`
ADD COLUMN `AllowEnviromentOverride` tinyint(4) NOT NULL DEFAULT '0';
COMMIT;

View File

@ -16,3 +16,9 @@ CREATE TABLE `hg_traveling_data` (
COMMIT;
:VERSION 2 # --------------------------
ALTER TABLE `hg_traveling_data` MODIFY `TMStamp` timestamp NOT NULL default CURRENT_TIMESTAMP;
COMMIT;

View File

@ -474,3 +474,79 @@ BEGIN;
ALTER TABLE `prims` ADD COLUMN `sopanims` blob default NULL;
COMMIT;
:VERSION 59 #----- Add standtarget and sit range
BEGIN;
ALTER TABLE `prims`
ADD COLUMN `standtargetx` float DEFAULT '0.0',
ADD COLUMN `standtargety` float DEFAULT '0.0',
ADD COLUMN `standtargetz` float DEFAULT '0.0',
ADD COLUMN `sitactrange` float DEFAULT '0.0';
COMMIT;
:VERSION 60 #----- don't store float on double
BEGIN;
ALTER TABLE `prims`
MODIFY `PositionX` float DEFAULT '0.0',
MODIFY `PositionY` float DEFAULT '0.0',
MODIFY `PositionZ` float DEFAULT '0.0',
MODIFY `GroupPositionX` float DEFAULT '0.0',
MODIFY `GroupPositionY` float DEFAULT '0.0',
MODIFY `GroupPositionZ` float DEFAULT '0.0',
MODIFY `VelocityX` float DEFAULT '0.0',
MODIFY `VelocityY` float DEFAULT '0.0',
MODIFY `VelocityZ` float DEFAULT '0.0',
MODIFY `AngularVelocityX` float DEFAULT '0.0',
MODIFY `AngularVelocityY` float DEFAULT '0.0',
MODIFY `AngularVelocityZ` float DEFAULT '0.0',
MODIFY `AccelerationX` float DEFAULT '0.0',
MODIFY `AccelerationY` float DEFAULT '0.0',
MODIFY `AccelerationZ` float DEFAULT '0.0',
MODIFY `RotationX` float DEFAULT '0.0',
MODIFY `RotationY` float DEFAULT '0.0',
MODIFY `RotationZ` float DEFAULT '0.0',
MODIFY `RotationW` float DEFAULT '0.0',
MODIFY `SitTargetOffsetX` float DEFAULT '0.0',
MODIFY `SitTargetOffsetY` float DEFAULT '0.0',
MODIFY `SitTargetOffsetZ` float DEFAULT '0.0',
MODIFY `SitTargetOrientX` float DEFAULT '0.0',
MODIFY `SitTargetOrientY` float DEFAULT '0.0',
MODIFY `SitTargetOrientZ` float DEFAULT '0.0',
MODIFY `SitTargetOrientW` float DEFAULT '0.0',
MODIFY `OmegaX` float DEFAULT '0.0',
MODIFY `OmegaY` float DEFAULT '0.0',
MODIFY `OmegaZ` float DEFAULT '0.0',
MODIFY `CameraEyeOffsetX` float DEFAULT '0.0',
MODIFY `CameraEyeOffsetY` float DEFAULT '0.0',
MODIFY `CameraEyeOffsetZ` float DEFAULT '0.0',
MODIFY `CameraAtOffsetX` float DEFAULT '0.0',
MODIFY `CameraAtOffsetY` float DEFAULT '0.0',
MODIFY `CameraAtOffsetZ` float DEFAULT '0.0',
MODIFY `Density` float DEFAULT '1000.0',
MODIFY `GravityModifier` float DEFAULT '1.0',
MODIFY `Friction` float DEFAULT '0.6',
MODIFY `Restitution` float DEFAULT '0.5',
MODIFY `AttachedPosX` float DEFAULT '0',
MODIFY `AttachedPosY` float DEFAULT '0',
MODIFY `AttachedPosZ` float DEFAULT '0',
MODIFY `LoopedSoundGain` float DEFAULT '0';
COMMIT;
:VERSION 61 #----- Add pseudo CRC and region cache id
BEGIN;
ALTER TABLE `prims` ADD COLUMN `pseudocrc` int DEFAULT '0';
ALTER TABLE `regionsettings` ADD COLUMN `cacheID` char(36) DEFAULT NULL;
COMMIT;
:VERSION 62 #----- increase size of environment settings
BEGIN;
ALTER TABLE `regionenvironment` MODIFY `llsd_settings` MEDIUMTEXT;
COMMIT;
:VERSION 63 #----- parcel environment store
BEGIN;
ALTER TABLE `land` ADD COLUMN `environment` MEDIUMTEXT default NULL;
COMMIT;

View File

@ -118,6 +118,6 @@ COMMIT;
ALTER TABLE `os_groups_invites`
MODIFY `TMStamp` timestamp NOT NULL, default CURRENT_TIMESTAMP;
MODIFY `TMStamp` timestamp NOT NULL default CURRENT_TIMESTAMP;
COMMIT;

View File

@ -68,6 +68,28 @@ namespace OpenSim.Data.Null
private delegate bool Matcher(string value);
public RegionData GetSpecific(string regionName, UUID scopeID)
{
if (m_useStaticInstance && Instance != this)
return Instance.GetSpecific(regionName, scopeID);
string cleanName = regionName.ToLower();
Matcher queryMatch;
queryMatch = delegate (string s) { return s.Equals(cleanName); };
lock (m_regionData)
{
foreach (RegionData r in m_regionData.Values)
{
// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
if (queryMatch(r.RegionName.ToLower()))
return(r);
}
}
return null;
}
public List<RegionData> Get(string regionName, UUID scopeID)
{
if (m_useStaticInstance && Instance != this)

View File

@ -114,6 +114,27 @@ namespace OpenSim.Data.PGSQL
}
}
public RegionData GetSpecific(string regionName, UUID scopeID)
{
string sql = "select * from " + m_Realm + " where lower(\"regionName\") = lower(:regionName) ";
if (scopeID != UUID.Zero)
sql += " and \"ScopeID\" = :scopeID";
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
cmd.Parameters.Add(m_database.CreateParameter("regionName", regionName));
if (scopeID != UUID.Zero)
cmd.Parameters.Add(m_database.CreateParameter("scopeID", scopeID));
conn.Open();
List<RegionData> ret = RunCommand(cmd);
if (ret.Count == 0)
return null;
return ret[0];
}
}
public RegionData Get(int posX, int posY, UUID scopeID)
{
// extend database search for maximum region size area

View File

@ -354,7 +354,9 @@ namespace OpenSim.Data.PGSQL
""PassCollisions"" = :PassCollisions, ""RotationAxisLocks"" = :RotationAxisLocks, ""RezzerID"" = :RezzerID,
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, ""Vehicle"" = :Vehicle,
""PhysInertia"" = :PhysInertia
""PhysInertia"" = :PhysInertia, ""standtargetx"" =:standtargetx, ""standtargety"" =:standtargety, ""standtargetz"" =:standtargetz,
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc
WHERE ""UUID"" = :UUID ;
INSERT INTO
@ -368,7 +370,8 @@ namespace OpenSim.Data.PGSQL
""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""Vehicle"", ""PhysInertia""
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""Vehicle"", ""PhysInertia"",
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc""
) Select
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
@ -379,7 +382,8 @@ namespace OpenSim.Data.PGSQL
:OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :Vehicle, :PhysInertia
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :Vehicle, :PhysInertia,
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
";
@ -766,13 +770,14 @@ namespace OpenSim.Data.PGSQL
(""UUID"",""RegionUUID"",""LocalLandID"",""Bitmap"",""Name"",""Description"",""OwnerUUID"",""IsGroupOwned"",""Area"",""AuctionID"",""Category"",""ClaimDate"",""ClaimPrice"",
""GroupUUID"",""SalePrice"",""LandStatus"",""LandFlags"",""LandingType"",""MediaAutoScale"",""MediaTextureUUID"",""MediaURL"",""MusicURL"",""PassHours"",""PassPrice"",
""SnapshotUUID"",""UserLocationX"",""UserLocationY"",""UserLocationZ"",""UserLookAtX"",""UserLookAtY"",""UserLookAtZ"",""AuthbuyerID"",""OtherCleanTime"",""Dwell"",
""MediaType"",""MediaDescription"",""MediaSize"",""MediaLoop"",""ObscureMusic"",""ObscureMedia"",""SeeAVs"",""AnyAVSounds"",""GroupAVSounds"")
""MediaType"",""MediaDescription"",""MediaSize"",""MediaLoop"",""ObscureMusic"",""ObscureMedia"",""SeeAVs"",""AnyAVSounds"",""GroupAVSounds"",
""environment"")
VALUES
(:UUID,:RegionUUID,:LocalLandID,:Bitmap,:Name,:Description,:OwnerUUID,:IsGroupOwned,:Area,:AuctionID,:Category,:ClaimDate,:ClaimPrice,
:GroupUUID,:SalePrice,:LandStatus,:LandFlags,:LandingType,:MediaAutoScale,:MediaTextureUUID,:MediaURL,:MusicURL,:PassHours,:PassPrice,
:SnapshotUUID,:UserLocationX,:UserLocationY,:UserLocationZ,:UserLookAtX,:UserLookAtY,:UserLookAtZ,:AuthbuyerID,:OtherCleanTime,:Dwell,
:MediaType,:MediaDescription,:MediaWidth::text || ',' || :MediaHeight::text,:MediaLoop,:ObscureMusic,:ObscureMedia,:SeeAVs::int::smallint,
:AnyAVSounds::int::smallint,:GroupAVSounds::int::smallint)";
:AnyAVSounds::int::smallint,:GroupAVSounds::int::smallint,:environment)";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
@ -821,477 +826,6 @@ namespace OpenSim.Data.PGSQL
cmd.ExecuteNonQuery();
}
}
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
{
RegionLightShareData nWP = new RegionLightShareData();
nWP.OnSave += StoreRegionWindlightSettings;
string sql = @"select * from regionwindlight where ""region_id"" = :regionID";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("regionID", regionUUID.ToString() ));
conn.Open();
using (NpgsqlDataReader result = cmd.ExecuteReader())
{
if (!result.Read())
{
//No result, so store our default windlight profile and return it
nWP.regionID = regionUUID;
StoreRegionWindlightSettings(nWP);
return nWP;
}
else
{
nWP.regionID = DBGuid.FromDB(result["region_id"]);
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
nWP.valid = true;
}
}
}
return nWP;
}
public void RemoveRegionWindlightSettings(UUID regionID)
{
string sql = @"delete from regionwindlight where ""region_id"" = :region_id";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
conn.Open();
cmd.Parameters.Add(_Database.CreateParameter("region_id", regionID.ToString()));
cmd.ExecuteNonQuery();
}
}
public void StoreRegionWindlightSettings(RegionLightShareData wl)
{
string sql = @"select region_id from regionwindlight where ""region_id"" = :region_id limit 1;";
bool exists = false;
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
{
conn.Open();
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString() ));
NpgsqlDataReader dr = cmd.ExecuteReader();
exists = dr.Read();
}
}
if (exists)
{
RemoveRegionWindlightSettings(wl.regionID);
}
// sql insert
sql = @"INSERT INTO regionwindlight
(region_id
,water_color_r
,water_color_g
,water_color_b
,water_fog_density_exponent
,underwater_fog_modifier
,reflection_wavelet_scale_1
,reflection_wavelet_scale_2
,reflection_wavelet_scale_3
,fresnel_scale
,fresnel_offset
,refract_scale_above
,refract_scale_below
,blur_multiplier
,big_wave_direction_x
,big_wave_direction_y
,little_wave_direction_x
,little_wave_direction_y
,normal_map_texture
,horizon_r
,horizon_g
,horizon_b
,horizon_i
,haze_horizon
,blue_density_r
,blue_density_g
,blue_density_b
,blue_density_i
,haze_density
,density_multiplier
,distance_multiplier
,max_altitude
,sun_moon_color_r
,sun_moon_color_g
,sun_moon_color_b
,sun_moon_color_i
,sun_moon_position
,ambient_r
,ambient_g
,ambient_b
,ambient_i
,east_angle
,sun_glow_focus
,sun_glow_size
,scene_gamma
,star_brightness
,cloud_color_r
,cloud_color_g
,cloud_color_b
,cloud_color_i
,cloud_x
,cloud_y
,cloud_density
,cloud_coverage
,cloud_scale
,cloud_detail_x
,cloud_detail_y
,cloud_detail_density
,cloud_scroll_x
,cloud_scroll_x_lock
,cloud_scroll_y
,cloud_scroll_y_lock
,draw_classic_clouds)
VALUES
(:region_id
,:water_color_r
,:water_color_g
,:water_color_b
,:water_fog_density_exponent
,:underwater_fog_modifier
,:reflection_wavelet_scale_1
,:reflection_wavelet_scale_2
,:reflection_wavelet_scale_3
,:fresnel_scale
,:fresnel_offset
,:refract_scale_above
,:refract_scale_below
,:blur_multiplier
,:big_wave_direction_x
,:big_wave_direction_y
,:little_wave_direction_x
,:little_wave_direction_y
,:normal_map_texture
,:horizon_r
,:horizon_g
,:horizon_b
,:horizon_i
,:haze_horizon
,:blue_density_r
,:blue_density_g
,:blue_density_b
,:blue_density_i
,:haze_density
,:density_multiplier
,:distance_multiplier
,:max_altitude
,:sun_moon_color_r
,:sun_moon_color_g
,:sun_moon_color_b
,:sun_moon_color_i
,:sun_moon_position
,:ambient_r
,:ambient_g
,:ambient_b
,:ambient_i
,:east_angle
,:sun_glow_focus
,:sun_glow_size
,:scene_gamma
,:star_brightness
,:cloud_color_r
,:cloud_color_g
,:cloud_color_b
,:cloud_color_i
,:cloud_x
,:cloud_y
,:cloud_density
,:cloud_coverage
,:cloud_scale
,:cloud_detail_x
,:cloud_detail_y
,:cloud_detail_density
,:cloud_scroll_x
,:cloud_scroll_x_lock
,:cloud_scroll_y
,:cloud_scroll_y_lock
,:draw_classic_clouds);";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
{
conn.Open();
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString()));
cmd.Parameters.Add(_Database.CreateParameter("water_color_r", wl.waterColor.X));
cmd.Parameters.Add(_Database.CreateParameter("water_color_g", wl.waterColor.Y));
cmd.Parameters.Add(_Database.CreateParameter("water_color_b", wl.waterColor.Z));
cmd.Parameters.Add(_Database.CreateParameter("water_fog_density_exponent", wl.waterFogDensityExponent));
cmd.Parameters.Add(_Database.CreateParameter("underwater_fog_modifier", wl.underwaterFogModifier));
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X));
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y));
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z));
cmd.Parameters.Add(_Database.CreateParameter("fresnel_scale", wl.fresnelScale));
cmd.Parameters.Add(_Database.CreateParameter("fresnel_offset", wl.fresnelOffset));
cmd.Parameters.Add(_Database.CreateParameter("refract_scale_above", wl.refractScaleAbove));
cmd.Parameters.Add(_Database.CreateParameter("refract_scale_below", wl.refractScaleBelow));
cmd.Parameters.Add(_Database.CreateParameter("blur_multiplier", wl.blurMultiplier));
cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_x", wl.bigWaveDirection.X));
cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_y", wl.bigWaveDirection.Y));
cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_x", wl.littleWaveDirection.X));
cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_y", wl.littleWaveDirection.Y));
cmd.Parameters.Add(_Database.CreateParameter("normal_map_texture", wl.normalMapTexture.ToString()));
cmd.Parameters.Add(_Database.CreateParameter("horizon_r", wl.horizon.X));
cmd.Parameters.Add(_Database.CreateParameter("horizon_g", wl.horizon.Y));
cmd.Parameters.Add(_Database.CreateParameter("horizon_b", wl.horizon.Z));
cmd.Parameters.Add(_Database.CreateParameter("horizon_i", wl.horizon.W));
cmd.Parameters.Add(_Database.CreateParameter("haze_horizon", wl.hazeHorizon));
cmd.Parameters.Add(_Database.CreateParameter("blue_density_r", wl.blueDensity.X));
cmd.Parameters.Add(_Database.CreateParameter("blue_density_g", wl.blueDensity.Y));
cmd.Parameters.Add(_Database.CreateParameter("blue_density_b", wl.blueDensity.Z));
cmd.Parameters.Add(_Database.CreateParameter("blue_density_i", wl.blueDensity.W));
cmd.Parameters.Add(_Database.CreateParameter("haze_density", wl.hazeDensity));
cmd.Parameters.Add(_Database.CreateParameter("density_multiplier", wl.densityMultiplier));
cmd.Parameters.Add(_Database.CreateParameter("distance_multiplier", wl.distanceMultiplier));
cmd.Parameters.Add(_Database.CreateParameter("max_altitude", wl.maxAltitude));
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_r", wl.sunMoonColor.X));
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_g", wl.sunMoonColor.Y));
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_b", wl.sunMoonColor.Z));
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_i", wl.sunMoonColor.W));
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_position", wl.sunMoonPosition));
cmd.Parameters.Add(_Database.CreateParameter("ambient_r", wl.ambient.X));
cmd.Parameters.Add(_Database.CreateParameter("ambient_g", wl.ambient.Y));
cmd.Parameters.Add(_Database.CreateParameter("ambient_b", wl.ambient.Z));
cmd.Parameters.Add(_Database.CreateParameter("ambient_i", wl.ambient.W));
cmd.Parameters.Add(_Database.CreateParameter("east_angle", wl.eastAngle));
cmd.Parameters.Add(_Database.CreateParameter("sun_glow_focus", wl.sunGlowFocus));
cmd.Parameters.Add(_Database.CreateParameter("sun_glow_size", wl.sunGlowSize));
cmd.Parameters.Add(_Database.CreateParameter("scene_gamma", wl.sceneGamma));
cmd.Parameters.Add(_Database.CreateParameter("star_brightness", wl.starBrightness));
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_r", wl.cloudColor.X));
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_g", wl.cloudColor.Y));
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_b", wl.cloudColor.Z));
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_i", wl.cloudColor.W));
cmd.Parameters.Add(_Database.CreateParameter("cloud_x", wl.cloudXYDensity.X));
cmd.Parameters.Add(_Database.CreateParameter("cloud_y", wl.cloudXYDensity.Y));
cmd.Parameters.Add(_Database.CreateParameter("cloud_density", wl.cloudXYDensity.Z));
cmd.Parameters.Add(_Database.CreateParameter("cloud_coverage", wl.cloudCoverage));
cmd.Parameters.Add(_Database.CreateParameter("cloud_scale", wl.cloudScale));
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_x", wl.cloudDetailXYDensity.X));
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_y", wl.cloudDetailXYDensity.Y));
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_density", wl.cloudDetailXYDensity.Z));
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x", wl.cloudScrollX));
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x_lock", wl.cloudScrollXLock));
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y", wl.cloudScrollY));
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y_lock", wl.cloudScrollYLock));
cmd.Parameters.Add(_Database.CreateParameter("draw_classic_clouds", wl.drawClassicClouds));
cmd.ExecuteNonQuery();
}
}
#region update
// }
// else
// {
// // sql update
// sql = @"UPDATE [OpenSim].[dbo].[regionwindlight]
// SET [region_id] = @region_id
// ,[water_color_r] = @water_color_r
// ,[water_color_g] = @water_color_g
// ,[water_color_b] = @water_color_b
// ,[water_fog_density_exponent] = @water_fog_density_exponent
// ,[underwater_fog_modifier] = @underwater_fog_modifier
// ,[reflection_wavelet_scale_1] = @reflection_wavelet_scale_1
// ,[reflection_wavelet_scale_2] = @reflection_wavelet_scale_2
// ,[reflection_wavelet_scale_3] = @reflection_wavelet_scale_3
// ,[fresnel_scale] = @fresnel_scale
// ,[fresnel_offset] = @fresnel_offset
// ,[refract_scale_above] = @refract_scale_above
// ,[refract_scale_below] = @refract_scale_below
// ,[blur_multiplier] = @blur_multiplier
// ,[big_wave_direction_x] = @big_wave_direction_x
// ,[big_wave_direction_y] = @big_wave_direction_y
// ,[little_wave_direction_x] = @little_wave_direction_x
// ,[little_wave_direction_y] = @little_wave_direction_y
// ,[normal_map_texture] = @normal_map_texture
// ,[horizon_r] = @horizon_r
// ,[horizon_g] = @horizon_g
// ,[horizon_b] = @horizon_b
// ,[horizon_i] = @horizon_i
// ,[haze_horizon] = @haze_horizon
// ,[blue_density_r] = @blue_density_r
// ,[blue_density_g] = @blue_density_g
// ,[blue_density_b] = @blue_density_b
// ,[blue_density_i] = @blue_density_i
// ,[haze_density] = @haze_density
// ,[density_multiplier] = @density_multiplier
// ,[distance_multiplier] = @distance_multiplier
// ,[max_altitude] = @max_altitude
// ,[sun_moon_color_r] = @sun_moon_color_r
// ,[sun_moon_color_g] = @sun_moon_color_g
// ,[sun_moon_color_b] = @sun_moon_color_b
// ,[sun_moon_color_i] = @sun_moon_color_i
// ,[sun_moon_position] = @sun_moon_position
// ,[ambient_r] = @ambient_r
// ,[ambient_g] = @ambient_g
// ,[ambient_b] = @ambient_b
// ,[ambient_i] = @ambient_i
// ,[east_angle] = @east_angle
// ,[sun_glow_focus] = @sun_glow_focus
// ,[sun_glow_size] = @sun_glow_size
// ,[scene_gamma] = @scene_gamma
// ,[star_brightness] = @star_brightness
// ,[cloud_color_r] = @cloud_color_r
// ,[cloud_color_g] = @cloud_color_g
// ,[cloud_color_b] = @cloud_color_b
// ,[cloud_color_i] = @cloud_color_i
// ,[cloud_x] = @cloud_x
// ,[cloud_y] = @cloud_y
// ,[cloud_density] = @cloud_density
// ,[cloud_coverage] = @cloud_coverage
// ,[cloud_scale] = @cloud_scale
// ,[cloud_detail_x] = @cloud_detail_x
// ,[cloud_detail_y] = @cloud_detail_y
// ,[cloud_detail_density] = @cloud_detail_density
// ,[cloud_scroll_x] = @cloud_scroll_x
// ,[cloud_scroll_x_lock] = @cloud_scroll_x_lock
// ,[cloud_scroll_y] = @cloud_scroll_y
// ,[cloud_scroll_y_lock] = @cloud_scroll_y_lock
// ,[draw_classic_clouds] = @draw_classic_clouds
// WHERE region_id = @region_id";
// using (SqlConnection conn = new SqlConnection(m_connectionString))
// {
// conn.Open();
// using (SqlCommand cmd = new SqlCommand(sql, conn))
// {
// cmd.Parameters.AddWithValue("region_id", wl.regionID);
// cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
// cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
// cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
// cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
// cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
// cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
// cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
// cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
// cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
// cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
// cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
// cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
// cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
// cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
// cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
// cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
// cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
// cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
// cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
// cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
// cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
// cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
// cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
// cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
// cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
// cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
// cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
// cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
// cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
// cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
// cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
// cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
// cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
// cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
// cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
// cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
// cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
// cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
// cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
// cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
// cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
// cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
// cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
// cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
// cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
// cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
// cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
// cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
// cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
// cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
// cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
// cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
// cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
// cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
// cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
// cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
// cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
// cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
// cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
// cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
// cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
// cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
// cmd.ExecuteNonQuery();
// }
// }
// }
#endregion
}
#region Environment Settings
public string LoadRegionEnvironmentSettings(UUID regionUUID)
@ -1432,7 +966,7 @@ namespace OpenSim.Data.PGSQL
,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, ""map_tile_ID"" = :TerrainImageID,
""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID
""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID, ""cacheID"" = :cacheID
WHERE ""regionUUID"" = :regionUUID";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
@ -1547,6 +1081,8 @@ namespace OpenSim.Data.PGSQL
newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]);
newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]);
if (!(row["cacheID"] is DBNull))
newSettings.CacheID = new UUID((Guid)row["cacheID"]);
return newSettings;
}
@ -1602,7 +1138,6 @@ namespace OpenSim.Data.PGSQL
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToSingle(row["Dwell"]);
try
{
newData.UserLocation =
@ -1632,6 +1167,35 @@ namespace OpenSim.Data.PGSQL
newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]);
newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]);
if (row["environment"] is DBNull)
{
newData.Environment = null;
newData.EnvironmentVersion = -1;
}
else
{
string env = (string)row["environment"];
if (string.IsNullOrEmpty(env))
{
newData.Environment = null;
newData.EnvironmentVersion = -1;
}
else
{
try
{
ViewerEnvironment VEnv = ViewerEnvironment.FromOSDString(env);
newData.Environment = VEnv;
newData.EnvironmentVersion = VEnv.version;
}
catch
{
newData.Environment = null;
newData.EnvironmentVersion = -1;
}
}
}
return newData;
}
@ -1728,12 +1292,20 @@ namespace OpenSim.Data.PGSQL
Convert.ToSingle(primRow["SitTargetOffsetY"]),
Convert.ToSingle(primRow["SitTargetOffsetZ"]));
prim.SitTargetOrientationLL = new Quaternion(
Convert.ToSingle(primRow["SitTargetOrientX"]),
Convert.ToSingle(primRow["SitTargetOrientY"]),
Convert.ToSingle(primRow["SitTargetOrientZ"]),
Convert.ToSingle(primRow["SitTargetOrientW"]));
prim.StandOffset = new Vector3(
Convert.ToSingle(primRow["standtargetx"]),
Convert.ToSingle(primRow["standtargety"]),
Convert.ToSingle(primRow["standtargetz"]));
prim.SitActiveRange = Convert.ToSingle(primRow["sitactrange"]);
prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]);
prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]);
prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]);
@ -1822,6 +1394,10 @@ namespace OpenSim.Data.PGSQL
pdata = PhysicsInertiaData.FromXml2(primRow["PhysInertia"].ToString());
prim.PhysicsInertia = pdata;
int pseudocrc = Convert.ToInt32(primRow["pseudocrc"]);
if(pseudocrc != 0)
prim.PseudoCRC = pseudocrc;
return prim;
}
@ -2008,6 +1584,8 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
parameters.Add(_Database.CreateParameter("cacheID", settings.CacheID));
return parameters.ToArray();
}
@ -2069,6 +1647,20 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("AnyAVSounds", land.AnyAVSounds));
parameters.Add(_Database.CreateParameter("GroupAVSounds", land.GroupAVSounds));
if (land.Environment == null)
parameters.Add(_Database.CreateParameter("environment", ""));
else
{
try
{
parameters.Add(_Database.CreateParameter("environment", ViewerEnvironment.ToOSDString(land.Environment)));
}
catch
{
parameters.Add(_Database.CreateParameter("environment", ""));
}
}
return parameters.ToArray();
}
@ -2162,6 +1754,13 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("SitTargetOrientY", sitTargetOrient.Y));
parameters.Add(_Database.CreateParameter("SitTargetOrientZ", sitTargetOrient.Z));
Vector3 standTargetPos = prim.StandOffset;
parameters.Add(_Database.CreateParameter("standtargetx", standTargetPos.X));
parameters.Add(_Database.CreateParameter("standtargety", standTargetPos.Y));
parameters.Add(_Database.CreateParameter("standtargetz", standTargetPos.Z));
parameters.Add(_Database.CreateParameter("sitactrange", prim.SitActiveRange));
parameters.Add(_Database.CreateParameter("PayPrice", prim.PayPrice[0]));
parameters.Add(_Database.CreateParameter("PayButton1", prim.PayPrice[1]));
parameters.Add(_Database.CreateParameter("PayButton2", prim.PayPrice[2]));
@ -2260,6 +1859,8 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution));
parameters.Add(_Database.CreateParameter("RotationAxisLocks", prim.RotationAxisLocks));
parameters.Add(_Database.CreateParameter("pseudocrc", prim.PseudoCRC));
return parameters.ToArray();
}

View File

@ -133,3 +133,9 @@ ALTER TABLE "public"."estateban"
ADD COLUMN "banningUUID" uuid NOT NULL,
ADD COLUMN "banTime" int4 NOT NULL DEFAULT 0;
COMMIT;
:VERSION 15
BEGIN TRANSACTION;
ALTER TABLE "public"."estate_settings"
ADD COLUMN "AllowEnviromentOverride" bool NOT NULL;
COMMIT;

View File

@ -1232,3 +1232,26 @@ BEGIN TRANSACTION;
ALTER TABLE prims ADD "Vehicle" TEXT;
COMMIT;
:VERSION 49 #----- Add standtarget and sit range
BEGIN;
ALTER TABLE `prims`
ADD COLUMN `standtargetx` real DEFAULT '0.0',
ADD COLUMN `standtargety` real DEFAULT '0.0',
ADD COLUMN `standtargetz` real DEFAULT '0.0',
ADD COLUMN `sitactrange` real DEFAULT '0.0';
COMMIT;
:VERSION 50 #----- Add pseudo CRC and region cache id
BEGIN;
ALTER TABLE `prims` ADD COLUMN `pseudocrc` integer DEFAULT '0';
ALTER TABLE `regionsettings` ADD COLUMN `cacheID` uuid DEFAULT NULL;
COMMIT;
:VERSION 51 #----- parcel environment store
BEGIN;
ALTER TABLE `land` ADD COLUMN `environment` varchar default NULL;
COMMIT;

View File

@ -74,4 +74,10 @@ ALTER TABLE `estateban` ADD COLUMN `banningUUID` varchar(36) NOT NULL DEFAULT '0
ALTER TABLE `estateban` ADD COLUMN `banTime` integer NOT NULL DEFAULT 0;
COMMIT;
:VERSION 12
BEGIN;
ALTER TABLE `estate_settings`
ADD COLUMN `AllowEnviromentOverride` tinyint not null default 0;
COMMIT;

View File

@ -377,3 +377,25 @@ COMMIT;
BEGIN;
ALTER TABLE `prims` ADD COLUMN `PhysInertia` TEXT default NULL;
COMMIT;
:VERSION 37 #----- Add standtarget and sit range
BEGIN;
ALTER TABLE `prims` ADD COLUMN `standtargetx` float NOT NULL DEFAULT '0.0';
ALTER TABLE `prims` ADD COLUMN `standtargety` float NOT NULL DEFAULT '0.0';
ALTER TABLE `prims` ADD COLUMN `standtargetz` float NOT NULL DEFAULT '0.0';
ALTER TABLE `prims` ADD COLUMN `sitactrange` float NOT NULL DEFAULT '0.0';
COMMIT;
:VERSION 38 #----- Add pseudo CRC and region cache id
BEGIN;
ALTER TABLE `prims` ADD COLUMN `pseudocrc` integer DEFAULT '0';
ALTER TABLE `regionsettings` ADD COLUMN `cacheID` char(36) DEFAULT NULL;
COMMIT;
:VERSION 39 #----- parcel environment store
BEGIN;
ALTER TABLE `land` ADD COLUMN `environment` TEXT default NULL;
COMMIT;

View File

@ -186,13 +186,10 @@ namespace OpenSim.Data.SQLite
private void DoCreate(EstateSettings es)
{
List<string> names = new List<string>(FieldList);
IDataReader r = null;
names.Remove("EstateID");
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
{
names.Remove("EstateID");
string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
cmd.CommandText = sql;
@ -217,17 +214,12 @@ namespace OpenSim.Data.SQLite
cmd.CommandText = "select LAST_INSERT_ROWID() as id";
cmd.Parameters.Clear();
r = cmd.ExecuteReader();
}
using(IDataReader r = cmd.ExecuteReader())
{
r.Read();
es.EstateID = Convert.ToUInt32(r["id"]);
r.Close();
es.Save();
}
}
}
public void StoreEstateSettings(EstateSettings es)
@ -240,11 +232,10 @@ namespace OpenSim.Data.SQLite
foreach (string f in fields)
terms.Add(f+" = :"+f);
string sql = "update estate_settings set "+String.Join(", ", terms.ToArray())+" where EstateID = :EstateID";
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
{
cmd.CommandText = sql;
cmd.CommandText = "update estate_settings set " + String.Join(", ", terms.ToArray()) + " where EstateID = :EstateID"; ;
cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
foreach (string name in FieldList)
{
@ -472,8 +463,8 @@ namespace OpenSim.Data.SQLite
public bool LinkRegion(UUID regionID, int estateID)
{
SqliteTransaction transaction = m_connection.BeginTransaction();
using(SqliteTransaction transaction = m_connection.BeginTransaction())
{
// Delete any existing estate mapping for this region.
using(SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
{
@ -503,6 +494,7 @@ namespace OpenSim.Data.SQLite
}
}
}
}
public List<UUID> GetRegions(int estateID)
{

View File

@ -429,75 +429,6 @@ namespace OpenSim.Data.SQLite
}
}
/// <summary>
/// Load windlight settings from region storage
/// </summary>
/// <param name="regionUUID">RegionID</param>
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
{
RegionLightShareData wl = null;
lock (ds)
{
DataTable windlightTable = ds.Tables["regionwindlight"];
DataRow windlightRow = windlightTable.Rows.Find(regionUUID.ToString());
if (windlightRow == null)
{
wl = new RegionLightShareData();
wl.regionID = regionUUID;
StoreRegionWindlightSettings(wl);
return wl;
}
wl = buildRegionWindlight(windlightRow);
return wl;
}
}
/// <summary>
/// Remove windlight settings from region storage
/// </summary>
/// <param name="regionID">RegionID</param>
public void RemoveRegionWindlightSettings(UUID regionID)
{
lock (ds)
{
DataTable windlightTable = ds.Tables["regionwindlight"];
DataRow windlightRow = windlightTable.Rows.Find(regionID.ToString());
if (windlightRow != null)
{
windlightRow.Delete();
}
}
Commit();
}
/// <summary>
/// Adds an windlight into region storage
/// </summary>
/// <param name="wl">RegionLightShareData</param>
public void StoreRegionWindlightSettings(RegionLightShareData wl)
{
lock (ds)
{
DataTable windlightTable = ds.Tables["regionwindlight"];
DataRow windlightRow = windlightTable.Rows.Find(wl.regionID.ToString());
if (windlightRow == null)
{
windlightRow = windlightTable.NewRow();
fillRegionWindlightRow(windlightRow, wl);
windlightTable.Rows.Add(windlightRow);
}
else
{
fillRegionWindlightRow(windlightRow, wl);
}
Commit();
}
}
#region Region Environment Settings
public string LoadRegionEnvironmentSettings(UUID regionUUID)
{
@ -626,9 +557,12 @@ namespace OpenSim.Data.SQLite
// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
addPrim(prim, obj.UUID, regionUUID);
}
primDa.Update(ds, "prims");
shapeDa.Update(ds, "primshapes");
itemsDa.Update(ds, "primitems");
ds.AcceptChanges();
}
Commit();
// m_log.Info("[Dump of prims]: " + ds.GetXml());
}
@ -1057,12 +991,9 @@ namespace OpenSim.Data.SQLite
if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString())
rowsToDelete.Add(rowToCheck);
}
for (int iter = 0; iter < rowsToDelete.Count; iter++)
{
for (int iter = 0; iter < rowsToDelete.Count; ++iter)
rowsToDelete[iter].Delete();
landaccesslist.Rows.Remove(rowsToDelete[iter]);
}
rowsToDelete.Clear();
foreach (LandAccessEntry entry in parcel.LandData.ParcelAccessList)
{
DataRow newAccessRow = landaccesslist.NewRow();
@ -1312,6 +1243,21 @@ namespace OpenSim.Data.SQLite
createCol(prims, "KeyframeMotion", typeof(Byte[]));
createCol(prims, "PassTouches", typeof(bool));
createCol(prims, "PassCollisions", typeof(bool));
createCol(prims, "Vehicle", typeof(string));
createCol(prims, "RotationAxisLocks", typeof(byte));
createCol(prims, "PhysInertia", typeof(string));
createCol(prims, "standtargetx", typeof(float));
createCol(prims, "standtargety", typeof(float));
createCol(prims, "standtargetz", typeof(float));
createCol(prims, "sitactrange", typeof(float));
createCol(prims, "pseudocrc", typeof(int));
// Add in contraints
prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
@ -1354,6 +1300,7 @@ namespace OpenSim.Data.SQLite
createCol(shapes, "ProfileCurve", typeof(Int32));
createCol(shapes, "ProfileHollow", typeof(Int32));
createCol(shapes, "State", typeof(Int32));
createCol(shapes, "LastAttachPoint", typeof(Int32));
// text TODO: this isn't right, but I'm not sure the right
// way to specify this as a blob atm
createCol(shapes, "Texture", typeof(Byte[]));
@ -1455,6 +1402,7 @@ namespace OpenSim.Data.SQLite
createCol(land, "SeeAVs", typeof(Boolean));
createCol(land, "AnyAVSounds", typeof(Boolean));
createCol(land, "GroupAVSounds", typeof(Boolean));
createCol(land, "environment", typeof(string));
land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] };
@ -1519,6 +1467,9 @@ namespace OpenSim.Data.SQLite
createCol(regionsettings, "map_tile_ID", typeof(String));
createCol(regionsettings, "TelehubObject", typeof(String));
createCol(regionsettings, "parcel_tile_ID", typeof(String));
createCol(regionsettings, "block_search", typeof(Boolean));
createCol(regionsettings, "casino", typeof(Boolean));
createCol(regionsettings, "cacheID", typeof(string));
regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
return regionsettings;
}
@ -1724,14 +1675,18 @@ namespace OpenSim.Data.SQLite
Convert.ToSingle(row["SitTargetOffsetY"]),
Convert.ToSingle(row["SitTargetOffsetZ"]));
prim.SitTargetOrientationLL = new Quaternion(
Convert.ToSingle(
row["SitTargetOrientX"]),
Convert.ToSingle(
row["SitTargetOrientY"]),
Convert.ToSingle(
row["SitTargetOrientZ"]),
Convert.ToSingle(
row["SitTargetOrientW"]));
Convert.ToSingle(row["SitTargetOrientX"]),
Convert.ToSingle(row["SitTargetOrientY"]),
Convert.ToSingle(row["SitTargetOrientZ"]),
Convert.ToSingle(row["SitTargetOrientW"]));
prim.StandOffset = new Vector3(
Convert.ToSingle(row["standtargetx"]),
Convert.ToSingle(row["standtargety"]),
Convert.ToSingle(row["standtargetz"])
);
prim.SitActiveRange = Convert.ToSingle(row["sitactrange"]);
prim.ClickAction = Convert.ToByte(row["ClickAction"]);
prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]);
@ -1851,6 +1806,10 @@ namespace OpenSim.Data.SQLite
pdata = PhysicsInertiaData.FromXml2(row["PhysInertia"].ToString());
prim.PhysicsInertia = pdata;
int pseudocrc = Convert.ToInt32(row["pseudocrc"]);
if(pseudocrc != 0)
prim.PseudoCRC = pseudocrc;
return prim;
}
@ -1962,6 +1921,36 @@ namespace OpenSim.Data.SQLite
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
if (row["environment"] is DBNull)
{
newData.Environment = null;
newData.EnvironmentVersion = -1;
}
else
{
string env = (string)row["environment"];
if (string.IsNullOrEmpty(env))
{
newData.Environment = null;
newData.EnvironmentVersion = -1;
}
else
{
try
{
ViewerEnvironment VEnv = ViewerEnvironment.FromOSDString(env);
newData.Environment = VEnv;
newData.EnvironmentVersion = VEnv.version;
}
catch
{
newData.Environment = null;
newData.EnvironmentVersion = -1;
}
}
}
return newData;
}
@ -2014,86 +2003,12 @@ namespace OpenSim.Data.SQLite
newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]);
newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
newSettings.Casino = Convert.ToBoolean(row["casino"]);
if (!(row["cacheID"] is System.DBNull))
newSettings.CacheID = new UUID((String)row["cacheID"]);
return newSettings;
}
/// <summary>
/// Build a windlight entry from the persisted data.
/// </summary>
/// <param name="row"></param>
/// <returns>RegionLightShareData</returns>
private RegionLightShareData buildRegionWindlight(DataRow row)
{
RegionLightShareData windlight = new RegionLightShareData();
windlight.regionID = new UUID((string)row["region_id"]);
windlight.waterColor.X = Convert.ToSingle(row["water_color_r"]);
windlight.waterColor.Y = Convert.ToSingle(row["water_color_g"]);
windlight.waterColor.Z = Convert.ToSingle(row["water_color_b"]);
//windlight.waterColor.W = Convert.ToSingle(row["water_color_i"]); //not implemented
windlight.waterFogDensityExponent = Convert.ToSingle(row["water_fog_density_exponent"]);
windlight.underwaterFogModifier = Convert.ToSingle(row["underwater_fog_modifier"]);
windlight.reflectionWaveletScale.X = Convert.ToSingle(row["reflection_wavelet_scale_1"]);
windlight.reflectionWaveletScale.Y = Convert.ToSingle(row["reflection_wavelet_scale_2"]);
windlight.reflectionWaveletScale.Z = Convert.ToSingle(row["reflection_wavelet_scale_3"]);
windlight.fresnelScale = Convert.ToSingle(row["fresnel_scale"]);
windlight.fresnelOffset = Convert.ToSingle(row["fresnel_offset"]);
windlight.refractScaleAbove = Convert.ToSingle(row["refract_scale_above"]);
windlight.refractScaleBelow = Convert.ToSingle(row["refract_scale_below"]);
windlight.blurMultiplier = Convert.ToSingle(row["blur_multiplier"]);
windlight.bigWaveDirection.X = Convert.ToSingle(row["big_wave_direction_x"]);
windlight.bigWaveDirection.Y = Convert.ToSingle(row["big_wave_direction_y"]);
windlight.littleWaveDirection.X = Convert.ToSingle(row["little_wave_direction_x"]);
windlight.littleWaveDirection.Y = Convert.ToSingle(row["little_wave_direction_y"]);
windlight.normalMapTexture = new UUID((string)row["normal_map_texture"]);
windlight.horizon.X = Convert.ToSingle(row["horizon_r"]);
windlight.horizon.Y = Convert.ToSingle(row["horizon_g"]);
windlight.horizon.Z = Convert.ToSingle(row["horizon_b"]);
windlight.horizon.W = Convert.ToSingle(row["horizon_i"]);
windlight.hazeHorizon = Convert.ToSingle(row["haze_horizon"]);
windlight.blueDensity.X = Convert.ToSingle(row["blue_density_r"]);
windlight.blueDensity.Y = Convert.ToSingle(row["blue_density_g"]);
windlight.blueDensity.Z = Convert.ToSingle(row["blue_density_b"]);
windlight.blueDensity.W = Convert.ToSingle(row["blue_density_i"]);
windlight.hazeDensity = Convert.ToSingle(row["haze_density"]);
windlight.densityMultiplier = Convert.ToSingle(row["density_multiplier"]);
windlight.distanceMultiplier = Convert.ToSingle(row["distance_multiplier"]);
windlight.maxAltitude = Convert.ToUInt16(row["max_altitude"]);
windlight.sunMoonColor.X = Convert.ToSingle(row["sun_moon_color_r"]);
windlight.sunMoonColor.Y = Convert.ToSingle(row["sun_moon_color_g"]);
windlight.sunMoonColor.Z = Convert.ToSingle(row["sun_moon_color_b"]);
windlight.sunMoonColor.W = Convert.ToSingle(row["sun_moon_color_i"]);
windlight.sunMoonPosition = Convert.ToSingle(row["sun_moon_position"]);
windlight.ambient.X = Convert.ToSingle(row["ambient_r"]);
windlight.ambient.Y = Convert.ToSingle(row["ambient_g"]);
windlight.ambient.Z = Convert.ToSingle(row["ambient_b"]);
windlight.ambient.W = Convert.ToSingle(row["ambient_i"]);
windlight.eastAngle = Convert.ToSingle(row["east_angle"]);
windlight.sunGlowFocus = Convert.ToSingle(row["sun_glow_focus"]);
windlight.sunGlowSize = Convert.ToSingle(row["sun_glow_size"]);
windlight.sceneGamma = Convert.ToSingle(row["scene_gamma"]);
windlight.starBrightness = Convert.ToSingle(row["star_brightness"]);
windlight.cloudColor.X = Convert.ToSingle(row["cloud_color_r"]);
windlight.cloudColor.Y = Convert.ToSingle(row["cloud_color_g"]);
windlight.cloudColor.Z = Convert.ToSingle(row["cloud_color_b"]);
windlight.cloudColor.W = Convert.ToSingle(row["cloud_color_i"]);
windlight.cloudXYDensity.X = Convert.ToSingle(row["cloud_x"]);
windlight.cloudXYDensity.Y = Convert.ToSingle(row["cloud_y"]);
windlight.cloudXYDensity.Z = Convert.ToSingle(row["cloud_density"]);
windlight.cloudCoverage = Convert.ToSingle(row["cloud_coverage"]);
windlight.cloudScale = Convert.ToSingle(row["cloud_scale"]);
windlight.cloudDetailXYDensity.X = Convert.ToSingle(row["cloud_detail_x"]);
windlight.cloudDetailXYDensity.Y = Convert.ToSingle(row["cloud_detail_y"]);
windlight.cloudDetailXYDensity.Z = Convert.ToSingle(row["cloud_detail_density"]);
windlight.cloudScrollX = Convert.ToSingle(row["cloud_scroll_x"]);
windlight.cloudScrollXLock = Convert.ToBoolean(row["cloud_scroll_x_lock"]);
windlight.cloudScrollY = Convert.ToSingle(row["cloud_scroll_y"]);
windlight.cloudScrollYLock = Convert.ToBoolean(row["cloud_scroll_y_lock"]);
windlight.drawClassicClouds = Convert.ToBoolean(row["draw_classic_clouds"]);
return windlight;
}
/// <summary>
/// Build a land access entry from the persisted data.
/// </summary>
@ -2174,6 +2089,14 @@ namespace OpenSim.Data.SQLite
row["SitTargetOrientX"] = sitTargetOrient.X;
row["SitTargetOrientY"] = sitTargetOrient.Y;
row["SitTargetOrientZ"] = sitTargetOrient.Z;
Vector3 standTarget = prim.StandOffset;
row["standtargetx"] = standTarget.X;
row["standtargety"] = standTarget.Y;
row["standtargetz"] = standTarget.Z;
row["sitactrange"] = prim.SitActiveRange;
row["ColorR"] = Convert.ToInt32(prim.Color.R);
row["ColorG"] = Convert.ToInt32(prim.Color.G);
row["ColorB"] = Convert.ToInt32(prim.Color.B);
@ -2199,7 +2122,6 @@ namespace OpenSim.Data.SQLite
row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y;
row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z;
if ((prim.SoundFlags & 1) != 0) // Looped
{
row["LoopedSound"] = prim.Sound.ToString();
@ -2279,6 +2201,7 @@ namespace OpenSim.Data.SQLite
else
row["PhysInertia"] = String.Empty;
row["pseudocrc"] = prim.PseudoCRC;
}
/// <summary>
@ -2366,6 +2289,20 @@ namespace OpenSim.Data.SQLite
row["AnyAVSounds"] = land.AnyAVSounds;
row["GroupAVSounds"] = land.GroupAVSounds;
if (land.Environment == null)
row["environment"] = "";
else
{
try
{
row["environment"] = ViewerEnvironment.ToOSDString(land.Environment);
}
catch
{
row["environment"] = "";
}
}
}
/// <summary>
@ -2426,79 +2363,7 @@ namespace OpenSim.Data.SQLite
row["parcel_tile_ID"] = settings.ParcelImageID.ToString();
row["block_search"] = settings.GodBlockSearch;
row["casino"] = settings.Casino;
}
/// <summary>
///
/// </summary>
/// <param name="row"></param>
/// <param name="windlight"></param>
private static void fillRegionWindlightRow(DataRow row, RegionLightShareData windlight)
{
row["region_id"] = windlight.regionID.ToString();
row["water_color_r"] = windlight.waterColor.X;
row["water_color_g"] = windlight.waterColor.Y;
row["water_color_b"] = windlight.waterColor.Z;
row["water_color_i"] = 1; //windlight.waterColor.W; //not implemented
row["water_fog_density_exponent"] = windlight.waterFogDensityExponent;
row["underwater_fog_modifier"] = windlight.underwaterFogModifier;
row["reflection_wavelet_scale_1"] = windlight.reflectionWaveletScale.X;
row["reflection_wavelet_scale_2"] = windlight.reflectionWaveletScale.Y;
row["reflection_wavelet_scale_3"] = windlight.reflectionWaveletScale.Z;
row["fresnel_scale"] = windlight.fresnelScale;
row["fresnel_offset"] = windlight.fresnelOffset;
row["refract_scale_above"] = windlight.refractScaleAbove;
row["refract_scale_below"] = windlight.refractScaleBelow;
row["blur_multiplier"] = windlight.blurMultiplier;
row["big_wave_direction_x"] = windlight.bigWaveDirection.X;
row["big_wave_direction_y"] = windlight.bigWaveDirection.Y;
row["little_wave_direction_x"] = windlight.littleWaveDirection.X;
row["little_wave_direction_y"] = windlight.littleWaveDirection.Y;
row["normal_map_texture"] = windlight.normalMapTexture.ToString();
row["horizon_r"] = windlight.horizon.X;
row["horizon_g"] = windlight.horizon.Y;
row["horizon_b"] = windlight.horizon.Z;
row["horizon_i"] = windlight.horizon.W;
row["haze_horizon"] = windlight.hazeHorizon;
row["blue_density_r"] = windlight.blueDensity.X;
row["blue_density_g"] = windlight.blueDensity.Y;
row["blue_density_b"] = windlight.blueDensity.Z;
row["blue_density_i"] = windlight.blueDensity.W;
row["haze_density"] = windlight.hazeDensity;
row["density_multiplier"] = windlight.densityMultiplier;
row["distance_multiplier"] = windlight.distanceMultiplier;
row["max_altitude"] = windlight.maxAltitude;
row["sun_moon_color_r"] = windlight.sunMoonColor.X;
row["sun_moon_color_g"] = windlight.sunMoonColor.Y;
row["sun_moon_color_b"] = windlight.sunMoonColor.Z;
row["sun_moon_color_i"] = windlight.sunMoonColor.W;
row["sun_moon_position"] = windlight.sunMoonPosition;
row["ambient_r"] = windlight.ambient.X;
row["ambient_g"] = windlight.ambient.Y;
row["ambient_b"] = windlight.ambient.Z;
row["ambient_i"] = windlight.ambient.W;
row["east_angle"] = windlight.eastAngle;
row["sun_glow_focus"] = windlight.sunGlowFocus;
row["sun_glow_size"] = windlight.sunGlowSize;
row["scene_gamma"] = windlight.sceneGamma;
row["star_brightness"] = windlight.starBrightness;
row["cloud_color_r"] = windlight.cloudColor.X;
row["cloud_color_g"] = windlight.cloudColor.Y;
row["cloud_color_b"] = windlight.cloudColor.Z;
row["cloud_color_i"] = windlight.cloudColor.W;
row["cloud_x"] = windlight.cloudXYDensity.X;
row["cloud_y"] = windlight.cloudXYDensity.Y;
row["cloud_density"] = windlight.cloudXYDensity.Z;
row["cloud_coverage"] = windlight.cloudCoverage;
row["cloud_scale"] = windlight.cloudScale;
row["cloud_detail_x"] = windlight.cloudDetailXYDensity.X;
row["cloud_detail_y"] = windlight.cloudDetailXYDensity.Y;
row["cloud_detail_density"] = windlight.cloudDetailXYDensity.Z;
row["cloud_scroll_x"] = windlight.cloudScrollX;
row["cloud_scroll_x_lock"] = windlight.cloudScrollXLock;
row["cloud_scroll_y"] = windlight.cloudScrollY;
row["cloud_scroll_y_lock"] = windlight.cloudScrollYLock;
row["draw_classic_clouds"] = windlight.drawClassicClouds;
row["cacheID"] = settings.CacheID;
}
/// <summary>

View File

@ -495,10 +495,6 @@ namespace OpenSim.Data.Tests
Assert.AreEqual(pricePerMeter, estateSettings.PricePerMeter);
Assert.AreEqual(redirectGridX, estateSettings.RedirectGridX);
Assert.AreEqual(redirectGridY, estateSettings.RedirectGridY);
Assert.AreEqual(useGlobalTime, estateSettings.UseGlobalTime);
Assert.AreEqual(fixedSun, estateSettings.FixedSun);
DataTestUtil.AssertDoubleEqualsWithTolerance(sunPosition, estateSettings.SunPosition);
Assert.AreEqual(allowVoice, estateSettings.AllowVoice);
Assert.AreEqual(allowDirectTeleport, estateSettings.AllowDirectTeleport);

View File

@ -269,12 +269,12 @@ namespace OpenSim.Data.Tests
random.NextBytes(partsys);
DateTime expires = new DateTime(2008, 12, 20);
DateTime rezzed = new DateTime(2009, 07, 15);
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 groupos = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 offset = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Quaternion rotoff = new Quaternion(random.Next(1),random.Next(1),random.Next(1),random.Next(1));
Vector3 velocity = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 angvelo = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 accel = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
string description = name;
Color color = Color.FromArgb(255, 165, 50, 100);
string text = "All Your Base Are Belong to Us";
@ -289,7 +289,7 @@ namespace OpenSim.Data.Tests
pbshap.ProfileBegin = ushort.MaxValue;
pbshap.ProfileEnd = ushort.MaxValue;
pbshap.ProfileHollow = ushort.MaxValue;
Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 scale = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
RegionInfo regionInfo = new RegionInfo();
regionInfo.RegionID = region3;
@ -443,12 +443,12 @@ namespace OpenSim.Data.Tests
random.NextBytes(partsys);
DateTime expires = new DateTime(2010, 12, 20);
DateTime rezzed = new DateTime(2005, 07, 15);
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 groupos = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 offset = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Quaternion rotoff = new Quaternion(random.Next(100000),random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 velocity = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 angvelo = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 accel = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
string description = name;
Color color = Color.FromArgb(255, 255, 255, 0);
string text = "What You Say?{]\vz~";
@ -536,12 +536,12 @@ namespace OpenSim.Data.Tests
{
UUID tmp = UUID.Random();
SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp);
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
Vector3 groupos = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 offset = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Quaternion rotoff = new Quaternion(random.Next(100000),random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 velocity = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 angvelo = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
Vector3 accel = new Vector3(random.Next(100000),random.Next(100000),random.Next(100000));
sop.GroupPosition = groupos;
sop.RotationOffset = rotoff;
@ -869,7 +869,6 @@ namespace OpenSim.Data.Tests
double terrainlower = random.Next();
Vector3 sunvector = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5));
UUID terimgid = UUID.Random();
double sunpos = random.Next();
UUID cov = UUID.Random();
RegionSettings r1 = db.LoadRegionSettings(region1);
@ -903,10 +902,8 @@ namespace OpenSim.Data.Tests
r1.TerrainLowerLimit = terrainlower;
r1.UseEstateSun = false;
r1.Sandbox = true;
r1.SunVector = sunvector;
r1.TerrainImageID = terimgid;
r1.FixedSun = true;
r1.SunPosition = sunpos;
r1.Covenant = cov;
db.StoreRegionSettings(r1);
@ -941,12 +938,8 @@ namespace OpenSim.Data.Tests
Assert.That(r1a.WaterHeight,Is.EqualTo(waterh), "Assert.That(r1a.WaterHeight,Is.EqualTo(waterh))");
Assert.That(r1a.TerrainRaiseLimit,Is.EqualTo(terrainraise), "Assert.That(r1a.TerrainRaiseLimit,Is.EqualTo(terrainraise))");
Assert.That(r1a.TerrainLowerLimit,Is.EqualTo(terrainlower), "Assert.That(r1a.TerrainLowerLimit,Is.EqualTo(terrainlower))");
Assert.That(r1a.UseEstateSun,Is.False);
Assert.That(r1a.Sandbox,Is.True);
Assert.That(r1a.SunVector,Is.EqualTo(sunvector), "Assert.That(r1a.SunVector,Is.EqualTo(sunvector))");
//Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))");
Assert.That(r1a.FixedSun,Is.True);
Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))");
Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))");
}
@ -970,7 +963,7 @@ namespace OpenSim.Data.Tests
db.StoreTerrain(t1, region1);
// store terrain is async
Thread.Sleep(1000);
Thread.Sleep(500);
Assert.That(db.LoadTerrain(zero), Is.Null);
Assert.That(db.LoadTerrain(region1), Is.Not.Null);
@ -1000,7 +993,7 @@ namespace OpenSim.Data.Tests
db.StoreTerrain(baseterrain2, region1);
// store terrain is async
Thread.Sleep(1000);
Thread.Sleep(500);
double[,] t1 = db.LoadTerrain(region1);
Assert.That(CompareTerrain(t1, baseterrain1), Is.False);

View File

@ -26,6 +26,7 @@
*/
using System.Collections.Generic;
using System.Collections.Concurrent;
using OpenMetaverse;
namespace OpenSim.Framework
@ -41,26 +42,18 @@ namespace OpenSim.Framework
/// <remarks>
/// We lock this for operations both on this dictionary and on m_agentCircuitsByUUID
/// </remarks>
private Dictionary<uint, AgentCircuitData> m_agentCircuits = new Dictionary<uint, AgentCircuitData>();
private ConcurrentDictionary<uint, AgentCircuitData> m_agentCircuits = new ConcurrentDictionary<uint, AgentCircuitData>();
/// <summary>
/// Agent circuits indexed by agent UUID.
/// </summary>
private Dictionary<UUID, AgentCircuitData> m_agentCircuitsByUUID = new Dictionary<UUID, AgentCircuitData>();
private ConcurrentDictionary<UUID, AgentCircuitData> m_agentCircuitsByUUID = new ConcurrentDictionary<UUID, AgentCircuitData>();
public virtual AuthenticateResponse AuthenticateSession(UUID sessionID, UUID agentID, uint circuitcode)
{
AgentCircuitData validcircuit = null;
lock (m_agentCircuits)
{
if (m_agentCircuits.ContainsKey(circuitcode))
validcircuit = m_agentCircuits[circuitcode];
}
AuthenticateResponse user = new AuthenticateResponse();
if (validcircuit == null)
if (!m_agentCircuits.TryGetValue(circuitcode, out AgentCircuitData validcircuit) || validcircuit == null)
{
//don't have this circuit code in our list
user.Authorised = false;
@ -86,7 +79,6 @@ namespace OpenSim.Framework
// Invalid
user.Authorised = false;
}
return user;
}
@ -97,65 +89,39 @@ namespace OpenSim.Framework
/// <param name="agentData"></param>
public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
{
lock (m_agentCircuits)
{
if (m_agentCircuits.ContainsKey(circuitCode))
{
RemoveCircuit(agentData.AgentID); // no duplications
m_agentCircuits[circuitCode] = agentData;
m_agentCircuitsByUUID[agentData.AgentID] = agentData;
}
else
{
m_agentCircuits.Add(circuitCode, agentData);
m_agentCircuitsByUUID[agentData.AgentID] = agentData;
}
}
}
public virtual void RemoveCircuit(uint circuitCode)
{
lock (m_agentCircuits)
if (m_agentCircuits.TryRemove(circuitCode, out AgentCircuitData ac))
{
if (m_agentCircuits.ContainsKey(circuitCode))
{
UUID agentID = m_agentCircuits[circuitCode].AgentID;
m_agentCircuits.Remove(circuitCode);
m_agentCircuitsByUUID.Remove(agentID);
}
m_agentCircuitsByUUID.TryRemove(ac.AgentID, out AgentCircuitData dummy);
}
}
public virtual void RemoveCircuit(UUID agentID)
{
lock (m_agentCircuits)
if (m_agentCircuitsByUUID.TryRemove(agentID, out AgentCircuitData ac))
{
if (m_agentCircuitsByUUID.ContainsKey(agentID))
{
uint circuitCode = m_agentCircuitsByUUID[agentID].circuitcode;
m_agentCircuits.Remove(circuitCode);
m_agentCircuitsByUUID.Remove(agentID);
}
m_agentCircuits.TryRemove(ac.circuitcode, out AgentCircuitData dummy);
}
}
public AgentCircuitData GetAgentCircuitData(uint circuitCode)
{
AgentCircuitData agentCircuit = null;
lock (m_agentCircuits)
m_agentCircuits.TryGetValue(circuitCode, out agentCircuit);
if(m_agentCircuits.TryGetValue(circuitCode, out AgentCircuitData agentCircuit))
return agentCircuit;
return null;
}
public AgentCircuitData GetAgentCircuitData(UUID agentID)
{
AgentCircuitData agentCircuit = null;
lock (m_agentCircuits)
m_agentCircuitsByUUID.TryGetValue(agentID, out agentCircuit);
if(m_agentCircuitsByUUID.TryGetValue(agentID, out AgentCircuitData agentCircuit))
return agentCircuit;
return null;
}
/// <summary>
@ -170,21 +136,16 @@ namespace OpenSim.Framework
public void UpdateAgentData(AgentCircuitData agentData)
{
lock (m_agentCircuits)
if (m_agentCircuits.TryGetValue(agentData.circuitcode, out AgentCircuitData ac))
{
if (m_agentCircuits.ContainsKey((uint) agentData.circuitcode))
{
m_agentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname;
m_agentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname;
m_agentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos;
m_agentCircuits[(uint)agentData.circuitcode].startfar = agentData.startfar;
ac.firstname = agentData.firstname;
ac.lastname = agentData.lastname;
ac.startpos = agentData.startpos;
ac.startfar = agentData.startfar;
// Updated for when we don't know them before calling Scene.NewUserConnection
m_agentCircuits[(uint) agentData.circuitcode].SecureSessionID = agentData.SecureSessionID;
m_agentCircuits[(uint) agentData.circuitcode].SessionID = agentData.SessionID;
// m_log.Debug("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z);
}
ac.SecureSessionID = agentData.SecureSessionID;
ac.SessionID = agentData.SessionID;
}
}
@ -193,38 +154,30 @@ namespace OpenSim.Framework
/// </summary>
/// <param name="circuitcode"></param>
/// <param name="newcircuitcode"></param>
public bool TryChangeCiruitCode(uint circuitcode, uint newcircuitcode)
public bool TryChangeCircuitCode(uint circuitcode, uint newcircuitcode)
{
lock (m_agentCircuits)
if(m_agentCircuits.ContainsKey(newcircuitcode))
return false;
if (m_agentCircuits.TryRemove(circuitcode, out AgentCircuitData agentData))
{
if (m_agentCircuits.ContainsKey((uint)circuitcode) && !m_agentCircuits.ContainsKey((uint)newcircuitcode))
{
AgentCircuitData agentData = m_agentCircuits[(uint)circuitcode];
agentData.circuitcode = newcircuitcode;
m_agentCircuits.Remove((uint)circuitcode);
m_agentCircuits.Add(newcircuitcode, agentData);
m_agentCircuits.TryAdd(newcircuitcode, agentData);
m_agentCircuitsByUUID[agentData.AgentID] = agentData;
return true;
}
}
return false;
}
public void UpdateAgentChildStatus(uint circuitcode, bool childstatus)
{
lock (m_agentCircuits)
if (m_agentCircuits.ContainsKey(circuitcode))
m_agentCircuits[circuitcode].child = childstatus;
if (m_agentCircuits.TryGetValue(circuitcode, out AgentCircuitData ac))
ac.child = childstatus;
}
public bool GetAgentChildStatus(uint circuitcode)
{
lock (m_agentCircuits)
if (m_agentCircuits.ContainsKey(circuitcode))
return m_agentCircuits[circuitcode].child;
if (m_agentCircuits.TryGetValue(circuitcode, out AgentCircuitData ac))
return ac.child;
return false;
}
}

View File

@ -112,12 +112,13 @@ namespace OpenSim.Framework
/// <param name="args"></param>
public void UnpackUpdateMessage(OSDMap args)
{
if (args["animation"] != null)
animID = args["animation"].AsUUID();
if (args["object_id"] != null)
objectID = args["object_id"].AsUUID();
if (args["seq_num"] != null)
sequenceNum = args["seq_num"].AsInteger();
OSD tmp;
if (args.TryGetValue("animation", out tmp))
animID = tmp.AsUUID();
if (args.TryGetValue("object_id", out tmp))
objectID = tmp.AsUUID();
if (args.TryGetValue("seq_num", out tmp))
sequenceNum = tmp.AsInteger();
}
public override bool Equals(object obj)

View File

@ -34,12 +34,13 @@ using OpenMetaverse;
namespace OpenSim.Framework
{
[Flags]
// this enum is stuck, can not be changed or will break compatibilty with any version older than that change
public enum AssetFlags : int
{
Normal = 0, // Immutable asset
Maptile = 1, // What it says
Rewritable = 2, // Content can be rewritten
Collectable = 4 // Can be GC'ed after some time
Collectable = 4, // Can be GC'ed after some time
}
/// <summary>

View File

@ -55,7 +55,7 @@ namespace OpenSim.Framework
// regions and viewer compatibility
public readonly static int TEXTURE_COUNT = 45;
public const int TEXTURE_COUNT_PV7 = 26;
public const int TEXTURE_COUNT_PV7 = 29;
public const int BAKES_COUNT_PV7 = 6;
public const int MAXWEARABLE_PV7 = 16;
public const int MAXWEARABLE_LEGACY = 15;
@ -817,7 +817,7 @@ namespace OpenSim.Framework
return data;
}
public OSDMap PackForNotecard()
public OSDMap PackForNotecard(bool NoHuds = true)
{
OSDMap data = new OSDMap();
@ -868,7 +868,13 @@ namespace OpenSim.Framework
// Attachments
OSDArray attachs = new OSDArray(m_attachments.Count);
foreach (AvatarAttachment attach in GetAttachments())
{
if (NoHuds &&
attach.AttachPoint >= (uint)AttachmentPoint.HUDCenter2 &&
attach.AttachPoint <= (uint)AttachmentPoint.HUDBottomRight)
continue;
attachs.Add(attach.Pack());
}
data["attachments"] = attachs;
}

View File

@ -571,145 +571,141 @@ namespace OpenSim.Framework
public virtual void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx)
{
//m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
OSD tmp;
if (args.TryGetValue("region_id", out tmp) && tmp != null)
UUID.TryParse(tmp.AsString(), out RegionID);
if (args.ContainsKey("region_id"))
UUID.TryParse(args["region_id"].AsString(), out RegionID);
if (args.TryGetValue("circuit_code", out tmp) && tmp != null)
UInt32.TryParse(tmp.AsString(), out CircuitCode);
if (args["circuit_code"] != null)
UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
if (args.TryGetValue("agent_uuid", out tmp) && tmp != null)
AgentID = tmp.AsUUID();
if (args["agent_uuid"] != null)
AgentID = args["agent_uuid"].AsUUID();
if (args.TryGetValue("session_uuid", out tmp) && tmp != null)
SessionID = tmp.AsUUID();
if (args["session_uuid"] != null)
SessionID = args["session_uuid"].AsUUID();
if (args.TryGetValue("position", out tmp) && tmp != null)
Vector3.TryParse(tmp.AsString(), out Position);
if (args["position"] != null)
Vector3.TryParse(args["position"].AsString(), out Position);
if (args.TryGetValue("velocity", out tmp) && tmp != null)
Vector3.TryParse(tmp.AsString(), out Velocity);
if (args["velocity"] != null)
Vector3.TryParse(args["velocity"].AsString(), out Velocity);
if (args.TryGetValue("center", out tmp) && tmp != null)
Vector3.TryParse(tmp.AsString(), out Center);
if (args["center"] != null)
Vector3.TryParse(args["center"].AsString(), out Center);
if (args.TryGetValue("size", out tmp) && tmp != null)
Vector3.TryParse(tmp.AsString(), out Size);
if (args["size"] != null)
Vector3.TryParse(args["size"].AsString(), out Size);
if (args.TryGetValue("at_axis", out tmp) && tmp != null)
Vector3.TryParse(tmp.AsString(), out AtAxis);
if (args["at_axis"] != null)
Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
if (args.TryGetValue("left_axis", out tmp) && tmp != null)
Vector3.TryParse(tmp.AsString(), out AtAxis);
if (args["left_axis"] != null)
Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
if (args.TryGetValue("up_axis", out tmp) && tmp != null)
Vector3.TryParse(tmp.AsString(), out AtAxis);
if (args["up_axis"] != null)
Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
if (args.TryGetValue("wait_for_root", out tmp) && tmp != null)
SenderWantsToWaitForRoot = tmp.AsBoolean();
if (args.ContainsKey("wait_for_root") && args["wait_for_root"] != null)
SenderWantsToWaitForRoot = args["wait_for_root"].AsBoolean();
if (args.TryGetValue("far", out tmp) && tmp != null)
Far = (float)(tmp.AsReal());
if (args["far"] != null)
Far = (float)(args["far"].AsReal());
if (args.TryGetValue("aspect", out tmp) && tmp != null)
Aspect = (float)tmp.AsReal();
if (args["aspect"] != null)
Aspect = (float)args["aspect"].AsReal();
if (args.TryGetValue("throttles", out tmp) && tmp != null)
Throttles = tmp.AsBinary();
if (args["throttles"] != null)
Throttles = args["throttles"].AsBinary();
if (args.TryGetValue("locomotion_state", out tmp) && tmp != null)
UInt32.TryParse(tmp.AsString(), out LocomotionState);
if (args["locomotion_state"] != null)
UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState);
if (args.TryGetValue("head_rotation", out tmp) && tmp != null)
Quaternion.TryParse(tmp.AsString(), out HeadRotation);
if (args["head_rotation"] != null)
Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation);
if (args.TryGetValue("body_rotation", out tmp) && tmp != null)
Quaternion.TryParse(tmp.AsString(), out BodyRotation);
if (args["body_rotation"] != null)
Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation);
if (args.TryGetValue("control_flags", out tmp) && tmp != null)
UInt32.TryParse(tmp.AsString(), out ControlFlags);
if (args["control_flags"] != null)
UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags);
if (args.TryGetValue("energy_level", out tmp) && tmp != null)
EnergyLevel = (float)(tmp.AsReal());
if (args["energy_level"] != null)
EnergyLevel = (float)(args["energy_level"].AsReal());
if (args.TryGetValue("god_data", out tmp) && tmp != null)
GodData = tmp;
//if (args["god_level"] != null)
// Byte.TryParse(args["god_level"].AsString(), out GodLevel);
if (args.TryGetValue("always_run", out tmp) && tmp != null)
AlwaysRun = tmp.AsBoolean();
if (args.ContainsKey("god_data") && args["god_data"] != null)
GodData = args["god_data"];
if (args.TryGetValue("prey_agent", out tmp) && tmp != null)
PreyAgent = tmp.AsUUID();
if (args["always_run"] != null)
AlwaysRun = args["always_run"].AsBoolean();
if (args.TryGetValue("agent_access", out tmp) && tmp != null)
Byte.TryParse(tmp.AsString(), out AgentAccess);
if (args["prey_agent"] != null)
PreyAgent = args["prey_agent"].AsUUID();
if (args.TryGetValue("agent_cof", out tmp) && tmp != null)
agentCOF = tmp.AsUUID();
if (args["agent_access"] != null)
Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
if (args.ContainsKey("agent_cof") && args["agent_cof"] != null)
agentCOF = args["agent_cof"].AsUUID();
if (args.ContainsKey("crossingflags") && args["crossingflags"] != null)
CrossingFlags = (byte)args["crossingflags"].AsInteger();
if (args.TryGetValue("crossingflags", out tmp) && tmp != null)
CrossingFlags = (byte)tmp.AsInteger();
if(CrossingFlags != 0)
{
if (args.ContainsKey("crossExtraFlags") && args["crossExtraFlags"] != null)
CrossExtraFlags = (byte)args["crossExtraFlags"].AsInteger();
if (args.TryGetValue("crossExtraFlags", out tmp) && tmp != null)
CrossExtraFlags = (byte)tmp.AsInteger();
}
if (args.ContainsKey("active_group_id") && args["active_group_id"] != null)
ActiveGroupID = args["active_group_id"].AsUUID();
if (args.TryGetValue("active_group_id", out tmp) && tmp != null)
ActiveGroupID = tmp.AsUUID();
if (args.ContainsKey("active_group_name") && args["active_group_name"] != null)
ActiveGroupName = args["active_group_name"].AsString();
if (args.TryGetValue("active_group_name", out tmp) && tmp != null)
ActiveGroupName = tmp.AsString();
if(args.ContainsKey("active_group_title") && args["active_group_title"] != null)
ActiveGroupTitle = args["active_group_title"].AsString();
if(args.TryGetValue("active_group_title", out tmp) && tmp != null)
ActiveGroupTitle = tmp.AsString();
if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) &&
(args["children_seeds"].Type == OSDType.Array))
if (args.TryGetValue("children_seeds", out tmp) && tmp is OSDArray)
{
OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
OSDArray childrenSeeds = (OSDArray)tmp;
ChildrenCapSeeds = new Dictionary<ulong, string>();
foreach (OSD o in childrenSeeds)
{
if (o.Type == OSDType.Map)
if (o is OSDMap)
{
ulong handle = 0;
string seed = "";
OSDMap pair = (OSDMap)o;
if (pair["handle"] != null)
if (!UInt64.TryParse(pair["handle"].AsString(), out handle))
if (pair.TryGetValue("handle", out tmp))
if (!UInt64.TryParse(tmp.AsString(), out handle))
continue;
if (pair["seed"] != null)
seed = pair["seed"].AsString();
if (pair.TryGetValue("seed", out tmp))
seed = tmp.AsString();
if (!ChildrenCapSeeds.ContainsKey(handle))
ChildrenCapSeeds.Add(handle, seed);
}
}
}
if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
if (args.TryGetValue("animations", out tmp) && tmp is OSDArray)
{
OSDArray anims = (OSDArray)(args["animations"]);
OSDArray anims = (OSDArray)tmp;
Anims = new Animation[anims.Count];
int i = 0;
foreach (OSD o in anims)
{
if (o.Type == OSDType.Map)
if (o is OSDMap)
{
Anims[i++] = new Animation((OSDMap)o);
}
}
}
if (args["default_animation"] != null)
if (args.TryGetValue("default_animation", out tmp) && tmp is OSDMap)
{
try
{
DefaultAnim = new Animation((OSDMap)args["default_animation"]);
DefaultAnim = new Animation((OSDMap)tmp);
}
catch
{
@ -717,11 +713,11 @@ namespace OpenSim.Framework
}
}
if (args["animation_state"] != null)
if (args.TryGetValue("animation_state", out tmp) && tmp is OSDMap)
{
try
{
AnimState = new Animation((OSDMap)args["animation_state"]);
AnimState = new Animation((OSDMap)tmp);
}
catch
{
@ -731,9 +727,9 @@ namespace OpenSim.Framework
MovementAnimationOverRides.Clear();
if (args["movementAO"] != null && args["movementAO"].Type == OSDType.Array)
if (args.TryGetValue("movementAO", out tmp) && tmp is OSDArray)
{
OSDArray AOs = (OSDArray)(args["movementAO"]);
OSDArray AOs = (OSDArray)tmp;
int count = AOs.Count;
for (int i = 0; i < count; i++)
@ -748,8 +744,8 @@ namespace OpenSim.Framework
}
}
if (args.ContainsKey("motion_state"))
MotionState = (byte)args["motion_state"].AsInteger();
if (args.TryGetValue("motion_state", out tmp) && tmp != null)
MotionState = (byte)tmp.AsInteger();
//if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
//{
@ -762,10 +758,10 @@ namespace OpenSim.Framework
// packed_appearence should contain all appearance information
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
if (args.TryGetValue("packed_appearance", out tmp) && tmp is OSDMap)
{
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance");
Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
Appearance = new AvatarAppearance((OSDMap)tmp);
}
else
{
@ -777,19 +773,19 @@ namespace OpenSim.Framework
// The code to unpack textures, visuals, wearables and attachments
// should be removed; packed appearance contains the full appearance
// This is retained for backward compatibility only
if (args["texture_entry"] != null)
if (args.TryGetValue("texture_entry", out tmp) && tmp != null)
{
byte[] rawtextures = args["texture_entry"].AsBinary();
byte[] rawtextures = tmp.AsBinary();
Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
Appearance.SetTextureEntries(textures);
}
if (args["visual_params"] != null)
Appearance.SetVisualParams(args["visual_params"].AsBinary());
if (args.TryGetValue("visual_params", out tmp) && tmp != null)
Appearance.SetVisualParams(tmp.AsBinary());
if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
if (args.TryGetValue("wearables", out tmp) && tmp is OSDArray)
{
OSDArray wears = (OSDArray)(args["wearables"]);
OSDArray wears = (OSDArray)tmp;
for (int i = 0; i < wears.Count / 2; i++)
{
@ -798,12 +794,12 @@ namespace OpenSim.Framework
}
}
if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
if (args.TryGetValue("attachments", out tmp) && tmp is OSDArray)
{
OSDArray attachs = (OSDArray)(args["attachments"]);
OSDArray attachs = (OSDArray)tmp;
foreach (OSD o in attachs)
{
if (o.Type == OSDType.Map)
if (o is OSDMap)
{
// We know all of these must end up as attachments so we
// append rather than replace to ensure multiple attachments
@ -816,35 +812,35 @@ namespace OpenSim.Framework
// end of code to remove
}
if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
if (args.TryGetValue("controllers", out tmp) && tmp is OSDArray)
{
OSDArray controls = (OSDArray)(args["controllers"]);
OSDArray controls = (OSDArray)tmp;
Controllers = new ControllerData[controls.Count];
int i = 0;
foreach (OSD o in controls)
{
if (o.Type == OSDType.Map)
if (o is OSDMap)
{
Controllers[i++] = new ControllerData((OSDMap)o);
}
}
}
if (args["callback_uri"] != null)
CallbackURI = args["callback_uri"].AsString();
if (args.TryGetValue("callback_uri", out tmp) && tmp != null)
CallbackURI = tmp.AsString();
if (args["cb_uri"] != null)
NewCallbackURI = args["cb_uri"].AsString();
if (args.TryGetValue("cb_uri", out tmp) && tmp != null)
NewCallbackURI = tmp.AsString();
// Attachment objects
if (args["attach_objects"] != null && args["attach_objects"].Type == OSDType.Array)
if (args.TryGetValue("attach_objects", out tmp) && tmp is OSDArray)
{
OSDArray attObjs = (OSDArray)(args["attach_objects"]);
OSDArray attObjs = (OSDArray)tmp;
AttachmentObjects = new List<ISceneObject>();
AttachmentObjectStates = new List<string>();
foreach (OSD o in attObjs)
{
if (o.Type == OSDType.Map)
if (o is OSDMap)
{
OSDMap info = (OSDMap)o;
ISceneObject so = scene.DeserializeObject(info["sog"].AsString());
@ -856,10 +852,10 @@ namespace OpenSim.Framework
}
}
if (args["parent_part"] != null)
ParentPart = args["parent_part"].AsUUID();
if (args["sit_offset"] != null)
Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset);
if (args.TryGetValue("parent_part", out tmp) && tmp != null)
ParentPart = tmp.AsUUID();
if (args.TryGetValue("sit_offset", out tmp) && tmp != null)
Vector3.TryParse(tmp.AsString(), out SitOffset);
}
public AgentData()

View File

@ -84,7 +84,7 @@ namespace OpenSim.Framework.Console
{
}
public void Output(string format)
public virtual void Output(string format)
{
System.Console.WriteLine(format);
}

View File

@ -389,6 +389,11 @@ namespace OpenSim.Framework.Console
System.Console.WriteLine();
}
public override void Output(string format)
{
Output(format, null);
}
public override void Output(string format, params object[] components)
{
string level = null;

View File

@ -190,6 +190,11 @@ namespace OpenSim.Framework.Console
m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
}
public override void Output(string format)
{
Output(format, null);
}
public override void Output(string format, params object[] components)
{
string level = null;
@ -424,10 +429,9 @@ namespace OpenSim.Framework.Console
}
// This call is a CAP. The URL is the authentication.
string uri = "/ReadResponses/" + sessionID.ToString() + "/";
string uri = "/ReadResponses/" + sessionID.ToString();
m_Server.AddPollServiceHTTPHandler(
uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, null, sessionID,25000)); // 25 secs timeout
m_Server.AddPollServiceHTTPHandler(new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, null, sessionID,25000)); // 25 secs timeout
// Our reply is an XML document.
// TODO: Change this to Linq.Xml

View File

@ -25,18 +25,22 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenMetaverse;
namespace OpenSim.Framework
{
public class Constants
{
public const int MaxAgentAttachments = 38;
public const int MaxAgentGroups = 60;
// 'RegionSize' is the legacy region size.
// DO NOT USE THIS FOR ANY NEW CODE. Use Scene.RegionInfo.RegionSize[XYZ] as a region might not
// be the legacy region size.
public const uint RegionSize = 256;
public const uint RegionHeight = 4096;
// This could be a parameters but, really, a region of greater than this is pretty unmanageable
public const uint MaximumRegionSize = 8192;
public const uint MaximumRegionSize = 4096;
// Since terrain is stored in 16x16 heights, regions must be a multiple of this number and that is the minimum
public const int MinRegionSize = 16;
@ -44,6 +48,9 @@ namespace OpenSim.Framework
public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f";
public static readonly UUID m_MrOpenSimID = new UUID("11111111-1111-0000-0000-000100bba000");
public static readonly DateTime m_MrOpenSimBorn = new DateTime(2007, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public enum EstateAccessCodex : uint
{
AllowedAccess = 1,

View File

@ -115,25 +115,28 @@ namespace OpenSim.Framework
// Used by the sim
//
private bool m_UseGlobalTime = true;
private bool m_UseGlobalTime = false;
public bool UseGlobalTime
{
get { return m_UseGlobalTime; }
set { m_UseGlobalTime = value; }
//set { m_UseGlobalTime = value; }
set { m_UseGlobalTime = false; }
}
private bool m_FixedSun = false;
public bool FixedSun
{
get { return m_FixedSun; }
set { m_FixedSun = value; }
// set { m_FixedSun = value; }
set { m_FixedSun = false; }
}
private double m_SunPosition = 0.0;
public double SunPosition
{
get { return m_SunPosition; }
set { m_SunPosition = value; }
//set { m_SunPosition = value; }
set { m_SunPosition = 0; }
}
private bool m_AllowVoice = true;
@ -202,7 +205,7 @@ namespace OpenSim.Framework
}
private bool m_TaxFree = false;
public bool TaxFree // this is now AllowAccessOverride, keeping same name to reuse DB entries
public bool TaxFree // this is now !AllowAccessOverride, keeping same name to reuse DB entries
{
get { return m_TaxFree; }
set { m_TaxFree = value; }
@ -237,6 +240,13 @@ namespace OpenSim.Framework
set { m_DenyMinors = value; }
}
private bool m_AllowEnviromentOverride = false; //keep the mispell so not to go change the dbs
public bool AllowEnvironmentOverride
{
get { return m_AllowEnviromentOverride; }
set { m_AllowEnviromentOverride = value; }
}
// All those lists...
//
private List<UUID> l_EstateManagers = new List<UUID>();

View File

@ -0,0 +1,291 @@
/*
* Copyright (c) 2008, openmetaverse.org, http://opensimulator.org/
* All rights reserved.
*
* - 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.
* - Neither the name of the openmetaverse.org 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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.Timers;
using System.Threading;
using System.Collections.Generic;
using Timer = System.Timers.Timer;
namespace OpenSim.Framework
{
public class ExpiringKey<Tkey1> : IDisposable
{
private Dictionary<Tkey1, int> m_dictionary;
private ReaderWriterLockSlim m_rwLock = new ReaderWriterLockSlim();
private readonly double m_startTS;
private readonly int expire;
private Timer m_purgeTimer;
public ExpiringKey(int expireTimeinMS)
{
m_dictionary = new Dictionary<Tkey1, int>();
m_startTS = Util.GetTimeStampMS();
expire = expireTimeinMS;
if(expire < 500)
expire = 500;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
private void SetTimer()
{
if (m_purgeTimer == null)
{
m_purgeTimer = new Timer()
{
Interval = expire,
AutoReset = false // time drift is not a issue.
};
m_purgeTimer.Elapsed += Purge;
m_purgeTimer.Start();
}
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
private void DisposeTimer()
{
if (m_purgeTimer != null)
{
m_purgeTimer.Stop();
m_purgeTimer.Dispose();
m_purgeTimer = null;
}
}
~ExpiringKey()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public void Dispose(bool disposing)
{
if (m_rwLock != null)
{
m_rwLock.Dispose();
m_rwLock = null;
DisposeTimer();
}
}
private void Purge(object source, ElapsedEventArgs e)
{
if (m_dictionary.Count == 0)
{
DisposeTimer();
return;
}
bool gotLock = false;
int now = (int)(Util.GetTimeStampMS() - m_startTS);
try
{
try { }
finally
{
m_rwLock.EnterWriteLock();
gotLock = true;
}
List<Tkey1> expired = new List<Tkey1>(m_dictionary.Count);
foreach(KeyValuePair<Tkey1,int> kvp in m_dictionary)
{
if(kvp.Value < now)
expired.Add(kvp.Key);
}
foreach(Tkey1 key in expired)
m_dictionary.Remove(key);
if(m_dictionary.Count == 0)
DisposeTimer();
else
m_purgeTimer.Start();
}
finally
{
if (gotLock)
m_rwLock.ExitWriteLock();
}
}
public void Add(Tkey1 key)
{
bool gotLock = false;
int now = (int)(Util.GetTimeStampMS() - m_startTS) + expire;
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try { }
finally
{
m_rwLock.EnterWriteLock();
gotLock = true;
}
m_dictionary[key] = now;
SetTimer();
}
finally
{
if (gotLock)
m_rwLock.ExitWriteLock();
}
}
public void Add(Tkey1 key, int expireMS)
{
bool gotLock = false;
int now;
if (expireMS > 500)
now = (int)(Util.GetTimeStampMS() - m_startTS) + expire;
else
now = (int)(Util.GetTimeStampMS() - m_startTS) + 500;
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try { }
finally
{
m_rwLock.EnterWriteLock();
gotLock = true;
}
m_dictionary[key] = now;
SetTimer();
}
finally
{
if (gotLock)
m_rwLock.ExitWriteLock();
}
}
public bool Remove(Tkey1 key)
{
bool success;
bool gotLock = false;
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
m_rwLock.EnterWriteLock();
gotLock = true;
}
success = m_dictionary.Remove(key);
if(m_dictionary.Count == 0)
DisposeTimer();
}
finally
{
if (gotLock)
m_rwLock.ExitWriteLock();
}
return success;
}
public void Clear()
{
bool gotLock = false;
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
m_rwLock.EnterWriteLock();
gotLock = true;
m_dictionary.Clear();
DisposeTimer();
}
}
finally
{
if (gotLock)
m_rwLock.ExitWriteLock();
}
}
public int Count
{
get { return m_dictionary.Count; }
}
public bool ContainsKey(Tkey1 key)
{
return m_dictionary.ContainsKey(key);
}
public bool TryGetValue(Tkey1 key, out int value)
{
bool success;
bool gotLock = false;
try
{
// Avoid an asynchronous Thread.Abort() from possibly never existing an acquired lock by placing
// the acquision inside the main try. The inner finally block is needed because thread aborts cannot
// interrupt code in these blocks (hence gotLock is guaranteed to be set correctly).
try {}
finally
{
m_rwLock.EnterReadLock();
gotLock = true;
}
success = m_dictionary.TryGetValue(key, out value);
}
finally
{
if (gotLock)
m_rwLock.ExitReadLock();
}
return success;
}
}
}

View File

@ -35,7 +35,7 @@ namespace OpenSim.Framework
/// Cache the specified asset.
/// </summary>
/// <param name='asset'></param>
void Cache(AssetBase asset);
void Cache(AssetBase asset, bool replace = false);
/// <summary>
/// Cache that the specified asset wasn't found.

View File

@ -60,9 +60,8 @@ namespace OpenSim.Framework
public delegate void ObjectAttach(
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent);
public delegate void ModifyTerrain(UUID user,
float height, float seconds, byte size, byte action, float north, float west, float south, float east,
UUID agentId);
public delegate void ModifyTerrain(UUID user, float height, float seconds, float brushSize,
byte action, float north, float west, float south, float east, int parcelLocalID);
public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes);
@ -222,7 +221,9 @@ namespace OpenSim.Framework
public delegate void AddNewPrim(
UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, byte bypassRaycast, Vector3 RayStart,
UUID RayTargetID,
byte RayEndIsIntersection);
byte RayEndIsIntersection, uint addflags);
public delegate void AgentDataUpdate(IClientAPI remoteClient, UUID itemID, UUID ownerID);
public delegate void RequestGodlikePowers(
UUID AgentID, UUID SessionID, UUID token, bool GodLike);
@ -253,7 +254,7 @@ namespace OpenSim.Framework
public delegate void PurgeInventoryDescendents(
IClientAPI remoteClient, UUID folderID);
public delegate void FetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID);
public delegate void FetchInventory(IClientAPI remoteClient, UUID[] items, UUID[] owner);
public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID);
@ -847,7 +848,7 @@ namespace OpenSim.Framework
event Action<IClientAPI> OnRequestAvatarsData;
event AddNewPrim OnAddPrim;
event FetchInventory OnAgentDataUpdateRequest;
event AgentDataUpdate OnAgentDataUpdateRequest;
event TeleportLocationRequest OnSetStartLocationRequest;
event RequestGodlikePowers OnRequestGodlikePowers;
@ -1206,10 +1207,10 @@ namespace OpenSim.Framework
void FlushPrimUpdates();
void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items,
List<InventoryFolderBase> folders, int version, bool fetchFolders,
bool fetchItems);
List<InventoryFolderBase> folders, int version, int descendents,
bool fetchFolders, bool fetchItems);
void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item);
void SendInventoryItemDetails(InventoryItemBase[] items);
/// <summary>
/// Tell the client that we have created the item it requested.
@ -1249,7 +1250,7 @@ namespace OpenSim.Framework
int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice,
float TeleportPriceExponent);
void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data);
void SendAvatarPickerReply(UUID QueryID, List<UserData> users);
void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers,
string groupname, string grouptitle);
@ -1285,20 +1286,8 @@ namespace OpenSim.Framework
void SendDialog(string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch,
string[] buttonlabels);
/// <summary>
/// Update the client as to where the sun is currently located.
/// </summary>
/// <param name="sunPos"></param>
/// <param name="sunVel"></param>
/// <param name="CurrentTime">Seconds since Unix Epoch 01/01/1970 00:00:00</param>
/// <param name="SecondsPerSunCycle"></param>
/// <param name="SecondsPerYear"></param>
/// <param name="OrbitalPosition">The orbital position is given in radians, and must be "adjusted" for the linden client, see LLClientView</param>
void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear,
float OrbitalPosition);
void SendViewerTime(Vector3 sunDir, float sunphase);
void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks);
void SendViewerTime(int phase);
void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] membershipType, string flAbout,
uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID);

View File

@ -99,5 +99,6 @@ namespace OpenSim.Region.Framework.Interfaces
void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id);
void sendClientInitialLandInfo(IClientAPI remoteClient, bool overlay);
void ClearAllEnvironments();
}
}

View File

@ -73,6 +73,7 @@ namespace OpenSim.Framework
ILandObject Copy();
void SendLandUpdateToAvatarsOverMe();
void SendLandUpdateToAvatars();
void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client);
bool UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client, out bool snap_selection, out bool needOverlay);
@ -172,6 +173,8 @@ namespace OpenSim.Framework
void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel);
void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel);
void StoreEnvironment(ViewerEnvironment VEnv);
/// <summary>
/// Set the media url for this land parcel
/// </summary>

View File

@ -51,9 +51,9 @@ namespace OpenSim.Framework
public const string LLSDEmpty = "<llsd><map /></llsd>";
// got tired of creating a stringbuilder all the time;
public static StringBuilder Start(int size = 256, bool addxmlversion = false)
public static StringBuilder Start(int size = 4096, bool addxmlversion = false)
{
StringBuilder sb = new StringBuilder(size);
StringBuilder sb = osStringBuilderCache.Acquire(size);
if(addxmlversion)
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd>"); // legacy llsd xml name still valid
else
@ -69,7 +69,13 @@ namespace OpenSim.Framework
public static string End(StringBuilder sb)
{
sb.Append("</llsd>");
return sb.ToString();
return osStringBuilderCache.GetStringAndRelease(sb);
}
public static byte[] EndToNBBytes(StringBuilder sb)
{
sb.Append("</llsd>");
return Util.UTF8NBGetbytes(osStringBuilderCache.GetStringAndRelease(sb));
}
// map == a list of key value pairs
@ -120,7 +126,7 @@ namespace OpenSim.Framework
if(e)
sb.Append("<boolean>1</boolean>");
else
sb.Append("<boolean />");
sb.Append("<boolean>0</boolean>");
}
public static void AddElem(byte e, StringBuilder sb)
@ -142,7 +148,22 @@ namespace OpenSim.Framework
else
{
sb.Append("<binary>"); // encode64 is default
sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None));
base64Encode(e, sb);
sb.Append("</binary>");
}
}
public static void AddElem(byte[] e, int start, int length, StringBuilder sb)
{
if (start + length >= e.Length)
length = e.Length - start;
if (e == null || e.Length == 0 || length <= 0)
sb.Append("binary />");
else
{
sb.Append("<binary>"); // encode64 is default
base64Encode(e, start, length, sb);
sb.Append("</binary>");
}
}
@ -172,7 +193,7 @@ namespace OpenSim.Framework
public static void AddElem(float e, StringBuilder sb)
{
if(e == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -186,7 +207,7 @@ namespace OpenSim.Framework
sb.Append("<array>");
if(e.X == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -195,7 +216,7 @@ namespace OpenSim.Framework
}
if(e.Y == 0)
sb.Append("<real /></array>");
sb.Append("<real>0</real></array>");
else
{
sb.Append("<real>");
@ -209,7 +230,7 @@ namespace OpenSim.Framework
sb.Append("<array>");
if(e.X == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -218,7 +239,7 @@ namespace OpenSim.Framework
}
if(e.Y == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -227,7 +248,7 @@ namespace OpenSim.Framework
}
if(e.Z == 0)
sb.Append("<real /></array>");
sb.Append("<real>0</real></array>");
else
{
sb.Append("<real>");
@ -241,7 +262,7 @@ namespace OpenSim.Framework
sb.Append("<array><key>x</key>");
if(e.X == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -250,7 +271,7 @@ namespace OpenSim.Framework
}
if(e.Y == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -258,7 +279,7 @@ namespace OpenSim.Framework
sb.Append("</real>");
}
if(e.Z == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -267,7 +288,7 @@ namespace OpenSim.Framework
}
if(e.W == 0)
sb.Append("<real /></array>");
sb.Append("<real>0</real></array>");
else
{
sb.Append("<real>");
@ -279,7 +300,7 @@ namespace OpenSim.Framework
public static void AddElem(double e, StringBuilder sb)
{
if(e == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -420,7 +441,7 @@ namespace OpenSim.Framework
if(e)
sb.Append("<boolean>1</boolean>");
else
sb.Append("<boolean />");
sb.Append("<boolean>0</boolean>");
}
public static void AddElem(string name, byte e, StringBuilder sb)
@ -450,7 +471,26 @@ namespace OpenSim.Framework
else
{
sb.Append("<binary>"); // encode64 is default
sb.Append(Convert.ToBase64String(e,Base64FormattingOptions.None));
base64Encode(e, sb);
sb.Append("</binary>");
}
}
public static void AddElem(string name, byte[] e, int start, int length, StringBuilder sb)
{
sb.Append("<key>");
sb.Append(name);
sb.Append("</key>");
if (start + length >= e.Length)
length = e.Length - start;
if (e == null || e.Length == 0 || length <= 0)
sb.Append("binary />");
else
{
sb.Append("<binary>"); // encode64 is default
base64Encode(e, start, length, sb);
sb.Append("</binary>");
}
}
@ -488,7 +528,7 @@ namespace OpenSim.Framework
sb.Append("</key>");
if(e == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -504,7 +544,7 @@ namespace OpenSim.Framework
sb.Append("</key><array>>");
if(e.X == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -513,7 +553,7 @@ namespace OpenSim.Framework
}
if(e.Y == 0)
sb.Append("<real /></array>");
sb.Append("<real>0</real></array>");
else
{
sb.Append("<real>");
@ -529,7 +569,7 @@ namespace OpenSim.Framework
sb.Append("</key><array>");
if(e.X == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -538,7 +578,7 @@ namespace OpenSim.Framework
}
if(e.Y == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -547,7 +587,7 @@ namespace OpenSim.Framework
}
if(e.Z == 0)
sb.Append("<real /></array>");
sb.Append("<real>0</real></array>");
else
{
sb.Append("<real>");
@ -563,7 +603,7 @@ namespace OpenSim.Framework
sb.Append("</key><array>");
if(e.X == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -572,7 +612,7 @@ namespace OpenSim.Framework
}
if(e.Y == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -580,7 +620,7 @@ namespace OpenSim.Framework
sb.Append("</real>");
}
if(e.Z == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -589,7 +629,7 @@ namespace OpenSim.Framework
}
if(e.W == 0)
sb.Append("<real /></array>");
sb.Append("<real>0</real></array>");
else
{
sb.Append("<real>");
@ -605,7 +645,7 @@ namespace OpenSim.Framework
sb.Append("</key>");
if(e == 0)
sb.Append("<real />");
sb.Append("<real>0</real>");
else
{
sb.Append("<real>");
@ -724,11 +764,8 @@ namespace OpenSim.Framework
public static void EscapeToXML(string s, StringBuilder sb)
{
int i;
char c;
int len = s.Length;
for (i = 0; i < len; i++)
for (int i = 0; i < s.Length; ++i)
{
c = s[i];
switch (c)
@ -780,5 +817,97 @@ namespace OpenSim.Framework
(byte)value
};
}
static readonly char[] base64Chars = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d',
'e','f','g','h','i','j','k','l','m','n','o','p','q','r','s',
't','u','v','w','x','y','z','0','1','2','3','4','5','6','7',
'8','9','+','/'};
public static unsafe void base64Encode(byte[] data, StringBuilder sb)
{
int lenMod3 = data.Length % 3;
int len = data.Length - lenMod3;
fixed (byte* d = data)
{
fixed (char* b64 = base64Chars)
{
int i = 0;
while(i < len)
{
sb.Append(b64[d[i] >> 2]);
sb.Append(b64[((d[i] & 0x03) << 4) | ((d[i + 1] & 0xf0) >> 4)]);
sb.Append(b64[((d[i + 1] & 0x0f) << 2) | ((d[i + 2] & 0xc0) >> 6)]);
sb.Append(b64[d[i + 2] & 0x3f]);
i += 3;
}
switch (lenMod3)
{
case 2:
{
i = len;
sb.Append(b64[d[i] >> 2]);
sb.Append(b64[((d[i] & 0x03) << 4) | ((d[i + 1] & 0xf0) >> 4)]);
sb.Append(b64[((d[i + 1] & 0x0f) << 2)]);
sb.Append('=');
break;
}
case 1:
{
i = len;
sb.Append(b64[d[i] >> 2]);
sb.Append(b64[(d[i] & 0x03) << 4]);
sb.Append("==");
break;
}
}
}
}
}
public static unsafe void base64Encode(byte[] data, int start, int length, StringBuilder sb)
{
int lenMod3 = length % 3;
int len = start + (length - lenMod3);
fixed (byte* d = data)
{
fixed (char* b64 = base64Chars)
{
int i = start;
while(i < len)
{
sb.Append(b64[(d[i] & 0xfc) >> 2]);
sb.Append(b64[((d[i] & 0x03) << 4) | (d[i + 1] >> 4)]);
sb.Append(b64[((d[i + 1] & 0x0f) << 2) | (d[i + 2] >> 6)]);
sb.Append(b64[d[i + 2] & 0x3f]);
i += 3;
}
switch (lenMod3)
{
case 2:
{
i = len;
sb.Append(b64[d[i] >> 2]);
sb.Append(b64[((d[i] & 0x03) << 4) | (d[i + 1] >> 4)]);
sb.Append(b64[((d[i + 1] & 0x0f) << 2)]);
sb.Append('=');
break;
}
case 1:
{
i = len;
sb.Append(b64[d[i] >> 2]);
sb.Append(b64[(d[i] & 0x03) << 4]);
sb.Append("==");
break;
}
}
}
}
}
}
}

View File

@ -732,6 +732,11 @@ namespace OpenSim.Framework
}
}
public int EnvironmentVersion = -1;
[XmlIgnore] //this needs to be added by hand
public ViewerEnvironment Environment { get; set;}
public LandData()
{
_globalID = UUID.Random();
@ -739,6 +744,8 @@ namespace OpenSim.Framework
AnyAVSounds = true;
GroupAVSounds = true;
LastDwellTimeMS = Util.GetTimeStampMS();
EnvironmentVersion = -1;
Environment = null;
}
/// <summary>
@ -804,6 +811,17 @@ namespace OpenSim.Framework
landData._parcelAccessList.Add(newEntry);
}
if (Environment == null)
{
landData.Environment = null;
landData.EnvironmentVersion = -1;
}
else
{
landData.Environment = Environment.Clone();
landData.EnvironmentVersion = EnvironmentVersion;
}
return landData;
}

View File

@ -52,11 +52,10 @@ namespace OpenSim.Framework.Monitoring
Math.Round((MemoryWatchdog.LastHeapAllocationRate * 1000) / 1048576.0, 3),
Math.Round((MemoryWatchdog.AverageHeapAllocationRate * 1000) / 1048576.0, 3));
Process myprocess = Process.GetCurrentProcess();
// if (!myprocess.HasExited)
try
{
myprocess.Refresh();
using (Process myprocess = Process.GetCurrentProcess())
{
sb.AppendFormat(
"Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
Math.Round(myprocess.WorkingSet64 / 1024.0 / 1024.0),
@ -68,6 +67,7 @@ namespace OpenSim.Framework.Monitoring
Math.Round(myprocess.PeakPagedMemorySize64 / 1024.0 / 1024.0),
Math.Round(myprocess.PeakVirtualMemorySize64 / 1024.0 / 1024.0));
}
}
catch
{ }
// else

View File

@ -131,7 +131,15 @@ namespace OpenSim.Framework.Monitoring
finally
{
if(m_cancelSource != null)
{
m_cancelSource.Dispose();
m_cancelSource = null;
}
if (m_jobQueue != null)
{
m_jobQueue.Dispose();
m_jobQueue = null;
}
}
}
}
@ -238,13 +246,13 @@ namespace OpenSim.Framework.Monitoring
break;
}
}
catch(ObjectDisposedException)
catch (OperationCanceledException)
{
m_log.DebugFormat("[JobEngine] {0} stopping ignoring {1} jobs in queue",
m_log.DebugFormat("[JobEngine] {0} Canceled ignoring {1} jobs in queue",
Name, m_jobQueue.Count);
break;
}
catch(OperationCanceledException)
catch
{
break;
}
@ -266,6 +274,7 @@ namespace OpenSim.Framework.Monitoring
if(LogLevel >= 1)
m_log.DebugFormat("[{0}]: Processed job {1}",LoggingName,m_currentJob.Name);
m_currentJob.Action = null;
m_currentJob = null;
}
}
@ -292,7 +301,7 @@ namespace OpenSim.Framework.Monitoring
/// <summary>
/// Action to perform when this job is processed.
/// </summary>
public Action Action { get; private set; }
public Action Action { get; set; }
private Job(string name, string commonId, Action action)
{

View File

@ -435,20 +435,18 @@ Asset service request failures: {3}" + Environment.NewLine,
// Get the amount of physical memory, allocated with the instance of this program, in kilobytes;
// the working set is the set of memory pages currently visible to this program in physical RAM
// memory and includes both shared (e.g. system libraries) and private data
double memUsage = Process.GetCurrentProcess().WorkingSet64 / 1024.0;
int numberThreadsRunning = 0;
double memUsage = 0;
using(Process p = Process.GetCurrentProcess())
{
memUsage = p.WorkingSet64 / 1024.0;
// Get the number of threads from the system that are currently
// running
int numberThreadsRunning = 0;
foreach (ProcessThread currentThread in
Process.GetCurrentProcess().Threads)
{
// A known issue with the current process .Threads property is
// that it can return null threads, thus don't count those as
// running threads and prevent the program function from failing
if (currentThread != null &&
currentThread.ThreadState == ThreadState.Running)
foreach (ProcessThread currentThread in p.Threads)
{
if (currentThread != null && currentThread.ThreadState == ThreadState.Running)
numberThreadsRunning++;
}
}

View File

@ -1242,7 +1242,7 @@ namespace OpenSim.Framework
byte extraParamCount = data[0];
int i = 1;
for (int k = 0; k < extraParamCount; k++)
for (int k = 0; k < extraParamCount; ++k)
{
byte epType = data[i];
i += 6;

View File

@ -40,69 +40,12 @@ using OpenMetaverse.StructuredData;
namespace OpenSim.Framework
{
[Serializable]
public class RegionLightShareData : ICloneable
{
public bool valid = false;
public UUID regionID = UUID.Zero;
public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f);
public float waterFogDensityExponent = 4.0f;
public float underwaterFogModifier = 0.25f;
public Vector3 reflectionWaveletScale = new Vector3(2.0f,2.0f,2.0f);
public float fresnelScale = 0.40f;
public float fresnelOffset = 0.50f;
public float refractScaleAbove = 0.03f;
public float refractScaleBelow = 0.20f;
public float blurMultiplier = 0.040f;
public Vector2 bigWaveDirection = new Vector2(1.05f,-0.42f);
public Vector2 littleWaveDirection = new Vector2(1.11f,-1.16f);
public UUID normalMapTexture = new UUID("822ded49-9a6c-f61c-cb89-6df54f42cdf4");
public Vector4 horizon = new Vector4(0.25f, 0.25f, 0.32f, 0.32f);
public float hazeHorizon = 0.19f;
public Vector4 blueDensity = new Vector4(0.12f, 0.22f, 0.38f, 0.38f);
public float hazeDensity = 0.70f;
public float densityMultiplier = 0.18f;
public float distanceMultiplier = 0.8f;
public UInt16 maxAltitude = 1605;
public Vector4 sunMoonColor = new Vector4(0.24f, 0.26f, 0.30f, 0.30f);
public float sunMoonPosition = 0.317f;
public Vector4 ambient = new Vector4(0.35f,0.35f,0.35f,0.35f);
public float eastAngle = 0.0f;
public float sunGlowFocus = 0.10f;
public float sunGlowSize = 1.75f;
public float sceneGamma = 1.0f;
public float starBrightness = 0.0f;
public Vector4 cloudColor = new Vector4(0.41f, 0.41f, 0.41f, 0.41f);
public Vector3 cloudXYDensity = new Vector3(1.00f, 0.53f, 1.00f);
public float cloudCoverage = 0.27f;
public float cloudScale = 0.42f;
public Vector3 cloudDetailXYDensity = new Vector3(1.00f, 0.53f, 0.12f);
public float cloudScrollX = 0.20f;
public bool cloudScrollXLock = false;
public float cloudScrollY = 0.01f;
public bool cloudScrollYLock = false;
public bool drawClassicClouds = true;
public delegate void SaveDelegate(RegionLightShareData wl);
public event SaveDelegate OnSave;
public void Save()
{
if (OnSave != null)
OnSave(this);
}
public object Clone()
{
return this.MemberwiseClone(); // call clone method
}
}
public class RegionInfo
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[REGION INFO]";
public bool commFailTF = false;
public ConfigurationMember configMember;
public string DataStore = String.Empty;
@ -134,7 +77,6 @@ namespace OpenSim.Framework
private int m_maxPrimsPerUser = -1;
private int m_linksetCapacity = 0;
private string m_regionType = String.Empty;
private RegionLightShareData m_windlight = new RegionLightShareData();
protected uint m_httpPort;
protected string m_serverURI;
protected string m_regionName = String.Empty;
@ -180,7 +122,6 @@ namespace OpenSim.Framework
private Dictionary<String, String> m_extraSettings = new Dictionary<string, string>();
public UUID CacheID { get; set;}
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
// MT: Yes. Estates can't span trust boundaries. Therefore, it can be
@ -197,8 +138,6 @@ namespace OpenSim.Framework
public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource, string configName)
{
// m_configSource = configSource;
CacheID = UUID.Random();
if (filename.ToLower().EndsWith(".ini"))
{
if (!File.Exists(filename)) // New region config request
@ -225,7 +164,6 @@ namespace OpenSim.Framework
source.Save(filename);
RegionFile = filename;
return;
}
@ -257,7 +195,6 @@ namespace OpenSim.Framework
ReadNiniConfig(source, name);
m_serverURI = string.Empty;
CacheID = UUID.Random();
}
public RegionInfo(uint legacyRegionLocX, uint legacyRegionLocY, IPEndPoint internalEndPoint, string externalUri)
@ -269,13 +206,11 @@ namespace OpenSim.Framework
m_internalEndPoint = internalEndPoint;
m_externalHostName = externalUri;
m_serverURI = string.Empty;
CacheID = UUID.Random();
}
public RegionInfo()
{
m_serverURI = string.Empty;
CacheID = UUID.Random();
}
public EstateSettings EstateSettings
@ -308,21 +243,6 @@ namespace OpenSim.Framework
set { m_regionSettings = value; }
}
public RegionLightShareData WindlightSettings
{
get
{
if (m_windlight == null)
{
m_windlight = new RegionLightShareData();
}
return m_windlight;
}
set { m_windlight = value; }
}
public float NonphysPrimMin
{
get { return m_nonphysPrimMin; }

View File

@ -121,15 +121,15 @@ namespace OpenSim.Framework
}
private UUID m_RegionUUID = UUID.Zero;
public UUID RegionUUID
{
get { return m_RegionUUID; }
set { m_RegionUUID = value; }
}
private bool m_BlockTerraform = false;
public UUID CacheID { get; set; } = UUID.Random();
private bool m_BlockTerraform = false;
public bool BlockTerraform
{
get { return m_BlockTerraform; }
@ -137,7 +137,6 @@ namespace OpenSim.Framework
}
private bool m_BlockFly = false;
public bool BlockFly
{
get { return m_BlockFly; }
@ -145,7 +144,6 @@ namespace OpenSim.Framework
}
private bool m_AllowDamage = false;
public bool AllowDamage
{
get { return m_AllowDamage; }
@ -153,7 +151,6 @@ namespace OpenSim.Framework
}
private bool m_RestrictPushing = false;
public bool RestrictPushing
{
get { return m_RestrictPushing; }
@ -161,7 +158,6 @@ namespace OpenSim.Framework
}
private bool m_AllowLandResell = true;
public bool AllowLandResell
{
get { return m_AllowLandResell; }
@ -169,7 +165,6 @@ namespace OpenSim.Framework
}
private bool m_AllowLandJoinDivide = true;
public bool AllowLandJoinDivide
{
get { return m_AllowLandJoinDivide; }
@ -177,7 +172,6 @@ namespace OpenSim.Framework
}
private bool m_BlockShowInSearch = false;
public bool BlockShowInSearch
{
get { return m_BlockShowInSearch; }
@ -185,7 +179,6 @@ namespace OpenSim.Framework
}
private int m_AgentLimit = 40;
public int AgentLimit
{
get { return m_AgentLimit; }
@ -193,7 +186,6 @@ namespace OpenSim.Framework
}
private double m_ObjectBonus = 1.0;
public double ObjectBonus
{
get { return m_ObjectBonus; }
@ -201,7 +193,6 @@ namespace OpenSim.Framework
}
private int m_Maturity = 0;
public int Maturity
{
get { return m_Maturity; }
@ -209,7 +200,6 @@ namespace OpenSim.Framework
}
private bool m_DisableScripts = false;
public bool DisableScripts
{
get { return m_DisableScripts; }
@ -217,7 +207,6 @@ namespace OpenSim.Framework
}
private bool m_DisableCollisions = false;
public bool DisableCollisions
{
get { return m_DisableCollisions; }
@ -225,7 +214,6 @@ namespace OpenSim.Framework
}
private bool m_DisablePhysics = false;
public bool DisablePhysics
{
get { return m_DisablePhysics; }
@ -289,7 +277,6 @@ namespace OpenSim.Framework
}
private double m_Elevation1NW = 10;
public double Elevation1NW
{
get { return m_Elevation1NW; }
@ -297,7 +284,6 @@ namespace OpenSim.Framework
}
private double m_Elevation2NW = 60;
public double Elevation2NW
{
get { return m_Elevation2NW; }
@ -305,7 +291,6 @@ namespace OpenSim.Framework
}
private double m_Elevation1NE = 10;
public double Elevation1NE
{
get { return m_Elevation1NE; }
@ -313,7 +298,6 @@ namespace OpenSim.Framework
}
private double m_Elevation2NE = 60;
public double Elevation2NE
{
get { return m_Elevation2NE; }
@ -321,7 +305,6 @@ namespace OpenSim.Framework
}
private double m_Elevation1SE = 10;
public double Elevation1SE
{
get { return m_Elevation1SE; }
@ -329,7 +312,6 @@ namespace OpenSim.Framework
}
private double m_Elevation2SE = 60;
public double Elevation2SE
{
get { return m_Elevation2SE; }
@ -337,7 +319,6 @@ namespace OpenSim.Framework
}
private double m_Elevation1SW = 10;
public double Elevation1SW
{
get { return m_Elevation1SW; }
@ -345,7 +326,6 @@ namespace OpenSim.Framework
}
private double m_Elevation2SW = 60;
public double Elevation2SW
{
get { return m_Elevation2SW; }
@ -353,7 +333,6 @@ namespace OpenSim.Framework
}
private double m_WaterHeight = 20;
public double WaterHeight
{
get { return m_WaterHeight; }
@ -361,7 +340,6 @@ namespace OpenSim.Framework
}
private double m_TerrainRaiseLimit = 100;
public double TerrainRaiseLimit
{
get { return m_TerrainRaiseLimit; }
@ -369,7 +347,6 @@ namespace OpenSim.Framework
}
private double m_TerrainLowerLimit = -100;
public double TerrainLowerLimit
{
get { return m_TerrainLowerLimit; }
@ -377,7 +354,6 @@ namespace OpenSim.Framework
}
private bool m_UseEstateSun = true;
public bool UseEstateSun
{
get { return m_UseEstateSun; }
@ -385,23 +361,19 @@ namespace OpenSim.Framework
}
private bool m_Sandbox = false;
public bool Sandbox
{
get { return m_Sandbox; }
set { m_Sandbox = value; }
}
private Vector3 m_SunVector;
public Vector3 SunVector
{
get { return m_SunVector; }
set { m_SunVector = value; }
get { return Vector3.Zero; }
set { }
}
private UUID m_ParcelImageID;
public UUID ParcelImageID
{
get { return m_ParcelImageID; }
@ -409,27 +381,22 @@ namespace OpenSim.Framework
}
private UUID m_TerrainImageID;
public UUID TerrainImageID
{
get { return m_TerrainImageID; }
set { m_TerrainImageID = value; }
}
private bool m_FixedSun = false;
public bool FixedSun
{
get { return m_FixedSun; }
set { m_FixedSun = value; }
get { return false; }
set { }
}
private double m_SunPosition = 0.0;
public double SunPosition
{
get { return m_SunPosition; }
set { m_SunPosition = value; }
get { return 0; }
set { }
}
private UUID m_Covenant = UUID.Zero;

View File

@ -32,6 +32,7 @@ using System.Net;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using log4net;
@ -117,8 +118,7 @@ namespace OpenSim.Framework
/// <summary>
/// Default Buffer size of a block requested from the web-server
/// </summary>
private const int BufferSize = 4096; // Read blocks of 4 KB.
private const int BufferSize = 4 * 4096; // Read blocks of 4 * 4 KB.
/// <summary>
/// if an exception occours during async processing, we need to save it, so it can be
@ -181,10 +181,7 @@ namespace OpenSim.Framework
/// <param name="element">path entry</param>
public void AddResourcePath(string element)
{
if (isSlashed(element))
_pathElements.Add(element.Substring(0, element.Length - 1));
else
_pathElements.Add(element);
_pathElements.Add(Util.TrimEndSlash(element));
}
/// <summary>
@ -237,16 +234,6 @@ namespace OpenSim.Framework
set { _method = value; }
}
/// <summary>
/// True if string contains a trailing slash '/'
/// </summary>
/// <param name="s">string to be examined</param>
/// <returns>true if slash is present</returns>
private static bool isSlashed(string s)
{
return s.Substring(s.Length - 1, 1) == "/";
}
/// <summary>
/// Build a Uri based on the initial Url, path elements and parameters
/// </summary>
@ -339,9 +326,8 @@ namespace OpenSim.Framework
lock (_lock)
{
_request = (HttpWebRequest) WebRequest.Create(buildUri());
_request.KeepAlive = false;
_request.ContentType = "application/xml";
_request.Timeout = 200000;
_request.Timeout = 90000;
_request.Method = RequestMethod;
_asyncException = null;
if (auth != null)
@ -351,8 +337,6 @@ namespace OpenSim.Framework
if (WebUtil.DebugLevel >= 3)
m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
try
{
using (_response = (HttpWebResponse) _request.GetResponse())
@ -365,12 +349,6 @@ namespace OpenSim.Framework
_resource.Write(_readbuf, 0, length);
length = src.Read(_readbuf, 0, BufferSize);
}
// TODO! Implement timeout, without killing the server
// this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
//ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
// _allDone.WaitOne();
}
}
}
@ -391,7 +369,6 @@ namespace OpenSim.Framework
return null;
}
if (_asyncException != null)
throw _asyncException;
@ -408,81 +385,53 @@ namespace OpenSim.Framework
}
}
public Stream Request(Stream src, IServiceAuth auth)
// just post data, ignoring result
public async Task AsyncPOSTRequest(byte[] src, IServiceAuth auth)
{
_request = (HttpWebRequest)WebRequest.Create(buildUri());
_request.KeepAlive = false;
_request.ContentType = "application/xml";
_request.Timeout = 90000;
_request.Method = RequestMethod;
_request.Method = "POST";
_asyncException = null;
_request.ContentLength = src.Length;
if (auth != null)
auth.AddAuthorization(_request.Headers);
src.Seek(0, SeekOrigin.Begin);
int reqnum = WebUtil.RequestNumber++;
if (WebUtil.DebugLevel >= 3)
m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
if (WebUtil.DebugLevel >= 5)
WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src);
try
{
using (Stream dst = _request.GetRequestStream())
{
// m_log.Debug("[REST]: GetRequestStream is ok");
byte[] buf = new byte[1024];
int length = src.Read(buf, 0, 1024);
// m_log.Debug("[REST]: First Read is ok");
while (length > 0)
{
dst.Write(buf, 0, length);
length = src.Read(buf, 0, 1024);
}
await dst.WriteAsync(src, 0, src.Length).ConfigureAwait(false);
}
_response = (HttpWebResponse)_request.GetResponse();
}
catch (WebException e)
using(HttpWebResponse response = (HttpWebResponse)await _request.GetResponseAsync().ConfigureAwait(false))
{
m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}",
RequestMethod, _request.RequestUri, e.Status, e.Message);
return null;
}
catch (Exception e)
{
m_log.WarnFormat(
"[REST]: Request {0} {1} failed with exception {2} {3}",
RequestMethod, _request.RequestUri, e.Message, e.StackTrace);
return null;
}
if (WebUtil.DebugLevel >= 5)
{
using (Stream responseStream = _response.GetResponseStream())
using (Stream responseStream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(responseStream))
{
string responseStr = reader.ReadToEnd();
string responseStr = await reader.ReadToEndAsync().ConfigureAwait(false);
WebUtil.LogResponseDetail(reqnum, responseStr);
}
}
}
if (_response != null)
_response.Close();
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
// TODO! Implement timeout, without killing the server
// this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
//ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
return null;
}
}
catch (WebException e)
{
m_log.WarnFormat("[REST]: AsyncPOST {0} failed with status {1} and message {2}",
_request.RequestUri, e.Status, e.Message);
return;
}
catch (Exception e)
{
m_log.WarnFormat("[REST]: AsyncPOST {0} failed with exception {1} {2}",
_request.RequestUri, e.Message, e.StackTrace);
return;
}
}
#region Async Invocation

View File

@ -28,6 +28,7 @@
using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.Globalization;
namespace OpenSim.Framework
{
@ -44,7 +45,6 @@ namespace OpenSim.Framework
Material = -2
}
#region SL / file extension / content-type conversions
/// <summary>
@ -190,6 +190,56 @@ namespace OpenSim.Framework
private static Dictionary<sbyte, string> inventory2Content;
private static Dictionary<string, sbyte> content2Asset;
private static Dictionary<string, sbyte> content2Inventory;
private static Dictionary<string, AssetType> name2Asset = new Dictionary<string, AssetType>()
{
{"texture", AssetType.Texture },
{"sound", AssetType.Sound},
{"callcard", AssetType.CallingCard},
{"landmark", AssetType.Landmark},
{"script", (AssetType)4},
{"clothing", AssetType.Clothing},
{"object", AssetType.Object},
{"notecard", AssetType.Notecard},
{"category", AssetType.Folder},
{"lsltext", AssetType.LSLText},
{"lslbyte", AssetType.LSLBytecode},
{"txtr_tga", AssetType.TextureTGA},
{"bodypart", AssetType.Bodypart},
{"snd_wav", AssetType.SoundWAV},
{"img_tga", AssetType.ImageTGA},
{"jpeg", AssetType.ImageJPEG},
{"animatn", AssetType.Animation},
{"gesture", AssetType.Gesture},
{"simstate", AssetType.Simstate},
{"mesh", AssetType.Mesh},
{"settings", AssetType.Settings}
};
private static Dictionary<string, FolderType> name2Inventory = new Dictionary<string, FolderType>()
{
{"texture", FolderType.Texture},
{"sound", FolderType.Sound},
{"callcard", FolderType.CallingCard},
{"landmark", FolderType.Landmark},
{"script", (FolderType)4},
{"clothing", FolderType.Clothing},
{"object", FolderType.Object},
{"notecard", FolderType.Notecard},
{"root", FolderType.Root},
{"lsltext", FolderType.LSLText},
{"bodypart", FolderType.BodyPart},
{"trash", FolderType.Trash},
{"snapshot", FolderType.Snapshot},
{"lostandfound", FolderType.LostAndFound},
{"animatn", FolderType.Animation},
{"gesture", FolderType.Gesture},
{"favorites", FolderType.Favorites},
{"currentoutfit", FolderType.CurrentOutfit},
{"outfit", FolderType.Outfit},
{"myoutfits", FolderType.MyOutfits},
{"mesh", FolderType.Mesh},
{"settings", FolderType.Settings},
{"suitcase", FolderType.Suitcase}
};
static SLUtil()
{
@ -227,6 +277,20 @@ namespace OpenSim.Framework
}
}
public static AssetType SLAssetName2Type(string name)
{
if (name2Asset.TryGetValue(name, out AssetType type))
return type;
return AssetType.Unknown;
}
public static FolderType SLInvName2Type(string name)
{
if (name2Inventory.TryGetValue(name, out FolderType type))
return type;
return FolderType.None;
}
public static string SLAssetTypeToContentType(int assetType)
{
string contentType;
@ -269,270 +333,364 @@ namespace OpenSim.Framework
#endregion SL / file extension / content-type conversions
private class NotecardReader
{
private string rawInput;
private int lineNumber;
static char[] seps = new char[] { '\t', '\n' };
static char[] stringseps = new char[] { '|', '\n' };
public int LineNumber
static byte[] moronize = new byte[16]
{
get
60, 17, 94, 81, 4, 244, 82, 60, 159, 166, 152, 175, 241, 3, 71, 48
};
static int getField(string note, int start, string name, bool isString, out string value)
{
return lineNumber;
}
value = String.Empty;
int end = -1;
int limit = note.Length - start;
if (limit > 64)
limit = 64;
int indx = note.IndexOf(name, start, limit);
if (indx < 0)
return -1;
indx += name.Length + 1; // eat \t
limit = note.Length - indx - 2;
if (limit > 129)
limit = 129;
if (isString)
end = note.IndexOfAny(stringseps, indx, limit);
else
end = note.IndexOfAny(seps, indx, limit);
if (end < 0)
return -1;
value = note.Substring(indx, end - indx);
return end;
}
public NotecardReader(string _rawInput)
private static UUID deMoronize(UUID id)
{
rawInput = (string)_rawInput.Clone();
lineNumber = 0;
byte[] data = new byte[16];
id.ToBytes(data,0);
for(int i = 0; i < 16; ++i)
data[i] ^= moronize[i];
return new UUID(data,0);
}
public string getLine()
public static InventoryItemBase GetEmbeddedItem(byte[] data, UUID itemID)
{
if(rawInput.Length == 0)
{
throw new NotANotecardFormatException(lineNumber + 1);
}
if(data == null || data.Length < 300)
return null;
int pos = rawInput.IndexOf('\n');
if(pos < 0)
{
pos = rawInput.Length;
}
string note = Util.UTF8.GetString(data);
if (String.IsNullOrWhiteSpace(note))
return null;
/* cut line from rest */
++lineNumber;
string line = rawInput.Substring(0, pos);
if (pos + 1 >= rawInput.Length)
// waste some time checking rigid versions
string version = note.Substring(0,21);
if (!version.Equals("Linden text version 2"))
return null;
version = note.Substring(24, 25);
if (!version.Equals("LLEmbeddedItems version 1"))
return null;
int indx = note.IndexOf(itemID.ToString(), 100);
if (indx < 0)
return null;
indx = note.IndexOf("permissions", indx, 100); // skip parentID
if (indx < 0)
return null;
string valuestr;
indx = getField(note, indx, "base_mask", false, out valuestr);
if (indx < 0)
return null;
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint basemask))
return null;
indx = getField(note, indx, "owner_mask", false, out valuestr);
if (indx < 0)
return null;
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint ownermask))
return null;
indx = getField(note, indx, "group_mask", false, out valuestr);
if (indx < 0)
return null;
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint groupmask))
return null;
indx = getField(note, indx, "everyone_mask", false, out valuestr);
if (indx < 0)
return null;
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint everyonemask))
return null;
indx = getField(note, indx, "next_owner_mask", false, out valuestr);
if (indx < 0)
return null;
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint nextownermask))
return null;
indx = getField(note, indx, "creator_id", false, out valuestr);
if (indx < 0)
return null;
if (!UUID.TryParse(valuestr, out UUID creatorID))
return null;
indx = getField(note, indx, "owner_id", false, out valuestr);
if (indx < 0)
return null;
if (!UUID.TryParse(valuestr, out UUID ownerID))
return null;
int limit = note.Length - indx;
if (limit > 120)
limit = 120;
indx = note.IndexOf('}', indx, limit); // last owner
if (indx < 0)
return null;
int curindx = indx;
UUID assetID = UUID.Zero;
indx = getField(note, indx, "asset_id", false, out valuestr);
if (indx < 0)
{
rawInput = string.Empty;
indx = getField(note, curindx, "shadow_id", false, out valuestr);
if (indx < 0)
return null;
if (!UUID.TryParse(valuestr, out assetID))
return null;
assetID = deMoronize(assetID);
}
else
{
rawInput = rawInput.Substring(pos + 1);
}
/* clean up line from double spaces and tabs */
line = line.Replace("\t", " ");
while(line.IndexOf(" ") >= 0)
{
line = line.Replace(" ", " ");
}
return line.Replace("\r", "").Trim();
if (!UUID.TryParse(valuestr, out assetID))
return null;
}
public string getBlock(int length)
{
/* cut line from rest */
if(length > rawInput.Length)
{
throw new NotANotecardFormatException(lineNumber);
}
string line = rawInput.Substring(0, length);
rawInput = rawInput.Substring(length);
return line;
}
indx = getField(note, indx, "type", false, out valuestr);
if (indx < 0)
return null;
AssetType assetType = SLAssetName2Type(valuestr);
indx = getField(note, indx, "inv_type", false, out valuestr);
if (indx < 0)
return null;
FolderType invType = SLInvName2Type(valuestr);
indx = getField(note, indx, "flags", false, out valuestr);
if (indx < 0)
return null;
if (!uint.TryParse(valuestr, NumberStyles.HexNumber, Culture.NumberFormatInfo, out uint flags))
return null;
limit = note.Length - indx;
if (limit > 120)
limit = 120;
indx = note.IndexOf('}', indx, limit); // skip sale
if (indx < 0)
return null;
indx = getField(note, indx, "name", true, out valuestr);
if (indx < 0)
return null;
string name = valuestr;
indx = getField(note, indx, "desc", true, out valuestr);
if (indx < 0)
return null;
string desc = valuestr;
InventoryItemBase item = new InventoryItemBase();
item.AssetID = assetID;
item.AssetType = (sbyte)assetType;
item.BasePermissions = basemask;
item.CreationDate = Util.UnixTimeSinceEpoch();
item.CreatorData = "";
item.CreatorId = creatorID.ToString();
item.CurrentPermissions = ownermask;
item.Description = desc;
item.Flags = flags;
item.Folder = UUID.Zero;
item.GroupID = UUID.Zero;
item.GroupOwned = false;
item.GroupPermissions = groupmask;
item.InvType = (sbyte)invType;
item.Name = name;
item.NextPermissions = nextownermask;
item.Owner = ownerID;
item.SalePrice = 0;
item.SaleType = (byte)SaleType.Not;
item.ID = UUID.Random();
return item;
}
public class NotANotecardFormatException : Exception
public static List<UUID> GetEmbeddedAssetIDs(byte[] data)
{
public int lineNumber;
public NotANotecardFormatException(int _lineNumber)
: base()
{
lineNumber = _lineNumber;
}
}
if (data == null || data.Length < 79)
return null;
private static void skipSection(NotecardReader reader)
{
if (reader.getLine() != "{")
throw new NotANotecardFormatException(reader.LineNumber);
string note = Util.UTF8.GetString(data);
if (String.IsNullOrWhiteSpace(note))
return null;
string line;
while ((line = reader.getLine()) != "}")
{
if(line.IndexOf('{')>=0)
{
throw new NotANotecardFormatException(reader.LineNumber);
}
}
}
// waste some time checking rigid versions
string tmpStr = note.Substring(0, 21);
if (!tmpStr.Equals("Linden text version 2"))
return null;
private static void skipInventoryItem(NotecardReader reader)
{
if (reader.getLine() != "{")
throw new NotANotecardFormatException(reader.LineNumber);
tmpStr = note.Substring(24, 25);
if (!tmpStr.Equals("LLEmbeddedItems version 1"))
return null;
string line;
while((line = reader.getLine()) != "}")
{
string[] data = line.Split(' ');
if(data.Length == 0)
{
continue;
}
if(data[0] == "permissions")
{
skipSection(reader);
}
else if(data[0] == "sale_info")
{
skipSection(reader);
}
else if (line.IndexOf('{') >= 0)
{
throw new NotANotecardFormatException(reader.LineNumber);
}
}
}
tmpStr = note.Substring(52,5);
if (!tmpStr.Equals("count"))
return null;
private static void skipInventoryItems(NotecardReader reader)
{
if(reader.getLine() != "{")
{
throw new NotANotecardFormatException(reader.LineNumber);
}
int limit = note.Length - 57 - 2;
if (limit > 8)
limit = 8;
string line;
while((line = reader.getLine()) != "}")
{
string[] data = line.Split(' ');
if(data.Length == 0)
{
continue;
}
int indx = note.IndexOfAny(seps, 57, limit);
if(indx < 0)
return null;
if(data[0] == "inv_item")
{
skipInventoryItem(reader);
}
else if (line.IndexOf('{') >= 0)
{
throw new NotANotecardFormatException(reader.LineNumber);
}
if (!int.TryParse(note.Substring(57, indx - 57), out int count))
return null;
}
}
List<UUID> ids = new List<UUID>();
while(count > 0)
{
string valuestr;
UUID assetID = UUID.Zero;
indx = note.IndexOf('}',indx); // skip to end of permissions
if (indx < 0)
return null;
private static void skipInventory(NotecardReader reader)
int curindx = indx;
indx = getField(note, indx, "asset_id", false, out valuestr);
if (indx < 0)
{
if (reader.getLine() != "{")
throw new NotANotecardFormatException(reader.LineNumber);
string line;
while((line = reader.getLine()) != "}")
{
string[] data = line.Split(' ');
if(data[0] == "count")
{
int count = Int32.Parse(data[1]);
for(int i = 0; i < count; ++i)
{
skipInventoryItems(reader);
}
}
else if (line.IndexOf('{') >= 0)
{
throw new NotANotecardFormatException(reader.LineNumber);
}
}
}
private static string readNotecardText(NotecardReader reader)
{
if (reader.getLine() != "{")
throw new NotANotecardFormatException(reader.LineNumber);
string notecardString = string.Empty;
string line;
while((line = reader.getLine()) != "}")
{
string[] data = line.Split(' ');
if (data.Length == 0)
{
continue;
}
if (data[0] == "LLEmbeddedItems")
{
skipInventory(reader);
}
else if(data[0] == "Text" && data.Length == 3)
{
int length = Int32.Parse(data[2]);
notecardString = reader.getBlock(length);
}
else if (line.IndexOf('{') >= 0)
{
throw new NotANotecardFormatException(reader.LineNumber);
}
}
return notecardString;
}
private static string readNotecard(byte[] rawInput)
{
string rawIntermedInput = string.Empty;
/* make up a Raw Encoding here */
foreach(byte c in rawInput)
{
char d = (char)c;
rawIntermedInput += d;
}
NotecardReader reader = new NotecardReader(rawIntermedInput);
string line;
try
{
line = reader.getLine();
}
catch(Exception)
{
return System.Text.Encoding.UTF8.GetString(rawInput);
}
string[] versioninfo = line.Split(' ');
if(versioninfo.Length < 3)
{
return System.Text.Encoding.UTF8.GetString(rawInput);
}
else if(versioninfo[0] != "Linden" || versioninfo[1] != "text")
{
return System.Text.Encoding.UTF8.GetString(rawInput);
indx = getField(note, curindx, "shadow_id", false, out valuestr);
if (indx < 0)
return null;
if (!UUID.TryParse(valuestr, out assetID))
return null;
assetID = deMoronize(assetID);
}
else
{
/* now we actually decode the Encoding, before we needed it in raw */
string o = readNotecardText(reader);
byte[] a = new byte[o.Length];
for(int i = 0; i < o.Length; ++i)
if (!UUID.TryParse(valuestr, out assetID))
return null;
}
ids.Add(assetID);
indx = note.IndexOf('}', indx); // skip to end of sale
if (indx < 0)
return null;
indx = getField(note, indx, "name", false, out valuestr); // avoid name contents
if (indx < 0)
return null;
indx = getField(note, indx, "desc", false, out valuestr); // avoid desc contents
if (indx < 0)
return null;
if(count > 1)
{
a[i] = (byte)o[i];
indx = note.IndexOf("ext char index", indx); // skip to next
if (indx < 0)
return null;
}
return System.Text.Encoding.UTF8.GetString(a);
--count;
}
indx = note.IndexOf("Text length",indx);
if(indx > 0)
{
indx += 14;
List<UUID> textIDs = Util.GetUUIDsOnString(ref note, indx, note.Length - indx);
if(textIDs.Count > 0)
ids.AddRange(textIDs);
}
if (ids.Count == 0)
return null;
return ids;
}
/// <summary>
/// Parse a notecard in Linden format to a string of ordinary text.
/// Parse a notecard in Linden format to a list of ordinary lines for LSL
/// </summary>
/// <param name="rawInput"></param>
/// <returns></returns>
public static string ParseNotecardToString(byte[] rawInput)
{
return readNotecard(rawInput);
}
/// <summary>
/// Parse a notecard in Linden format to a list of ordinary lines.
/// </summary>
/// <param name="rawInput"></param>
/// <returns></returns>
public static string[] ParseNotecardToArray(byte[] rawInput)
public static string[] ParseNotecardToArray(byte[] data)
{
return readNotecard(rawInput).Replace("\r", "").Split('\n');
// check of a valid notecard
if (data == null || data.Length < 79)
return new string[0];
//LSL can't read notecards with embedded items
if (data[58] != '0' || data[59] != '\n')
return new string[0];
string note = Util.UTF8.GetString(data);
if (String.IsNullOrWhiteSpace(note))
return new string[0];
// waste some time checking rigid versions
string tmpStr = note.Substring(0, 21);
if (!tmpStr.Equals("Linden text version 2"))
return new string[0];
tmpStr = note.Substring(24, 25);
if (!tmpStr.Equals("LLEmbeddedItems version 1"))
return new string[0];
tmpStr = note.Substring(52, 5);
if (!tmpStr.Equals("count"))
return new string[0];
int indx = note.IndexOf("Text length", 60);
if(indx < 0)
return new string[0];
indx += 12;
int end = indx + 1;
for (; end < note.Length && note[end] != '\n'; ++end);
if (note[end] != '\n')
return new string[0];
tmpStr = note.Substring(indx, end - indx);
if (!int.TryParse(tmpStr, out int textLen) || textLen == 0)
return new string[0];
indx = end + 1;
if (textLen + indx > data.Length)
return new string[0];
// yeackk
note = Util.UTF8.GetString(data, indx, textLen);
textLen = note.Length;
indx = 0;
var lines = new List<string>();
while (indx < textLen)
{
end = indx;
for (; end < textLen && note[end] != '\n'; ++end);
if(end == indx)
lines.Add(String.Empty);
else
lines.Add(note.Substring(indx, end - indx));
indx = end + 1;
}
// notes only seem to have one text section
if(lines.Count == 0)
return new string[0];
return lines.ToArray();
}
}
}

View File

@ -125,7 +125,8 @@ namespace OpenSim.Framework.Serialization
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = ASSET_EXTENSION_SEPARATOR + "sound.wav";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ASSET_EXTENSION_SEPARATOR + "texture.jp2";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ASSET_EXTENSION_SEPARATOR + "texture.tga";
ASSET_TYPE_TO_EXTENSION[(sbyte)OpenSimAssetType.Material] = ASSET_EXTENSION_SEPARATOR + "material.xml"; // Not sure if we'll ever see this
ASSET_TYPE_TO_EXTENSION[(sbyte)OpenSimAssetType.Material] = ASSET_EXTENSION_SEPARATOR + "material.xml";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Settings] = ASSET_EXTENSION_SEPARATOR + "settings.bin";
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "animation.bvh"] = (sbyte)AssetType.Animation;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bodypart.txt"] = (sbyte)AssetType.Bodypart;
@ -147,6 +148,7 @@ namespace OpenSim.Framework.Serialization
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.jp2"] = (sbyte)AssetType.Texture;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "material.xml"] = (sbyte)OpenSimAssetType.Material;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "settings.bin"] = (sbyte)AssetType.Settings;
}
public static string CreateOarLandDataPath(LandData ld)

View File

@ -400,13 +400,7 @@ namespace OpenSim.Framework.Serialization.External
/// <returns></returns>
public static string SanitizeXml(string xmlData)
{
string fixedData = xmlData;
if (fixedData != null)
// Loop, because it may contain multiple
while (fixedData.Contains("xmlns:xmlns:"))
fixedData = fixedData.Replace("xmlns:xmlns:", "xmlns:");
return fixedData;
}
return xmlData.Replace("xmlns:xmlns:", "xmlns:");
}
}
}

View File

@ -28,12 +28,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using System.Xml;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Framework.Serialization.External
{
@ -99,6 +97,9 @@ namespace OpenSim.Framework.Serialization.External
m_ldProcessors.Add(
"ParcelAccessList", ProcessParcelAccessList);
m_ldProcessors.Add(
"Environment", ProcessParcelEnvironment);
m_ldProcessors.Add(
"PassHours", (ld, xtr) => ld.PassHours = Convert.ToSingle(xtr.ReadElementString("PassHours")));
m_ldProcessors.Add(
@ -132,6 +133,14 @@ namespace OpenSim.Framework.Serialization.External
);
m_laeProcessors.Add(
"AccessList", (lae, xtr) => lae.Flags = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList")));
}
public static void ProcessParcelEnvironment(LandData ld, XmlReader xtr)
{
string senv = xtr.ReadElementString("Environment");
ld.Environment = ViewerEnvironment.FromOSDString(senv);
ld.EnvironmentVersion = ld.Environment.version;
}
public static void ProcessParcelAccessList(LandData ld, XmlReader xtr)
@ -255,6 +264,15 @@ namespace OpenSim.Framework.Serialization.External
xtw.WriteElementString("Dwell", "0");
xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime));
if(landData.Environment != null)
{
try
{
string senv = ViewerEnvironment.ToOSDString(landData.Environment);
xtw.WriteElementString("Environment", senv);
}
catch { }
}
xtw.WriteEndElement();
xtw.Close();

View File

@ -46,9 +46,10 @@ namespace OpenSim.Framework.Serialization.External
/// <param name="serializedSettings"></param>
/// <returns></returns>
/// <exception cref="System.Xml.XmlException"></exception>
public static RegionSettings Deserialize(byte[] serializedSettings)
public static RegionSettings Deserialize(byte[] serializedSettings, out ViewerEnvironment regionEnv)
{
return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length));
// encoding is wrong. old oars seem to be on utf-16
return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length), out regionEnv);
}
/// <summary>
@ -57,9 +58,10 @@ namespace OpenSim.Framework.Serialization.External
/// <param name="serializedSettings"></param>
/// <returns></returns>
/// <exception cref="System.Xml.XmlException"></exception>
public static RegionSettings Deserialize(string serializedSettings)
public static RegionSettings Deserialize(string serializedSettings, out ViewerEnvironment regionEnv)
{
RegionSettings settings = new RegionSettings();
regionEnv = null;
StringReader sr = new StringReader(serializedSettings);
XmlTextReader xtr = new XmlTextReader(sr);
@ -191,9 +193,12 @@ namespace OpenSim.Framework.Serialization.External
xtr.ReadEndElement();
if (xtr.IsStartElement("Telehub"))
{
if (xtr.IsEmptyElement)
xtr.Read();
else
{
xtr.ReadStartElement("Telehub");
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
{
switch (xtr.Name)
@ -208,6 +213,28 @@ namespace OpenSim.Framework.Serialization.External
break;
}
}
xtr.ReadEndElement();
}
}
if (xtr.IsStartElement("Environment"))
{
if (xtr.IsEmptyElement)
xtr.Read();
else
{
xtr.ReadStartElement("Environment");
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
{
switch (xtr.Name)
{
case "data":
regionEnv = ViewerEnvironment.FromOSDString(xtr.ReadElementContentAsString());
break;
}
}
xtr.ReadEndElement();
}
}
xtr.Close();
@ -216,7 +243,7 @@ namespace OpenSim.Framework.Serialization.External
return settings;
}
public static string Serialize(RegionSettings settings)
public static string Serialize(RegionSettings settings, ViewerEnvironment RegionEnv)
{
StringWriter sw = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(sw);
@ -263,8 +290,6 @@ namespace OpenSim.Framework.Serialization.External
xtw.WriteElementString("UseEstateSun", settings.UseEstateSun.ToString());
xtw.WriteElementString("FixedSun", settings.FixedSun.ToString());
xtw.WriteElementString("SunPosition", settings.SunPosition.ToString());
// Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which
// calculates it automatically according to the date and other factors.
xtw.WriteEndElement();
xtw.WriteStartElement("Telehub");
@ -276,6 +301,13 @@ namespace OpenSim.Framework.Serialization.External
}
xtw.WriteEndElement();
if (RegionEnv != null)
{
xtw.WriteStartElement("Environment");
xtw.WriteElementString("data", ViewerEnvironment.ToOSDString(RegionEnv));
xtw.WriteEndElement();
}
xtw.WriteEndElement();
xtw.Close();

View File

@ -130,7 +130,7 @@ namespace OpenSim.Framework.Serialization.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs);
RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs, out ViewerEnvironment dummy);
Assert.That(deserRs, Is.Not.Null);
Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2));
Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics));

View File

@ -190,8 +190,15 @@ namespace OpenSim.Framework.Servers
//m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
m_log.InfoFormat(
"[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32");
Environment.OSVersion, Environment.OSVersion.Platform, Environment.Is64BitProcess ? "64" : "32");
// next code can be changed on .net 4.7.x
if(Util.IsWindows())
m_log.InfoFormat("[STARTUP]: Processor Architecture: {0}({1})",
System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE", EnvironmentVariableTarget.Machine),
BitConverter.IsLittleEndian ?"le":"be");
// on other platforms we need to wait for .net4.7.1
try
{
StartupSpecific();

File diff suppressed because it is too large Load Diff

View File

@ -62,24 +62,6 @@ namespace OpenSim.Framework.Servers.HttpServer
Description = description;
m_httpMethod = httpMethod;
m_path = path;
// FIXME: A very temporary measure to stop the simulator stats being overwhelmed with user CAPS info.
// Needs to be fixed properly in stats display
if (!path.StartsWith("/CAPS/"))
{
StatsManager.RegisterStat(
new Stat(
"requests",
"requests",
"Number of requests received by this service endpoint",
"requests",
"service",
string.Format("{0}:{1}", httpMethod, path),
StatType.Pull,
MeasuresOfInterest.AverageChangeOverTime,
s => s.Value = RequestsReceived,
StatVerbosity.Debug));
}
}
public virtual string Path

View File

@ -47,30 +47,23 @@ namespace OpenSim.Framework.Servers.HttpServer
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] data = ReadFully(request);
byte[] data;
if (request is MemoryStream)
data = ((MemoryStream)request).ToArray();
else
{
request.Seek(0, SeekOrigin.Begin);
using (MemoryStream ms = new MemoryStream((int)request.Length))
{
request.CopyTo(ms);
data = ms.ToArray();
}
}
request.Dispose();
string param = GetParam(path);
string responseString = m_method(data, path, param);
return Encoding.UTF8.GetBytes(responseString);
}
private static byte[] ReadFully(Stream stream)
{
byte[] buffer = new byte[1024];
using (MemoryStream ms = new MemoryStream(1024*256))
{
while (true)
{
int read = stream.Read(buffer, 0, buffer.Length);
if (read <= 0)
{
return ms.ToArray();
}
ms.Write(buffer, 0, read);
}
}
}
}
}

View File

@ -78,7 +78,11 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </returns>
bool AddHTTPHandler(string methodName, GenericHTTPMethod handler);
bool AddPollServiceHTTPHandler(string methodName, PollServiceEventArgs args);
bool AddPollServiceHTTPHandler(string uripath, PollServiceEventArgs args);
bool AddPollServiceHTTPHandler(PollServiceEventArgs args);
void RemovePollServiceHTTPHandler(string url, string path);
void RemovePollServiceHTTPHandler(string path);
/// <summary>
/// Adds a LLSD handler, yay.
@ -93,6 +97,7 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </summary>
/// <param name="handler"></param>
void AddStreamHandler(IRequestHandler handler);
void AddSimpleStreamHandler(ISimpleStreamHandler handler, bool varPath = false);
bool AddXmlRPCHandler(string method, XmlRpcMethod handler);
bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive);
@ -133,18 +138,19 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <param name="path"></param>
void RemoveHTTPHandler(string httpMethod, string path);
void RemovePollServiceHTTPHandler(string httpMethod, string path);
bool RemoveLLSDHandler(string path, LLSDMethod handler);
void RemoveStreamHandler(string httpMethod, string path);
void RemoveSimpleStreamHandler(string path);
void RemoveXmlRPCHandler(string method);
void RemoveJsonRPCHandler(string method);
string GetHTTP404(string host);
string GetHTTP500();
string GetHTTP404();
void AddIndexPHPMethodHandler(string key, SimpleStreamMethod sh);
void RemoveIndexPHPMethodHandler(string key);
SimpleStreamMethod TryGetIndexPHPMethodHandler(string key);
}
}

View File

@ -27,6 +27,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Net;
@ -51,9 +52,14 @@ namespace OpenSim.Framework.Servers.HttpServer
bool KeepAlive { get; }
NameValueCollection QueryString { get; }
Hashtable Query { get; }
HashSet<string> QueryFlags { get; }
Dictionary<string, string> QueryAsDictionary { get; } //faster than Query
string RawUrl { get; }
IPEndPoint RemoteIPEndPoint { get; }
IPEndPoint LocalIPEndPoint { get; }
Uri Url { get; }
string UriPath { get; }
string UserAgent { get; }
double ArrivalTS { get; }
}
}

View File

@ -92,17 +92,16 @@ namespace OpenSim.Framework.Servers.HttpServer
Stream OutputStream { get; }
string ProtocolVersion { get; set; }
int Priority { get; set; }
byte[] RawBuffer { get; set; }
int RawBufferStart { get; set; }
int RawBufferLen { get; set; }
/// <summary>
/// Return the output stream feeding the body.
/// </summary>
Stream Body { get; }
/// <summary>
/// Set a redirct location.
/// </summary>
string RedirectLocation { set; }
/// <summary>
/// Chunk transfers.
/// </summary>
@ -118,6 +117,8 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </summary>
string StatusDescription { get; set; }
double RequestTS { get; }
/// <summary>
/// Add a header field and content to the response.
/// </summary>

View File

@ -27,6 +27,7 @@
using System.Collections;
using System.IO;
using OpenMetaverse.StructuredData;
namespace OpenSim.Framework.Servers.HttpServer
{
@ -88,4 +89,20 @@ namespace OpenSim.Framework.Servers.HttpServer
{
Hashtable Handle(string path, Hashtable request);
}
public interface ISimpleStreamHandler
{
string Name { get; }
string Path { get; }
int RequestsReceived { get; }
int RequestsHandled { get; }
// Handle request stream, return byte array
void Handle(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
}
public delegate void SimpleStreamMethod(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
public delegate void SimpleOSDMapMethod(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap args);
public delegate void SimpleBinaryMethod(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, byte[] data);
}

View File

@ -1,183 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
namespace OpenSim.Framework.Servers.HttpServer
{
/// <sumary>
/// Any OSHttpHandler must return one of the following results:
/// <list type = "table">
/// <listheader>
/// <term>result code</term>
/// <description>meaning</description>
/// </listheader>
/// <item>
/// <term>Pass</term>
/// <description>handler did not process the request</request>
/// </item>
/// <item>
/// <term>Done</term>
/// <description>handler did process the request, OSHttpServer
/// can clean up and close the request</request>
/// </item>
/// </list>
/// </summary>
public enum OSHttpHandlerResult
{
Unprocessed,
Pass,
Done,
}
/// <summary>
/// An OSHttpHandler that matches on the "content-type" header can
/// supply an OSHttpContentTypeChecker delegate which will be
/// invoked by the request matcher in OSHttpRequestPump.
/// </summary>
/// <returns>true if the handler is interested in the content;
/// false otherwise</returns>
public delegate bool OSHttpContentTypeChecker(OSHttpRequest req);
public abstract class OSHttpHandler
{
/// <summary>
/// Regular expression used to match against method of
/// the incoming HTTP request. If you want to match any string
/// either use '.*' or null. To match on the empty string use
/// '^$'.
/// </summary>
public virtual Regex Method
{
get { return _method; }
}
protected Regex _method;
/// <summary>
/// Regular expression used to match against path of the
/// incoming HTTP request. If you want to match any string
/// either use '.*' or null. To match on the empty string use
/// '^$'.
/// </summary>
public virtual Regex Path
{
get { return _path; }
}
protected Regex _path;
/// <summary>
/// Dictionary of (query name, regular expression) tuples,
/// allowing us to match on URI query fields.
/// </summary>
public virtual Dictionary<string, Regex> Query
{
get { return _query; }
}
protected Dictionary<string, Regex> _query;
/// <summary>
/// Dictionary of (header name, regular expression) tuples,
/// allowing us to match on HTTP header fields.
/// </summary>
public virtual Dictionary<string, Regex> Headers
{
get { return _headers; }
}
protected Dictionary<string, Regex> _headers;
/// <summary>
/// Dictionary of (header name, regular expression) tuples,
/// allowing us to match on HTTP header fields.
/// </summary>
/// <remarks>
/// This feature is currently not implemented as it requires
/// (trivial) changes to HttpServer.HttpListener that have not
/// been implemented.
/// </remarks>
public virtual Regex IPEndPointWhitelist
{
get { return _ipEndPointRegex; }
}
protected Regex _ipEndPointRegex;
/// <summary>
/// Base class constructor.
/// </summary>
/// <param name="path">null or path regex</param>
/// <param name="headers">null or dictionary of header
/// regexs</param>
/// <param name="contentType">null or content type
/// regex</param>
/// <param name="whitelist">null or IP address regex</param>
public OSHttpHandler(Regex method, Regex path, Dictionary<string, Regex> query,
Dictionary<string, Regex> headers, Regex contentType, Regex whitelist)
{
_method = method;
_path = path;
_query = query;
_ipEndPointRegex = whitelist;
if (null == _headers && null != contentType)
{
_headers = new Dictionary<string, Regex>();
_headers.Add("content-type", contentType);
}
}
/// <summary>
/// Process an incoming OSHttpRequest that matched our
/// requirements.
/// </summary>
/// <returns>
/// OSHttpHandlerResult.Pass if we are after all not
/// interested in the request; OSHttpHandlerResult.Done if we
/// did process the request.
/// </returns>
public abstract OSHttpHandlerResult Process(OSHttpRequest request);
public override string ToString()
{
StringWriter sw = new StringWriter();
sw.WriteLine("{0}", base.ToString());
sw.WriteLine(" method regex {0}", null == Method ? "null" : Method.ToString());
sw.WriteLine(" path regex {0}", null == Path ? "null": Path.ToString());
foreach (string tag in Headers.Keys)
{
sw.WriteLine(" header {0} : {1}", tag, Headers[tag].ToString());
}
sw.WriteLine(" IP whitelist {0}", null == IPEndPointWhitelist ? "null" : IPEndPointWhitelist.ToString());
sw.WriteLine();
sw.Close();
return sw.ToString();
}
}
}

View File

@ -1,145 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using log4net;
using Nwc.XmlRpc;
namespace OpenSim.Framework.Servers.HttpServer
{
public delegate XmlRpcResponse OSHttpHttpProcessor(XmlRpcRequest request);
public class OSHttpHttpHandler: OSHttpHandler
{
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// contains handler for processing HTTP Request
private GenericHTTPMethod _handler;
/// <summary>
/// Instantiate an HTTP handler.
/// </summary>
/// <param name="handler">a GenericHTTPMethod</param>
/// <param name="method">null or HTTP method regex</param>
/// <param name="path">null or path regex</param>
/// <param name="query">null or dictionary with query regexs</param>
/// <param name="headers">null or dictionary with header
/// regexs</param>
/// <param name="whitelist">null or IP address whitelist</param>
public OSHttpHttpHandler(GenericHTTPMethod handler, Regex method, Regex path,
Dictionary<string, Regex> query,
Dictionary<string, Regex> headers, Regex whitelist)
: base(method, path, query, headers, new Regex(@"^text/html", RegexOptions.IgnoreCase | RegexOptions.Compiled),
whitelist)
{
_handler = handler;
}
/// <summary>
/// Instantiate an HTTP handler.
/// </summary>
/// <param name="handler">a GenericHTTPMethod</param>
public OSHttpHttpHandler(GenericHTTPMethod handler)
: this(handler, new Regex(@"^GET$", RegexOptions.IgnoreCase | RegexOptions.Compiled), null, null, null, null)
{
}
/// <summary>
/// Invoked by OSHttpRequestPump.
/// </summary>
public override OSHttpHandlerResult Process(OSHttpRequest request)
{
// call handler method
Hashtable responseData = _handler(request.Query);
int responseCode = (int)responseData["int_response_code"];
string responseString = (string)responseData["str_response_string"];
string contentType = (string)responseData["content_type"];
//Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
//and should check for NullReferenceExceptions
if (string.IsNullOrEmpty(contentType))
{
contentType = "text/html";
}
OSHttpResponse response = new OSHttpResponse(request);
// We're forgoing the usual error status codes here because the client
// ignores anything but 200 and 301
response.StatusCode = (int)OSHttpStatusCode.SuccessOk;
if (responseCode == (int)OSHttpStatusCode.RedirectMovedPermanently)
{
response.RedirectLocation = (string)responseData["str_redirect_location"];
response.StatusCode = responseCode;
}
response.AddHeader("Content-type", contentType);
byte[] buffer;
if (!contentType.Contains("image"))
{
buffer = Encoding.UTF8.GetBytes(responseString);
}
else
{
buffer = Convert.FromBase64String(responseString);
}
response.SendChunked = false;
response.ContentLength64 = buffer.Length;
response.ContentEncoding = Encoding.UTF8;
try
{
response.Body.Write(buffer, 0, buffer.Length);
}
catch (Exception ex)
{
_log.ErrorFormat("[OSHttpHttpHandler]: Error: {0}", ex.Message);
}
finally
{
response.Send();
}
return OSHttpHandlerResult.Done;
}
}
}

View File

@ -34,7 +34,7 @@ using System.Net;
using System.Reflection;
using System.Text;
using System.Web;
using HttpServer;
using OSHttpServer;
using log4net;
namespace OpenSim.Framework.Servers.HttpServer
@ -43,23 +43,23 @@ namespace OpenSim.Framework.Servers.HttpServer
{
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected IHttpRequest _request = null;
protected IHttpClientContext _context = null;
protected IHttpRequest m_request = null;
protected IHttpClientContext m_context = null;
public string[] AcceptTypes
{
get { return _request.AcceptTypes; }
get { return m_request.AcceptTypes; }
}
public Encoding ContentEncoding
{
get { return _contentEncoding; }
get { return m_contentEncoding; }
}
private Encoding _contentEncoding;
private Encoding m_contentEncoding;
public long ContentLength
{
get { return _request.ContentLength; }
get { return m_request.ContentLength; }
}
public long ContentLength64
@ -69,64 +69,93 @@ namespace OpenSim.Framework.Servers.HttpServer
public string ContentType
{
get { return _contentType; }
get { return m_contentType; }
}
private string _contentType;
private string m_contentType;
public HttpCookieCollection Cookies
{
get
{
RequestCookies cookies = _request.Cookies;
RequestCookies cookies = m_request.Cookies;
HttpCookieCollection httpCookies = new HttpCookieCollection();
if(cookies != null)
{
foreach (RequestCookie cookie in cookies)
httpCookies.Add(new HttpCookie(cookie.Name, cookie.Value));
}
return httpCookies;
}
}
public bool HasEntityBody
{
get { return _request.ContentLength != 0; }
get { return m_request.ContentLength != 0; }
}
public NameValueCollection Headers
{
get { return _request.Headers; }
get { return m_request.Headers; }
}
public string HttpMethod
{
get { return _request.Method; }
get { return m_request.Method; }
}
public Stream InputStream
{
get { return _request.Body; }
get { return m_request.Body; }
}
public bool IsSecured
{
get { return _context.IsSecured; }
get { return m_context.IsSecured; }
}
public bool KeepAlive
{
get { return ConnectionType.KeepAlive == _request.Connection; }
get { return ConnectionType.KeepAlive == m_request.Connection; }
}
public NameValueCollection QueryString
{
get { return _queryString; }
get { return m_request.QueryString;}
}
private NameValueCollection _queryString;
private Hashtable m_queryAsHashtable = null;
public Hashtable Query
{
get { return _query; }
get
{
if (m_queryAsHashtable == null)
BuildQueryHashtable();
return m_queryAsHashtable;
}
}
private Hashtable _query;
//faster than Query
private Dictionary<string, string> _queryAsDictionay = null;
public Dictionary<string,string> QueryAsDictionary
{
get
{
if (_queryAsDictionay == null)
BuildQueryDictionary();
return _queryAsDictionay;
}
}
private HashSet<string> m_queryFlags = null;
public HashSet<string> QueryFlags
{
get
{
if (m_queryFlags == null)
BuildQueryDictionary();
return m_queryFlags;
}
}
/// <value>
/// POST request values, if applicable
/// </value>
@ -134,34 +163,48 @@ namespace OpenSim.Framework.Servers.HttpServer
public string RawUrl
{
get { return _request.Uri.AbsolutePath; }
get { return m_request.Uri.AbsolutePath; }
}
public IPEndPoint RemoteIPEndPoint
{
get { return _remoteIPEndPoint; }
get { return m_request.RemoteIPEndPoint; }
}
public IPEndPoint LocalIPEndPoint
{
get { return m_request.LocalIPEndPoint; }
}
private IPEndPoint _remoteIPEndPoint;
public Uri Url
{
get { return _request.Uri; }
get { return m_request.Uri; }
}
public string UriPath
{
get { return m_request.UriPath; }
}
public string UserAgent
{
get { return _userAgent; }
get { return m_userAgent; }
}
private string m_userAgent;
public double ArrivalTS
{
get { return m_request.ArrivalTS;}
}
private string _userAgent;
internal IHttpRequest IHttpRequest
{
get { return _request; }
get { return m_request; }
}
internal IHttpClientContext IHttpClientContext
{
get { return _context; }
get { return m_context; }
}
/// <summary>
@ -176,73 +219,27 @@ namespace OpenSim.Framework.Servers.HttpServer
public OSHttpRequest() {}
public OSHttpRequest(IHttpClientContext context, IHttpRequest req)
public OSHttpRequest(IHttpRequest req)
{
_request = req;
_context = context;
m_request = req;
m_context = req.Context;
if (null != req.Headers["content-encoding"])
{
try
{
_contentEncoding = Encoding.GetEncoding(_request.Headers["content-encoding"]);
m_contentEncoding = Encoding.GetEncoding(m_request.Headers["content-encoding"]);
}
catch (Exception)
catch
{
// ignore
}
}
if (null != req.Headers["content-type"])
_contentType = _request.Headers["content-type"];
m_contentType = m_request.Headers["content-type"];
if (null != req.Headers["user-agent"])
_userAgent = req.Headers["user-agent"];
if (null != req.Headers["remote_addr"])
{
try
{
IPAddress addr = IPAddress.Parse(req.Headers["remote_addr"]);
// sometimes req.Headers["remote_port"] returns a comma separated list, so use
// the first one in the list and log it
string[] strPorts = req.Headers["remote_port"].Split(new char[] { ',' });
if (strPorts.Length > 1)
{
_log.ErrorFormat("[OSHttpRequest]: format exception on addr/port {0}:{1}, ignoring",
req.Headers["remote_addr"], req.Headers["remote_port"]);
}
int port = Int32.Parse(strPorts[0]);
_remoteIPEndPoint = new IPEndPoint(addr, port);
}
catch (FormatException)
{
_log.ErrorFormat("[OSHttpRequest]: format exception on addr/port {0}:{1}, ignoring",
req.Headers["remote_addr"], req.Headers["remote_port"]);
}
}
_queryString = new NameValueCollection();
_query = new Hashtable();
try
{
foreach (HttpInputItem item in req.QueryString)
{
try
{
_queryString.Add(item.Name, item.Value);
_query[item.Name] = item.Value;
}
catch (InvalidCastException)
{
_log.DebugFormat("[OSHttpRequest]: error parsing {0} query item, skipping it", item.Name);
continue;
}
}
}
catch (Exception)
{
_log.ErrorFormat("[OSHttpRequest]: Error parsing querystring");
}
m_userAgent = req.Headers["user-agent"];
// Form = new Hashtable();
// foreach (HttpInputItem item in req.Form)
@ -252,6 +249,44 @@ namespace OpenSim.Framework.Servers.HttpServer
// }
}
private void BuildQueryDictionary()
{
NameValueCollection q = m_request.QueryString;
_queryAsDictionay = new Dictionary<string, string>();
m_queryFlags = new HashSet<string>();
for(int i = 0; i <q.Count; ++i)
{
try
{
var name = q.GetKey(i);
if(!string.IsNullOrEmpty(name))
_queryAsDictionay[name] = q[i];
else
m_queryFlags.Add(q[i]);
}
catch {}
}
}
private void BuildQueryHashtable()
{
NameValueCollection q = m_request.QueryString;
m_queryAsHashtable = new Hashtable();
m_queryFlags = new HashSet<string>();
for (int i = 0; i < q.Count; ++i)
{
try
{
var name = q.GetKey(i);
if (!string.IsNullOrEmpty(name))
m_queryAsHashtable[name] = q[i];
else
m_queryFlags.Add(q[i]);
}
catch { }
}
}
public override string ToString()
{
StringBuilder me = new StringBuilder();

View File

@ -1,298 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// #define DEBUGGING
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading;
using log4net;
using HttpServer;
namespace OpenSim.Framework.Servers.HttpServer
{
/// <summary>
/// An OSHttpRequestPump fetches incoming OSHttpRequest objects
/// from the OSHttpRequestQueue and feeds them to all subscribed
/// parties. Each OSHttpRequestPump encapsulates one thread to do
/// the work and there is a fixed number of pumps for each
/// OSHttpServer object.
/// </summary>
public class OSHttpRequestPump
{
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected OSHttpServer _server;
protected OSHttpRequestQueue _queue;
protected Thread _engine;
private int _id;
public string EngineID
{
get { return String.Format("{0} pump {1}", _server.EngineID, _id); }
}
public OSHttpRequestPump(OSHttpServer server, OSHttpRequestQueue queue, int id)
{
_server = server;
_queue = queue;
_id = id;
_engine = new Thread(new ThreadStart(Engine));
_engine.IsBackground = true;
_engine.Start();
_engine.Name = string.Format ("Engine:{0}",EngineID);
ThreadTracker.Add(_engine);
}
public static OSHttpRequestPump[] Pumps(OSHttpServer server, OSHttpRequestQueue queue, int poolSize)
{
OSHttpRequestPump[] pumps = new OSHttpRequestPump[poolSize];
for (int i = 0; i < pumps.Length; i++)
{
pumps[i] = new OSHttpRequestPump(server, queue, i);
}
return pumps;
}
public void Start()
{
_engine = new Thread(new ThreadStart(Engine));
_engine.IsBackground = true;
_engine.Start();
_engine.Name = string.Format ("Engine:{0}",EngineID);
ThreadTracker.Add(_engine);
}
public void Engine()
{
OSHttpRequest req = null;
while (true)
{
try
{
// dequeue an OSHttpRequest from OSHttpServer's
// request queue
req = _queue.Dequeue();
// get a copy of the list of registered handlers
List<OSHttpHandler> handlers = _server.OSHttpHandlers;
// prune list and have it sorted from most
// specific to least specific
handlers = MatchHandlers(req, handlers);
// process req: we try each handler in turn until
// we are either out of handlers or get back a
// Pass or Done
OSHttpHandlerResult rc = OSHttpHandlerResult.Unprocessed;
foreach (OSHttpHandler h in handlers)
{
rc = h.Process(req);
// Pass: handler did not process the request,
// try next handler
if (OSHttpHandlerResult.Pass == rc) continue;
// Handled: handler has processed the request
if (OSHttpHandlerResult.Done == rc) break;
// hmm, something went wrong
throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc));
}
if (OSHttpHandlerResult.Unprocessed == rc)
{
_log.InfoFormat("[{0}] OSHttpHandler: no handler registered for {1}", EngineID, req);
// set up response header
OSHttpResponse resp = new OSHttpResponse(req);
resp.StatusCode = (int)OSHttpStatusCode.ClientErrorNotFound;
resp.StatusDescription = String.Format("no handler on call for {0}", req);
resp.ContentType = "text/html";
// add explanatory message
StreamWriter body = new StreamWriter(resp.Body);
body.WriteLine("<html>");
body.WriteLine("<header><title>Ooops...</title><header>");
body.WriteLine(String.Format("<body><p>{0}</p></body>", resp.StatusDescription));
body.WriteLine("</html>");
body.Flush();
// and ship it back
resp.Send();
}
}
catch (Exception e)
{
_log.DebugFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.ToString());
_log.ErrorFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.Message);
}
}
}
protected List<OSHttpHandler> MatchHandlers(OSHttpRequest req, List<OSHttpHandler> handlers)
{
Dictionary<OSHttpHandler, int> scoredHandlers = new Dictionary<OSHttpHandler, int>();
_log.DebugFormat("[{0}] MatchHandlers for {1}", EngineID, req);
foreach (OSHttpHandler h in handlers)
{
// initial anchor
scoredHandlers[h] = 0;
// first, check whether IPEndPointWhitelist applies
// and, if it does, whether client is on that white
// list.
if (null != h.IPEndPointWhitelist)
{
// TODO: following code requires code changes to
// HttpServer.HttpRequest to become functional
IPEndPoint remote = req.RemoteIPEndPoint;
if (null != remote)
{
Match epm = h.IPEndPointWhitelist.Match(remote.ToString());
if (!epm.Success)
{
scoredHandlers.Remove(h);
continue;
}
}
}
if (null != h.Method)
{
Match m = h.Method.Match(req.HttpMethod);
if (!m.Success)
{
scoredHandlers.Remove(h);
continue;
}
scoredHandlers[h]++;
}
// whitelist ok, now check path
if (null != h.Path)
{
Match m = h.Path.Match(req.RawUrl);
if (!m.Success)
{
scoredHandlers.Remove(h);
continue;
}
scoredHandlers[h] += m.ToString().Length;
}
// whitelist & path ok, now check query string
if (null != h.Query)
{
int queriesMatch = MatchOnNameValueCollection(req.QueryString, h.Query);
if (0 == queriesMatch)
{
_log.DebugFormat("[{0}] request {1}", EngineID, req);
_log.DebugFormat("[{0}] dropping handler {1}", EngineID, h);
scoredHandlers.Remove(h);
continue;
}
scoredHandlers[h] += queriesMatch;
}
// whitelist, path, query string ok, now check headers
if (null != h.Headers)
{
int headersMatch = MatchOnNameValueCollection(req.Headers, h.Headers);
if (0 == headersMatch)
{
_log.DebugFormat("[{0}] request {1}", EngineID, req);
_log.DebugFormat("[{0}] dropping handler {1}", EngineID, h);
scoredHandlers.Remove(h);
continue;
}
scoredHandlers[h] += headersMatch;
}
}
List<OSHttpHandler> matchingHandlers = new List<OSHttpHandler>(scoredHandlers.Keys);
matchingHandlers.Sort(delegate(OSHttpHandler x, OSHttpHandler y)
{
return scoredHandlers[x] - scoredHandlers[y];
});
LogDumpHandlerList(matchingHandlers);
return matchingHandlers;
}
protected int MatchOnNameValueCollection(NameValueCollection collection, Dictionary<string, Regex> regexs)
{
int matched = 0;
foreach (string tag in regexs.Keys)
{
// do we have a header "tag"?
if (null == collection[tag])
{
return 0;
}
// does the content of collection[tag] match
// the supplied regex?
Match cm = regexs[tag].Match(collection[tag]);
if (!cm.Success)
{
return 0;
}
// ok: matches
matched++;
continue;
}
return matched;
}
[ConditionalAttribute("DEBUGGING")]
private void LogDumpHandlerList(List<OSHttpHandler> l)
{
_log.DebugFormat("[{0}] OSHttpHandlerList dump:", EngineID);
foreach (OSHttpHandler h in l)
_log.DebugFormat(" ", h.ToString());
}
}
}

View File

@ -28,7 +28,7 @@
using System.IO;
using System.Net;
using System.Text;
using HttpServer;
using OSHttpServer;
namespace OpenSim.Framework.Servers.HttpServer
{
@ -231,19 +231,18 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
/// <summary>
/// Set a redirct location.
/// </summary>
public string RedirectLocation
public int Priority
{
// get { return _redirectLocation; }
get
{
return _httpResponse.Priority;
}
set
{
_httpResponse.Redirect(value);
_httpResponse.Priority = value;
}
}
/// <summary>
/// Chunk transfers.
/// </summary>
@ -276,6 +275,10 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
public double RequestTS
{
get {return _httpResponse.RequestTS; }
}
/// <summary>
/// HTTP status description.
@ -310,8 +313,7 @@ namespace OpenSim.Framework.Servers.HttpServer
/// replying</param>
public OSHttpResponse(OSHttpRequest req)
{
_httpResponse = new HttpResponse(req.IHttpClientContext, req.IHttpRequest);
_httpResponse = new HttpResponse(req.IHttpRequest);
}
public OSHttpResponse(HttpResponse resp)

View File

@ -1,210 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading;
using System.Security.Cryptography.X509Certificates;
using log4net;
using HttpServer;
using HttpListener = HttpServer.HttpListener;
namespace OpenSim.Framework.Servers.HttpServer
{
/// <summary>
/// OSHttpServer provides an HTTP server bound to a specific
/// port. When instantiated with just address and port it uses
/// normal HTTP, when instantiated with address, port, and X509
/// certificate, it uses HTTPS.
/// </summary>
public class OSHttpServer
{
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private object _syncObject = new object();
// underlying HttpServer.HttpListener
protected HttpListener _listener;
// underlying core/engine thread
protected Thread _engine;
// Queue containing (OS)HttpRequests
protected OSHttpRequestQueue _queue;
// OSHttpRequestPumps "pumping" incoming OSHttpRequests
// upwards
protected OSHttpRequestPump[] _pumps;
// thread identifier
protected string _engineId;
public string EngineID
{
get { return _engineId; }
}
/// <summary>
/// True if this is an HTTPS connection; false otherwise.
/// </summary>
protected bool _isSecure;
public bool IsSecure
{
get { return _isSecure; }
}
public int QueueSize
{
get { return _pumps.Length; }
}
/// <summary>
/// List of registered OSHttpHandlers for this OSHttpServer instance.
/// </summary>
protected List<OSHttpHandler> _httpHandlers = new List<OSHttpHandler>();
public List<OSHttpHandler> OSHttpHandlers
{
get
{
lock (_httpHandlers)
{
return new List<OSHttpHandler>(_httpHandlers);
}
}
}
/// <summary>
/// Instantiate an HTTP server.
/// </summary>
public OSHttpServer(IPAddress address, int port, int poolSize)
{
_engineId = String.Format("OSHttpServer (HTTP:{0})", port);
_isSecure = false;
_log.DebugFormat("[{0}] HTTP server instantiated", EngineID);
_listener = new HttpListener(address, port);
_queue = new OSHttpRequestQueue();
_pumps = OSHttpRequestPump.Pumps(this, _queue, poolSize);
}
/// <summary>
/// Instantiate an HTTPS server.
/// </summary>
public OSHttpServer(IPAddress address, int port, X509Certificate certificate, int poolSize)
{
_engineId = String.Format("OSHttpServer [HTTPS:{0}/ps:{1}]", port, poolSize);
_isSecure = true;
_log.DebugFormat("[{0}] HTTPS server instantiated", EngineID);
_listener = new HttpListener(address, port, certificate);
_queue = new OSHttpRequestQueue();
_pumps = OSHttpRequestPump.Pumps(this, _queue, poolSize);
}
/// <summary>
/// Turn an HttpRequest into an OSHttpRequestItem and place it
/// in the queue. The OSHttpRequestQueue object will pulse the
/// next available idle pump.
/// </summary>
protected void OnHttpRequest(HttpClientContext client, HttpRequest request)
{
// turn request into OSHttpRequest
OSHttpRequest req = new OSHttpRequest(client, request);
// place OSHttpRequest into _httpRequestQueue, will
// trigger Pulse to idle waiting pumps
_queue.Enqueue(req);
}
/// <summary>
/// Start the HTTP server engine.
/// </summary>
public void Start()
{
_engine = new Thread(new ThreadStart(Engine));
_engine.IsBackground = true;
_engine.Start();
_engine.Name = string.Format ("Engine:{0}",_engineId);
ThreadTracker.Add(_engine);
// start the pumps...
for (int i = 0; i < _pumps.Length; i++)
_pumps[i].Start();
}
public void Stop()
{
lock (_syncObject) Monitor.Pulse(_syncObject);
}
/// <summary>
/// Engine keeps the HTTP server running.
/// </summary>
private void Engine()
{
try {
_listener.RequestHandler += OnHttpRequest;
_listener.Start(QueueSize);
_log.InfoFormat("[{0}] HTTP server started", EngineID);
lock (_syncObject) Monitor.Wait(_syncObject);
}
catch (Exception ex)
{
_log.DebugFormat("[{0}] HTTP server startup failed: {1}", EngineID, ex.ToString());
}
_log.InfoFormat("[{0}] HTTP server terminated", EngineID);
}
/// <summary>
/// Add an HTTP request handler.
/// </summary>
/// <param name="handler">OSHttpHandler delegate</param>
/// <param name="path">regex object for path matching</parm>
/// <param name="headers">dictionary containing header names
/// and regular expressions to match against header values</param>
public void AddHandler(OSHttpHandler handler)
{
lock (_httpHandlers)
{
if (_httpHandlers.Contains(handler))
{
_log.DebugFormat("[OSHttpServer] attempt to add already existing handler ignored");
return;
}
_httpHandlers.Add(handler);
}
}
}
}

View File

@ -0,0 +1,33 @@
using System;
using System.Net;
namespace OSHttpServer.Exceptions
{
/// <summary>
/// The request could not be understood by the server due to malformed syntax.
/// The client SHOULD NOT repeat the request without modifications.
///
/// Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php
/// </summary>
public class BadRequestException : HttpException
{
/// <summary>
/// Create a new bad request exception.
/// </summary>
/// <param name="errMsg">reason to why the request was bad.</param>
public BadRequestException(string errMsg)
: base(HttpStatusCode.BadRequest, errMsg)
{
}
/// <summary>
/// Create a new bad request exception.
/// </summary>
/// <param name="errMsg">reason to why the request was bad.</param>
/// <param name="inner">inner exception</param>
public BadRequestException(string errMsg, Exception inner)
: base(HttpStatusCode.BadRequest, errMsg, inner)
{
}
}
}

View File

@ -0,0 +1,55 @@
using System;
namespace OSHttpServer.Parser
{
/// <summary>
/// Arguments used when more body bytes have come.
/// </summary>
public class BodyEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="BodyEventArgs"/> class.
/// </summary>
/// <param name="buffer">buffer that contains the received bytes.</param>
/// <param name="offset">offset in buffer where to start processing.</param>
/// <param name="count">number of bytes from <paramref name="offset"/> that should be parsed.</param>
public BodyEventArgs(byte[] buffer, int offset, int count)
{
Buffer = buffer;
Offset = offset;
Count = count;
}
/// <summary>
/// Initializes a new instance of the <see cref="BodyEventArgs"/> class.
/// </summary>
public BodyEventArgs()
{
}
/// <summary>
/// Gets or sets buffer that contains the received bytes.
/// </summary>
public byte[] Buffer { get; set; }
/*
/// <summary>
/// Gets or sets number of bytes used by the request.
/// </summary>
public int BytesUsed { get; set; }
*/
/// <summary>
/// Gets or sets number of bytes from <see cref="Offset"/> that should be parsed.
/// </summary>
public int Count { get; set; }
/*
/// <summary>
/// Gets or sets whether the body is complete.
/// </summary>
public bool IsBodyComplete { get; set; }
*/
/// <summary>
/// Gets or sets offset in buffer where to start processing.
/// </summary>
public int Offset { get; set; }
}
}

View File

@ -0,0 +1,50 @@
using System;
using System.Net.Sockets;
namespace OSHttpServer
{
/// <summary>
/// Invoked when a client have been accepted by the <see cref="OSHttpListener"/>
/// </summary>
/// <remarks>
/// Can be used to revoke incoming connections
/// </remarks>
public class ClientAcceptedEventArgs : EventArgs
{
private readonly Socket _socket;
private bool _revoke;
/// <summary>
/// Initializes a new instance of the <see cref="ClientAcceptedEventArgs"/> class.
/// </summary>
/// <param name="socket">The socket.</param>
public ClientAcceptedEventArgs(Socket socket)
{
_socket = socket;
}
/// <summary>
/// Accepted socket.
/// </summary>
public Socket Socket
{
get { return _socket; }
}
/// <summary>
/// Client should be revoked.
/// </summary>
public bool Revoked
{
get { return _revoke; }
}
/// <summary>
/// Client may not be handled.
/// </summary>
public void Revoke()
{
_revoke = true;
}
}
}

View File

@ -0,0 +1,414 @@
/*
* 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.Concurrent;
using System.Diagnostics;
using System.Globalization;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
namespace OSHttpServer
{
/// <summary>
/// Timeout Manager. Checks for dead clients. Clients with open connections that are not doing anything. Closes sessions opened with keepalive.
/// </summary>
public static class ContextTimeoutManager
{
/// <summary>
/// Use a Thread or a Timer to monitor the ugly
/// </summary>
private static Thread m_internalThread = null;
private static object m_threadLock = new object();
private static ConcurrentQueue<HttpClientContext> m_contexts = new ConcurrentQueue<HttpClientContext>();
private static ConcurrentQueue<HttpClientContext> m_highPrio = new ConcurrentQueue<HttpClientContext>();
private static ConcurrentQueue<HttpClientContext> m_midPrio = new ConcurrentQueue<HttpClientContext>();
private static ConcurrentQueue<HttpClientContext> m_lowPrio = new ConcurrentQueue<HttpClientContext>();
private static AutoResetEvent m_processWaitEven = new AutoResetEvent(false);
private static bool m_shuttingDown;
private static int m_ActiveSendingCount;
private static double m_lastTimeOutCheckTime = 0;
private static double m_lastSendCheckTime = 0;
const int m_maxBandWidth = 10485760; //80Mbps
const int m_maxConcurrenSend = 32;
static ContextTimeoutManager()
{
TimeStampClockPeriod = 1.0 / (double)Stopwatch.Frequency;
TimeStampClockPeriodMS = 1e3 / (double)Stopwatch.Frequency;
}
public static void Start()
{
lock (m_threadLock)
{
if (m_internalThread != null)
return;
m_lastTimeOutCheckTime = GetTimeStampMS();
m_internalThread = new Thread(ThreadRunProcess);
m_internalThread.Priority = ThreadPriority.Normal;
m_internalThread.IsBackground = true;
m_internalThread.CurrentCulture = new CultureInfo("en-US", false);
m_internalThread.Name = "HttpServerMain";
m_internalThread.Start();
}
}
public static void Stop()
{
m_shuttingDown = true;
m_internalThread.Join();
ProcessShutDown();
}
private static void ThreadRunProcess()
{
while (!m_shuttingDown)
{
m_processWaitEven.WaitOne(500);
if(m_shuttingDown)
return;
double now = GetTimeStamp();
if(m_contexts.Count > 0)
{
ProcessSendQueues(now);
if (now - m_lastTimeOutCheckTime > 1.0)
{
ProcessContextTimeouts();
m_lastTimeOutCheckTime = now;
}
}
else
m_lastTimeOutCheckTime = now;
}
}
public static void ProcessShutDown()
{
try
{
SocketError disconnectError = SocketError.HostDown;
for (int i = 0; i < m_contexts.Count; i++)
{
if (m_contexts.TryDequeue(out HttpClientContext context))
{
try
{
context.Disconnect(disconnectError);
}
catch { }
}
}
m_processWaitEven.Dispose();
m_processWaitEven = null;
}
catch
{
// We can't let this crash.
}
}
public static void ProcessSendQueues(double now)
{
int inqueues = m_highPrio.Count + m_midPrio.Count + m_lowPrio.Count;
if(inqueues == 0)
return;
double dt = now - m_lastSendCheckTime;
m_lastSendCheckTime = now;
int totalSending = m_ActiveSendingCount;
int curConcurrentLimit = m_maxConcurrenSend - totalSending;
if(curConcurrentLimit <= 0)
return;
if(curConcurrentLimit > inqueues)
curConcurrentLimit = inqueues;
if (dt > 0.5)
dt = 0.5;
dt /= curConcurrentLimit;
int curbytesLimit = (int)(m_maxBandWidth * dt);
if(curbytesLimit < 8192)
curbytesLimit = 8192;
HttpClientContext ctx;
int sent;
while (curConcurrentLimit > 0)
{
sent = 0;
while (m_highPrio.TryDequeue(out ctx))
{
if(TrySend(ctx, curbytesLimit))
m_highPrio.Enqueue(ctx);
if (m_shuttingDown)
return;
--curConcurrentLimit;
if (++sent == 4)
break;
}
sent = 0;
while(m_midPrio.TryDequeue(out ctx))
{
if(TrySend(ctx, curbytesLimit))
m_midPrio.Enqueue(ctx);
if (m_shuttingDown)
return;
--curConcurrentLimit;
if (++sent >= 2)
break;
}
if (m_lowPrio.TryDequeue(out ctx))
{
--curConcurrentLimit;
if(TrySend(ctx, curbytesLimit))
m_lowPrio.Enqueue(ctx);
}
if (m_shuttingDown)
return;
}
}
private static bool TrySend(HttpClientContext ctx, int bytesLimit)
{
if(!ctx.CanSend())
return false;
return ctx.TrySendResponse(bytesLimit);
}
/// <summary>
/// Causes the watcher to immediately check the connections.
/// </summary>
public static void ProcessContextTimeouts()
{
try
{
for (int i = 0; i < m_contexts.Count; i++)
{
if (m_shuttingDown)
return;
if (m_contexts.TryDequeue(out HttpClientContext context))
{
if (!ContextTimedOut(context, out SocketError disconnectError))
m_contexts.Enqueue(context);
else if(disconnectError != SocketError.InProgress)
context.Disconnect(disconnectError);
}
}
}
catch
{
// We can't let this crash.
}
}
private static bool ContextTimedOut(HttpClientContext context, out SocketError disconnectError)
{
disconnectError = SocketError.InProgress;
// First our error conditions
if (context.contextID < 0 || context.StopMonitoring || context.StreamPassedOff)
return true;
int nowMS = EnvironmentTickCount();
// First we check first contact line
if (!context.FirstRequestLineReceived)
{
if (EnvironmentTickCountAdd(context.TimeoutFirstLine, context.LastActivityTimeMS) < nowMS)
{
disconnectError = SocketError.TimedOut;
return true;
}
return false;
}
// First we check first contact request
if (!context.FullRequestReceived)
{
if (EnvironmentTickCountAdd(context.TimeoutRequestReceived, context.LastActivityTimeMS) < nowMS)
{
disconnectError = SocketError.TimedOut;
return true;
}
return false;
}
if (context.TriggerKeepalive)
{
context.TriggerKeepalive = false;
context.MonitorKeepaliveStartMS = nowMS + 500;
return false;
}
if (context.MonitorKeepaliveStartMS != 0)
{
if (context.IsClosing)
{
disconnectError = SocketError.Success;
return true;
}
if (EnvironmentTickCountAdd(context.TimeoutKeepAlive, context.MonitorKeepaliveStartMS) < nowMS)
{
disconnectError = SocketError.TimedOut;
context.MonitorKeepaliveStartMS = 0;
return true;
}
}
if (EnvironmentTickCountAdd(context.TimeoutMaxIdle, context.LastActivityTimeMS) < nowMS)
{
disconnectError = SocketError.TimedOut;
context.MonitorKeepaliveStartMS = 0;
return true;
}
return false;
}
public static void StartMonitoringContext(HttpClientContext context)
{
context.LastActivityTimeMS = EnvironmentTickCount();
m_contexts.Enqueue(context);
}
public static void EnqueueSend(HttpClientContext context, int priority, bool notThrottled = true)
{
switch(priority)
{
case 0:
m_highPrio.Enqueue(context);
break;
case 1:
m_midPrio.Enqueue(context);
break;
case 2:
m_lowPrio.Enqueue(context);
break;
default:
return;
}
if(notThrottled)
m_processWaitEven.Set();
}
public static void ContextEnterActiveSend()
{
Interlocked.Increment(ref m_ActiveSendingCount);
}
public static void ContextLeaveActiveSend()
{
Interlocked.Decrement(ref m_ActiveSendingCount);
}
/// <summary>
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
/// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
/// for the callers.
/// This trims it to a 12 day interval so don't let your frame time get too long.
/// </summary>
/// <returns></returns>
public static int EnvironmentTickCount()
{
return Environment.TickCount & EnvironmentTickCountMask;
}
const int EnvironmentTickCountMask = 0x3fffffff;
/// <summary>
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
/// 'EnvironmentTickCount()') and accounts for any wrapping.
/// </summary>
/// <param name="newValue"></param>
/// <param name="prevValue"></param>
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
public static int EnvironmentTickCountSubtract(Int32 newValue, Int32 prevValue)
{
int diff = newValue - prevValue;
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
}
/// <summary>
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
/// 'EnvironmentTickCount()') and accounts for any wrapping.
/// </summary>
/// <param name="newValue"></param>
/// <param name="prevValue"></param>
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
public static int EnvironmentTickCountAdd(Int32 newValue, Int32 prevValue)
{
int ret = newValue + prevValue;
return (ret >= 0) ? ret : (ret + EnvironmentTickCountMask + 1);
}
public static double TimeStampClockPeriodMS;
public static double TimeStampClockPeriod;
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static double GetTimeStamp()
{
return Stopwatch.GetTimestamp() * TimeStampClockPeriod;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static double GetTimeStampMS()
{
return Stopwatch.GetTimestamp() * TimeStampClockPeriodMS;
}
// doing math in ticks is usefull to avoid loss of resolution
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static long GetTimeStampTicks()
{
return Stopwatch.GetTimestamp();
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static double TimeStampTicksToMS(long ticks)
{
return ticks * TimeStampClockPeriodMS;
}
}
}

View File

@ -0,0 +1,29 @@
using System;
namespace OSHttpServer
{
/// <summary>
/// An unhandled exception have been caught by the system.
/// </summary>
public class ExceptionEventArgs : EventArgs
{
private readonly Exception _exception;
/// <summary>
/// Initializes a new instance of the <see cref="ExceptionEventArgs"/> class.
/// </summary>
/// <param name="exception">Caught exception.</param>
public ExceptionEventArgs(Exception exception)
{
_exception = exception;
}
/// <summary>
/// caught exception
/// </summary>
public Exception Exception
{
get { return _exception; }
}
}
}

View File

@ -0,0 +1,16 @@
using System;
namespace OSHttpServer
{
/// <summary>
/// We dont want to let the server to die due to exceptions thrown in worker threads.
/// therefore we use this delegate to give you a change to handle uncaught exceptions.
/// </summary>
/// <param name="source">Class that the exception was thrown in.</param>
/// <param name="exception">Exception</param>
/// <remarks>
/// Server will throw a InternalServerException in release version if you dont
/// handle this delegate.
/// </remarks>
public delegate void ExceptionHandler(object source, Exception exception);
}

View File

@ -0,0 +1,25 @@
using System.Net;
namespace OSHttpServer.Exceptions
{
/// <summary>
/// The server understood the request, but is refusing to fulfill it.
/// Authorization will not help and the request SHOULD NOT be repeated.
/// If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled,
/// it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information
/// available to the client, the status code 404 (Not Found) can be used instead.
///
/// Text taken from: http://www.submissionchamber.com/help-guides/error-codes.php
/// </summary>
public class ForbiddenException : HttpException
{
/// <summary>
/// Initializes a new instance of the <see cref="ForbiddenException"/> class.
/// </summary>
/// <param name="errorMsg">error message</param>
public ForbiddenException(string errorMsg)
: base(HttpStatusCode.Forbidden, errorMsg)
{
}
}
}

View File

@ -0,0 +1,38 @@
using System;
namespace OSHttpServer.Parser
{
/// <summary>
/// Event arguments used when a new header have been parsed.
/// </summary>
public class HeaderEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="HeaderEventArgs"/> class.
/// </summary>
/// <param name="name">Name of header.</param>
/// <param name="value">Header value.</param>
public HeaderEventArgs(string name, string value)
{
Name = name;
Value = value;
}
/// <summary>
/// Initializes a new instance of the <see cref="HeaderEventArgs"/> class.
/// </summary>
public HeaderEventArgs()
{
}
/// <summary>
/// Gets or sets header name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets header value.
/// </summary>
public string Value { get; set; }
}
}

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