Compare commits
916 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5eb2526e88 | ||
|
|
641b08aa78 | ||
|
|
15d5f3d09d | ||
|
|
07dbe46ba3 | ||
|
|
ff867b59cf | ||
|
|
d4b8a13a1d | ||
|
|
a858c5daee | ||
|
|
8d431c6359 | ||
|
|
663bfbb372 | ||
|
|
d297eb39e5 | ||
|
|
29218cdb31 | ||
|
|
359f9efc76 | ||
|
|
fb211c64fd | ||
|
|
a3d140b57c | ||
|
|
f7b88d1c40 | ||
|
|
32b534f324 | ||
|
|
ffdc798720 | ||
|
|
ae852bb873 | ||
|
|
d3adf9b2b3 | ||
|
|
7c140570db | ||
|
|
7b6987ce83 | ||
|
|
0376b8ddbc | ||
|
|
2d2495cc45 | ||
|
|
a0eda6eb16 | ||
|
|
dac31303b7 | ||
|
|
edd3577b66 | ||
|
|
054db94d5d | ||
|
|
794c5f5a6d | ||
|
|
b625579780 | ||
|
|
7e41559917 | ||
|
|
8cd415c2b0 | ||
|
|
4c58c1b116 | ||
|
|
e6f43023b6 | ||
|
|
bcf944db48 | ||
|
|
7a9eee8538 | ||
|
|
05648c2c4a | ||
|
|
dff746df7b | ||
|
|
973f2e8be5 | ||
|
|
3c019bea8c | ||
|
|
68814f904e | ||
|
|
3bd3f448a2 | ||
|
|
7c6e8fab15 | ||
|
|
3ed0d79b00 | ||
|
|
d89b974680 | ||
|
|
c76c63725b | ||
|
|
6b277394c0 | ||
|
|
adce58b33a | ||
|
|
1f88179a65 | ||
|
|
ec726413dd | ||
|
|
3d736d575f | ||
|
|
0c3061f973 | ||
|
|
3bf7bd6359 | ||
|
|
7ea832d47c | ||
|
|
c1cece4b82 | ||
|
|
aa44df9c04 | ||
|
|
1e18f0f26a | ||
|
|
8a7fbfb06a | ||
|
|
e916b1399f | ||
|
|
72c2d13ac6 | ||
|
|
a6d689c529 | ||
|
|
ab9bfe5156 | ||
|
|
4e26d039d6 | ||
|
|
3082fdd0f6 | ||
|
|
e90168c738 | ||
|
|
a5c6cb2fc9 | ||
|
|
6ea95a3294 | ||
|
|
6e86b23012 | ||
|
|
58714b0aca | ||
|
|
5203665bb2 | ||
|
|
2a2e120470 | ||
|
|
a8044999fb | ||
|
|
3d504261b0 | ||
|
|
a0d178b284 | ||
|
|
f8a89a79eb | ||
|
|
e04047152f | ||
|
|
f3a5e3a02b | ||
|
|
ba58331b29 | ||
|
|
476996bee8 | ||
|
|
01771aca40 | ||
|
|
cd325fdf02 | ||
|
|
67477290ad | ||
|
|
582a256646 | ||
|
|
d188272462 | ||
|
|
632908db9e | ||
|
|
82b23f7cc1 | ||
|
|
a08687aef3 | ||
|
|
2ad9d656b3 | ||
|
|
1747030d19 | ||
|
|
c557684666 | ||
|
|
a3cbda0d74 | ||
|
|
4f3fabae5b | ||
|
|
aede42b875 | ||
|
|
a533db7e27 | ||
|
|
4820dfd733 | ||
|
|
1369058280 | ||
|
|
568de9313a | ||
|
|
219326dd8e | ||
|
|
9925317239 | ||
|
|
150748392e | ||
|
|
555edc4ef7 | ||
|
|
481c00f50a | ||
|
|
ede3b9ab07 | ||
|
|
b863a15a82 | ||
|
|
aee4353e9c | ||
|
|
e6fb458597 | ||
|
|
812c498ef4 | ||
|
|
970727e57e | ||
|
|
bcbd450fe4 | ||
|
|
9aec62f0ac | ||
|
|
dd0556abc9 | ||
|
|
8769e4ee73 | ||
|
|
d72d599056 | ||
|
|
ca33619e11 | ||
|
|
ffdde05bb7 | ||
|
|
fb84ff96a9 | ||
|
|
52d7af05bc | ||
|
|
2b0c8bc480 | ||
|
|
2a70afeca2 | ||
|
|
5d7751da89 | ||
|
|
9d6fe1224a | ||
|
|
e4e5237086 | ||
|
|
28d0aff2e3 | ||
|
|
7068fddd2f | ||
|
|
466d684fbe | ||
|
|
74f5253a36 | ||
|
|
3ad827174e | ||
|
|
56da788243 | ||
|
|
7243d4f842 | ||
|
|
f57c1ac386 | ||
|
|
0860a0d856 | ||
|
|
03d76e9403 | ||
|
|
5c192b9bab | ||
|
|
ccc69d66a1 | ||
|
|
8eda290262 | ||
|
|
e31e23d68d | ||
|
|
99e339dd40 | ||
|
|
e9ea911563 | ||
|
|
9995421df1 | ||
|
|
57a9879669 | ||
|
|
376441e550 | ||
|
|
ae5db637f2 | ||
|
|
ef4122213c | ||
|
|
e286a95d76 | ||
|
|
0aa1f1cc3f | ||
|
|
5a1b6fdf06 | ||
|
|
7679384829 | ||
|
|
9f83f4bfa3 | ||
|
|
2b982ab212 | ||
|
|
dd10cf01e7 | ||
|
|
9efe7bf7ba | ||
|
|
68f112888b | ||
|
|
b05a2fc4ed | ||
|
|
257446889b | ||
|
|
77a7758cf5 | ||
|
|
c1c1d48af1 | ||
|
|
6f1f299619 | ||
|
|
11a4b9ec1d | ||
|
|
ebbf349c6a | ||
|
|
c27ff70d5c | ||
|
|
c7f2debd38 | ||
|
|
dc82ad0f7a | ||
|
|
f6562e2269 | ||
|
|
faa710aee1 | ||
|
|
d8125fb1f7 | ||
|
|
c42fe6c159 | ||
|
|
a5b6492223 | ||
|
|
1be072f19e | ||
|
|
4bbdcfb5ee | ||
|
|
9bd2c1b88a | ||
|
|
62acfabec4 | ||
|
|
50db8649aa | ||
|
|
fe4c3a37c0 | ||
|
|
58c630c18e | ||
|
|
3ecd39068c | ||
|
|
3a55d5b123 | ||
|
|
0c7ce4fc98 | ||
|
|
3ca770cd2c | ||
|
|
320982cae3 | ||
|
|
38e79b80a8 | ||
|
|
5ab151c2d6 | ||
|
|
19417fca41 | ||
|
|
926c0b90a1 | ||
|
|
4adb3471ac | ||
|
|
374ebab574 | ||
|
|
fb91ca6f1d | ||
|
|
2724cf685e | ||
|
|
8730dc9d6a | ||
|
|
d5cd60131f | ||
|
|
e7ad6ed3a3 | ||
|
|
ea36d4a4cf | ||
|
|
0e3b08fa5b | ||
|
|
205f2326dc | ||
|
|
5914270ff1 | ||
|
|
faffe2f2f9 | ||
|
|
8327e048b9 | ||
|
|
789e88d8bd | ||
|
|
5181bdae0a | ||
|
|
513b77b78d | ||
|
|
08ec18f8a3 | ||
|
|
cd9fd77e2c | ||
|
|
0588f27d18 | ||
|
|
72075e68c7 | ||
|
|
8b04e8a297 | ||
|
|
293d0cc629 | ||
|
|
0cd698d82b | ||
|
|
eeef9d7e99 | ||
|
|
0dfccfc1d9 | ||
|
|
68406ab8f9 | ||
|
|
86b005de1d | ||
|
|
cd2c5843a8 | ||
|
|
e36bc0d754 | ||
|
|
cf16ca9bda | ||
|
|
5f500c89ce | ||
|
|
69a5beeabc | ||
|
|
794363421d | ||
|
|
c51ef38e2d | ||
|
|
e38d26a2dc | ||
|
|
04d8c6b4fe | ||
|
|
7609daca38 | ||
|
|
d89faa3c16 | ||
|
|
a76a289d11 | ||
|
|
f9a8915cca | ||
|
|
50dbb9ffe4 | ||
|
|
6b1d12edcb | ||
|
|
b899d64dc1 | ||
|
|
3f6dfa92ab | ||
|
|
72d29bdb40 | ||
|
|
7e89b99e6a | ||
|
|
adbdb220df | ||
|
|
b23ab3ea85 | ||
|
|
d4f476c7ce | ||
|
|
134c6d181f | ||
|
|
f3c5ce1bbd | ||
|
|
0d9afad3fe | ||
|
|
cd44c3b90a | ||
|
|
1133f81dce | ||
|
|
811dc95105 | ||
|
|
6ee17f5b36 | ||
|
|
f4bae34283 | ||
|
|
faf250df2d | ||
|
|
5f741143fd | ||
|
|
21b1fec32d | ||
|
|
ce812c88cc | ||
|
|
7d30637d51 | ||
|
|
d4a667a918 | ||
|
|
9e914f5c32 | ||
|
|
0aaf52fca4 | ||
|
|
66824dd18c | ||
|
|
c1503205c0 | ||
|
|
c6d02801db | ||
|
|
9ca1075e7e | ||
|
|
0a4c080e63 | ||
|
|
d7add2940a | ||
|
|
75f7721b0c | ||
|
|
bf6529db32 | ||
|
|
2d05e16f7e | ||
|
|
5707e171f4 | ||
|
|
5aec0ff207 | ||
|
|
35efa88c26 | ||
|
|
227126adb7 | ||
|
|
22aa436648 | ||
|
|
a1e99642c1 | ||
|
|
31304c222d | ||
|
|
3cf8edfd68 | ||
|
|
1427430b7b | ||
|
|
ef8570f789 | ||
|
|
c846a5461c | ||
|
|
c992629576 | ||
|
|
bc13c52c98 | ||
|
|
2858b1b1f4 | ||
|
|
892dd59b13 | ||
|
|
bf6547be01 | ||
|
|
dda681515b | ||
|
|
8a574395c7 | ||
|
|
85c6eb7c50 | ||
|
|
73f9e14b43 | ||
|
|
e126915bc1 | ||
|
|
fc77bca936 | ||
|
|
55c1c10c0d | ||
|
|
7d16d0664e | ||
|
|
ac612e2105 | ||
|
|
1b1418e1de | ||
|
|
b537bbc410 | ||
|
|
b25d874afa | ||
|
|
ef14232e64 | ||
|
|
13929613b1 | ||
|
|
ca3b6b1f90 | ||
|
|
24dfb5bcb3 | ||
|
|
7451bb1613 | ||
|
|
cda67a68de | ||
|
|
e9c437ed0e | ||
|
|
c400918c84 | ||
|
|
f9913b6ef7 | ||
|
|
ecf7bb268c | ||
|
|
bcfc392edf | ||
|
|
a4281ca014 | ||
|
|
644fb6b013 | ||
|
|
fe99948c58 | ||
|
|
be39f03caa | ||
|
|
d1d331a4c0 | ||
|
|
c4533e755b | ||
|
|
e94831ddab | ||
|
|
ccc7e75ce4 | ||
|
|
ba80f137b5 | ||
|
|
e9a121e1b2 | ||
|
|
c0ab406e2e | ||
|
|
6dda7c65ae | ||
|
|
64db0bcbd2 | ||
|
|
528004d349 | ||
|
|
1971b6bb4f | ||
|
|
d97e27434c | ||
|
|
58b72933c8 | ||
|
|
4973fddc51 | ||
|
|
6460e587c4 | ||
|
|
742ad5eb93 | ||
|
|
dd85d7d981 | ||
|
|
0dd14ca0a3 | ||
|
|
cd6d7429f8 | ||
|
|
eb590becf0 | ||
|
|
b9749d5aaf | ||
|
|
48a5f10be1 | ||
|
|
56870d9609 | ||
|
|
ecb759c1e5 | ||
|
|
59a29f5f22 | ||
|
|
c489bc1cd2 | ||
|
|
356d597296 | ||
|
|
b0facd147a | ||
|
|
b6476eaac3 | ||
|
|
2a85372169 | ||
|
|
1c3b0da74a | ||
|
|
c1667d39a6 | ||
|
|
217f47b0d5 | ||
|
|
ed14dac0a3 | ||
|
|
ee7478fa16 | ||
|
|
5d3723a47f | ||
|
|
84b7ae2573 | ||
|
|
423101b425 | ||
|
|
e3453dd9ca | ||
|
|
b6cd3b625e | ||
|
|
8d59385eea | ||
|
|
ec6a195e40 | ||
|
|
2954ceccae | ||
|
|
884d603cac | ||
|
|
9ccb578721 | ||
|
|
d6f54b25cd | ||
|
|
dda999a22c | ||
|
|
3b3d9967b1 | ||
|
|
75ab9b4b88 | ||
|
|
15283d35f1 | ||
|
|
6a0de355e0 | ||
|
|
65a25ee510 | ||
|
|
ca412032e8 | ||
|
|
743437262e | ||
|
|
916e3bf886 | ||
|
|
9c89ad9154 | ||
|
|
33cff9b9d7 | ||
|
|
0e611c47d3 | ||
|
|
fc24563206 | ||
|
|
14d05dc2a9 | ||
|
|
337ea019bd | ||
|
|
cdea572d2e | ||
|
|
11e0ad6dc8 | ||
|
|
c8f0d476d2 | ||
|
|
69a6f6e3cd | ||
|
|
e8347b7095 | ||
|
|
506437b684 | ||
|
|
9f01c3d408 | ||
|
|
58869e5aa0 | ||
|
|
f3134b5cf6 | ||
|
|
eb5ec4a786 | ||
|
|
c8af20f966 | ||
|
|
d6f563794e | ||
|
|
2eaa6d5ace | ||
|
|
1a2ab7bc69 | ||
|
|
a96ac73302 | ||
|
|
57094bd017 | ||
|
|
112cddc9ca | ||
|
|
16d5b79d57 | ||
|
|
1201307c73 | ||
|
|
a85741ac37 | ||
|
|
3bd134474b | ||
|
|
b19ead5f9e | ||
|
|
7ff4eec79c | ||
|
|
7aff238eee | ||
|
|
af9d8de515 | ||
|
|
f1f390cfdf | ||
|
|
74014a3854 | ||
|
|
e4a6611865 | ||
|
|
056c9a59b2 | ||
|
|
ae1f2114f5 | ||
|
|
1b1f841c6a | ||
|
|
43a2da9edb | ||
|
|
f6e5791ecd | ||
|
|
843112340e | ||
|
|
7e73f609e5 | ||
|
|
db9616f7ba | ||
|
|
8674604ff5 | ||
|
|
462f7bccf9 | ||
|
|
510e809aba | ||
|
|
951b45b80f | ||
|
|
7b327848d0 | ||
|
|
2f998fce1f | ||
|
|
1816ecb747 | ||
|
|
eacba4fc0b | ||
|
|
9fac7fd932 | ||
|
|
f2b0377c28 | ||
|
|
d933bdbd59 | ||
|
|
f9fa34408d | ||
|
|
857494f6bd | ||
|
|
dff7cae2ee | ||
|
|
0e3fce9b5c | ||
|
|
4b2b14dad1 | ||
|
|
3769739ca7 | ||
|
|
3717812ce0 | ||
|
|
ae64d089c6 | ||
|
|
58b13d51a7 | ||
|
|
5691a8b860 | ||
|
|
f7b4802577 | ||
|
|
8183c2926d | ||
|
|
3c9b9a848f | ||
|
|
3399596e0e | ||
|
|
d32cf21576 | ||
|
|
1926de5a05 | ||
|
|
a4551b027b | ||
|
|
56c776066c | ||
|
|
0229e90dcc | ||
|
|
e420f815dc | ||
|
|
1a7be7b00e | ||
|
|
0f6b7b6a41 | ||
|
|
f202c36106 | ||
|
|
bfa6896678 | ||
|
|
571fd966cb | ||
|
|
f263d6a910 | ||
|
|
972b0b52f9 | ||
|
|
25baa2d894 | ||
|
|
f9769a9fcb | ||
|
|
bb48060b44 | ||
|
|
d043213317 | ||
|
|
5bec5bcf71 | ||
|
|
87ca820f9b | ||
|
|
0b29877790 | ||
|
|
97437feb06 | ||
|
|
2524517986 | ||
|
|
99954c1498 | ||
|
|
2b82c421ad | ||
|
|
4329cc7b8a | ||
|
|
32a4ce94f0 | ||
|
|
340005c5bf | ||
|
|
4b6c3fd4bb | ||
|
|
988112d446 | ||
|
|
1f22b29ca3 | ||
|
|
5292b8b8be | ||
|
|
854f2a913c | ||
|
|
f5316984ab | ||
|
|
e5b739aaeb | ||
|
|
5301648cff | ||
|
|
6d3ee8bb39 | ||
|
|
78143769bf | ||
|
|
dca04c7b61 | ||
|
|
80a41e670d | ||
|
|
9f3feeff8d | ||
|
|
f907182ab2 | ||
|
|
4cf49369b5 | ||
|
|
fda39c11bf | ||
|
|
798846c5b6 | ||
|
|
06617ffd06 | ||
|
|
d24122b706 | ||
|
|
afcabf5244 | ||
|
|
5709bed548 | ||
|
|
68ea096f1b | ||
|
|
714db90832 | ||
|
|
b23425c7c4 | ||
|
|
9ec9dafae6 | ||
|
|
6c312bce7f | ||
|
|
7b6c0232a5 | ||
|
|
4cfaa01c0a | ||
|
|
6b3f9fcde0 | ||
|
|
625e5e913a | ||
|
|
881e92a726 | ||
|
|
0fa303b1cf | ||
|
|
9737e6d52e | ||
|
|
e23d7ff9c0 | ||
|
|
ef686ead37 | ||
|
|
bc06f3dcaf | ||
|
|
8e7032ece8 | ||
|
|
5c5b359bcb | ||
|
|
fc1522ab60 | ||
|
|
2ed768cbf5 | ||
|
|
7119de56ff | ||
|
|
ed513fc7be | ||
|
|
22f25dfcab | ||
|
|
aaa30dcebc | ||
|
|
c935f03467 | ||
|
|
94517c8d5c | ||
|
|
257b1b517d | ||
|
|
aeed4d3041 | ||
|
|
478acfff34 | ||
|
|
10e87f9cdc | ||
|
|
6993a26ba5 | ||
|
|
93ba0332c4 | ||
|
|
9825861f4a | ||
|
|
f4b02f8e39 | ||
|
|
2c6555021f | ||
|
|
3888b9a670 | ||
|
|
1aa7469253 | ||
|
|
3c3ea19620 | ||
|
|
0d2243a393 | ||
|
|
917d753f1c | ||
|
|
a4290048e5 | ||
|
|
cba8b4f8b8 | ||
|
|
6a77a65675 | ||
|
|
16ffc764bf | ||
|
|
cf080a68d6 | ||
|
|
f726150afd | ||
|
|
1f34c8277d | ||
|
|
66cb533f26 | ||
|
|
5145356467 | ||
|
|
77f579dcc8 | ||
|
|
7c0843aad1 | ||
|
|
4e18e71089 | ||
|
|
94bbbf96c7 | ||
|
|
c6e375291a | ||
|
|
c53c55fed0 | ||
|
|
2ca31a9841 | ||
|
|
1b1f0a2d77 | ||
|
|
b099f26376 | ||
|
|
c89db34fc4 | ||
|
|
8c7149063b | ||
|
|
bab7dab4c5 | ||
|
|
51fe97a00c | ||
|
|
daad0a3e11 | ||
|
|
a927787434 | ||
|
|
cbb5ddd944 | ||
|
|
71ba85137f | ||
|
|
a8a9d13dc0 | ||
|
|
1f3218e53f | ||
|
|
08cd5d2503 | ||
|
|
817f2d341d | ||
|
|
794d184c25 | ||
|
|
f94b92df46 | ||
|
|
c215b1ad16 | ||
|
|
5f4f9f0230 | ||
|
|
d73805d7f4 | ||
|
|
d71c6dea7e | ||
|
|
30f4a33f01 | ||
|
|
5c162ccd57 | ||
|
|
d547bcf8d1 | ||
|
|
af2954898e | ||
|
|
b56673c920 | ||
|
|
0c5fefacb4 | ||
|
|
de87e4871b | ||
|
|
39cb2063bf | ||
|
|
d5cc959683 | ||
|
|
a1e857932a | ||
|
|
7550b97e65 | ||
|
|
98b46d48fe | ||
|
|
514dd85199 | ||
|
|
53c25a4778 | ||
|
|
2b0de66216 | ||
|
|
3b25021180 | ||
|
|
abf94627f6 | ||
|
|
6adc810eaa | ||
|
|
a5410c2c19 | ||
|
|
42179578fc | ||
|
|
008c6a4610 | ||
|
|
01280e9b94 | ||
|
|
96d1ba90d7 | ||
|
|
655625ab87 | ||
|
|
c3d9acc9a9 | ||
|
|
a7f4804f53 | ||
|
|
3229e32b4e | ||
|
|
9707a2d57c | ||
|
|
d9d4fb10d9 | ||
|
|
f94ef37b46 | ||
|
|
5c646e2603 | ||
|
|
729d90173f | ||
|
|
2de5479c3f | ||
|
|
01a2b0b289 | ||
|
|
72219eae7d | ||
|
|
6375db1533 | ||
|
|
4e06a46dc5 | ||
|
|
200376b3c4 | ||
|
|
d34b84b531 | ||
|
|
9ff8efc720 | ||
|
|
d1b5f8d9d7 | ||
|
|
31343aa7c3 | ||
|
|
5f44be99ef | ||
|
|
5cc9b820e5 | ||
|
|
f2c8c7a7b8 | ||
|
|
8333b928fa | ||
|
|
c33c8db825 | ||
|
|
e1f8d2adb0 | ||
|
|
8301f7b17f | ||
|
|
93fa9e8991 | ||
|
|
878b67b333 | ||
|
|
0b02a4d42e | ||
|
|
bf0b8170f7 | ||
|
|
b660c4991b | ||
|
|
79f3ce2e9f | ||
|
|
8f87f55d05 | ||
|
|
7fd38788b4 | ||
|
|
0b72f773c7 | ||
|
|
43a6f28620 | ||
|
|
3ac3be99ae | ||
|
|
33b66009e4 | ||
|
|
d6476b6277 | ||
|
|
f2a5fad18f | ||
|
|
ff53add54d | ||
|
|
120f8145fc | ||
|
|
67ebe80dd9 | ||
|
|
ab59c0a658 | ||
|
|
888210ea4a | ||
|
|
9f1fc7ea88 | ||
|
|
96cde407ab | ||
|
|
40c78b0624 | ||
|
|
7cceab1295 | ||
|
|
93ff27053a | ||
|
|
cc53d91d2f | ||
|
|
cd225215b1 | ||
|
|
5c9086ade6 | ||
|
|
99cebec4ab | ||
|
|
87f9aa9d08 | ||
|
|
f4cd4c8e28 | ||
|
|
38ce9d45a5 | ||
|
|
459c7635af | ||
|
|
bc543c1797 | ||
|
|
b490050165 | ||
|
|
682d4075e3 | ||
|
|
4d1986c0e4 | ||
|
|
ee98b9c394 | ||
|
|
8f88c17df9 | ||
|
|
059a1e90b9 | ||
|
|
2222d979cc | ||
|
|
c6ce41bfba | ||
|
|
050007b44d | ||
|
|
68918d632f | ||
|
|
ec8745cf51 | ||
|
|
ff429a259b | ||
|
|
9ab0c81c1d | ||
|
|
7e97f0e898 | ||
|
|
16d303f7cd | ||
|
|
0db60eea85 | ||
|
|
5759313f7f | ||
|
|
824a3a114b | ||
|
|
fb8705dd4d | ||
|
|
d7f90dee1c | ||
|
|
4e5ac27928 | ||
|
|
3f2a727b6d | ||
|
|
26dfcf5395 | ||
|
|
33247c8d85 | ||
|
|
2b60a5c5d6 | ||
|
|
247a56593f | ||
|
|
e338c15433 | ||
|
|
895dadbdbd | ||
|
|
9fa0577c7e | ||
|
|
fc5d274229 | ||
|
|
896cd45939 | ||
|
|
c05f87b50c | ||
|
|
0147dc6302 | ||
|
|
90722875e8 | ||
|
|
45af29291a | ||
|
|
565c73751c | ||
|
|
6501b1b1bb | ||
|
|
b18c8c8e78 | ||
|
|
521ad080f1 | ||
|
|
4d34763f8c | ||
|
|
2af11fea37 | ||
|
|
295bb3227d | ||
|
|
bd39f5f803 | ||
|
|
0aa7baf49a | ||
|
|
c45b5a3d1c | ||
|
|
d19fb6fb0c | ||
|
|
f0c9cb8dc0 | ||
|
|
6b6a00a3d5 | ||
|
|
bdcf2d1348 | ||
|
|
e444cb9da4 | ||
|
|
23ae24b406 | ||
|
|
e644e34545 | ||
|
|
1b5ce8c10e | ||
|
|
02f3b116c6 | ||
|
|
ef94c31ef8 | ||
|
|
1ce576b115 | ||
|
|
65e1d7b2d7 | ||
|
|
069bcd45e5 | ||
|
|
e7819ce909 | ||
|
|
52a32878a9 | ||
|
|
d7fd9b159a | ||
|
|
af6c85308a | ||
|
|
deeac69312 | ||
|
|
c2aa3b90d9 | ||
|
|
42557d7d4c | ||
|
|
fad557485c | ||
|
|
847127f83c | ||
|
|
171480f235 | ||
|
|
b80db81cdd | ||
|
|
30a272ba31 | ||
|
|
7c229c8b81 | ||
|
|
9d66792c2a | ||
|
|
8b958e7e74 | ||
|
|
b0b7b45b94 | ||
|
|
480216f50f | ||
|
|
f231ac39de | ||
|
|
9c392f6a68 | ||
|
|
0ddf3c5289 | ||
|
|
93b615c51d | ||
|
|
dc39ec82fa | ||
|
|
ab4e6a02a5 | ||
|
|
903cff9264 | ||
|
|
abc029d1f4 | ||
|
|
bce3e7cb06 | ||
|
|
117c183fde | ||
|
|
f374b63ac8 | ||
|
|
de44734fe9 | ||
|
|
d8a78374aa | ||
|
|
6987aef38d | ||
|
|
e813f41478 | ||
|
|
61e99bcdcb | ||
|
|
e5dbb652d5 | ||
|
|
3bc5620d74 | ||
|
|
20952c75c5 | ||
|
|
c21c9e13ef | ||
|
|
ef279c5a62 | ||
|
|
c0658a102e | ||
|
|
6406d5a5b9 | ||
|
|
01b78235db | ||
|
|
abbd050a13 | ||
|
|
5d1d47e1f9 | ||
|
|
15844da3af | ||
|
|
65c88b2ff4 | ||
|
|
a82dc263ab | ||
|
|
5053506d88 | ||
|
|
cdf97ab3a6 | ||
|
|
4032455332 | ||
|
|
4186fa10f0 | ||
|
|
b697d0e895 | ||
|
|
b60f51dafc | ||
|
|
c11b3760da | ||
|
|
f19fe50629 | ||
|
|
86dd5adceb | ||
|
|
8d070cf47b | ||
|
|
531c52abe3 | ||
|
|
9317b888f9 | ||
|
|
01b00ad0d5 | ||
|
|
e18686528e | ||
|
|
dec6ad2933 | ||
|
|
da4819a170 | ||
|
|
c84ef57e52 | ||
|
|
92fde6ed26 | ||
|
|
6096a1f30e | ||
|
|
e83bc049df | ||
|
|
ad23774433 | ||
|
|
cccef2e56d | ||
|
|
fb99ee6774 | ||
|
|
c9faf0df74 | ||
|
|
c221eaf0b0 | ||
|
|
fcd5b0817b | ||
|
|
100e4ca67e | ||
|
|
bf5f8b54ae | ||
|
|
9ffc2c1062 | ||
|
|
231a3bf147 | ||
|
|
40f3c24562 | ||
|
|
a29f7f7551 | ||
|
|
9d2e1c67a8 | ||
|
|
5786521103 | ||
|
|
37dd174697 | ||
|
|
b678ea18b2 | ||
|
|
cc482d2d56 | ||
|
|
9c2a73b61e | ||
|
|
d0598c63f3 | ||
|
|
fe8e835bfc | ||
|
|
4ad45934c6 | ||
|
|
522eff6138 | ||
|
|
8380166251 | ||
|
|
cd755fe598 | ||
|
|
133f05dc41 | ||
|
|
2bad430ed8 | ||
|
|
ab71779221 | ||
|
|
737e177163 | ||
|
|
a90b0e302c | ||
|
|
da29cbccfa | ||
|
|
d25469f66e | ||
|
|
e31e7c68c8 | ||
|
|
db566fbb09 | ||
|
|
6473674bbf | ||
|
|
9622e8ac72 | ||
|
|
37d770f814 | ||
|
|
9d1791def8 | ||
|
|
e39e4f6bfb | ||
|
|
b35a1d5681 | ||
|
|
9bc94c502a | ||
|
|
a9dbe39319 | ||
|
|
292752bb78 | ||
|
|
ac64fe03d8 | ||
|
|
2970a18e54 | ||
|
|
c84f63f4dc | ||
|
|
e4e754ee93 | ||
|
|
07e62df558 | ||
|
|
8a65f5a70d | ||
|
|
0da8fe3124 | ||
|
|
ee13d817f1 | ||
|
|
cb6791fb30 | ||
|
|
d19aa9e792 | ||
|
|
2542ca2a49 | ||
|
|
fba802bb03 | ||
|
|
b8114d2b67 | ||
|
|
ca228c4770 | ||
|
|
f49912f92a | ||
|
|
b0cbf16c19 | ||
|
|
4c4ffb9868 | ||
|
|
e52fe03fff | ||
|
|
74dbfe6bb5 | ||
|
|
133370f158 | ||
|
|
a2d544c938 | ||
|
|
88553bb884 | ||
|
|
1afae01311 | ||
|
|
bec100a662 | ||
|
|
7aa25c6762 | ||
|
|
fd281ded3f | ||
|
|
cf1c34605b | ||
|
|
550ff3b4da | ||
|
|
3be3189ee0 | ||
|
|
af86e2939c | ||
|
|
683cfc6f82 | ||
|
|
a65ca24701 | ||
|
|
f24289c47f | ||
|
|
6b299a4287 | ||
|
|
39a6d7cab4 | ||
|
|
0f470326aa | ||
|
|
54d5ff6774 | ||
|
|
ef1668adb3 | ||
|
|
2f398231ac | ||
|
|
d3a4d67a20 | ||
|
|
da5fd53702 | ||
|
|
c70e85a327 | ||
|
|
6011bfa5e3 | ||
|
|
cbe889e10b | ||
|
|
0e3053e4c9 | ||
|
|
c6f30e044b | ||
|
|
fd27988978 | ||
|
|
6c21e15cb9 | ||
|
|
40e37d8b78 | ||
|
|
b798b32b19 | ||
|
|
1f8d1bcdcf | ||
|
|
60065f06b3 | ||
|
|
679da63da6 | ||
|
|
49ed68e98c | ||
|
|
58c890df5d | ||
|
|
8205fe79ce | ||
|
|
ae2b8f7007 | ||
|
|
f609594595 | ||
|
|
77a7de87e1 | ||
|
|
d5c724e5b8 | ||
|
|
9ac48b2aff | ||
|
|
17bf2a62db | ||
|
|
71900968b2 | ||
|
|
ae789f6c16 | ||
|
|
06552f217e | ||
|
|
7a574be3fd | ||
|
|
c8307cdf1e | ||
|
|
566327a948 | ||
|
|
75f117484b | ||
|
|
cba64ebc79 | ||
|
|
4ac2f839bd | ||
|
|
63cda3a6d0 | ||
|
|
f3dda2d85d | ||
|
|
2b98e2f106 | ||
|
|
beb7b8d189 | ||
|
|
7a255efdb2 | ||
|
|
ea73a03553 | ||
|
|
c85f9d681a | ||
|
|
b430c0162c | ||
|
|
859646ef5c | ||
|
|
84891930aa | ||
|
|
4db518b9a3 | ||
|
|
2d45ba47ac | ||
|
|
5ff2bda587 | ||
|
|
4bb72c9ffe | ||
|
|
cca6b6bd0d | ||
|
|
2f2181683c | ||
|
|
7e1ab216e3 | ||
|
|
24a0cc5261 | ||
|
|
5655239f44 | ||
|
|
e6ec83125b | ||
|
|
572440cd23 | ||
|
|
1bb3873338 | ||
|
|
f213f55586 | ||
|
|
2c74e1bba8 | ||
|
|
da342d0b21 | ||
|
|
f61b234252 | ||
|
|
317aebcce6 | ||
|
|
40d01fb20b | ||
|
|
3ae98611f2 | ||
|
|
e8898710d5 | ||
|
|
2254a718c8 | ||
|
|
4d652c7041 | ||
|
|
4bdd9d51bc | ||
|
|
eeec1f32c6 | ||
|
|
a366c05ae2 | ||
|
|
eced091689 | ||
|
|
1ad3fdb40b | ||
|
|
ab7c0e7547 | ||
|
|
08e509978d | ||
|
|
30d8506bc2 | ||
|
|
8be14095fe | ||
|
|
1f4d3d3582 | ||
|
|
f2ede8c7e0 | ||
|
|
78fd487a70 | ||
|
|
4ab479bf58 | ||
|
|
fb44e7b636 | ||
|
|
2b339bfd97 | ||
|
|
f9dd4ed89c | ||
|
|
78c0028179 | ||
|
|
0f277dfa17 | ||
|
|
d4a370a5f2 | ||
|
|
7c534e558d | ||
|
|
0d566aa385 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -26,9 +26,14 @@
|
||||
bin/Debug/*.dll
|
||||
bin/*.dll.mdb
|
||||
bin/*.db
|
||||
bin/*.db-journal
|
||||
bin/addin-db-*
|
||||
bin/*.dll
|
||||
bin/OpenSim.vshost.exe.config
|
||||
bin/OpenSim.32BitLaunch.vshost.exe.config
|
||||
bin/OpenSim.32BitLaunch.log
|
||||
UpgradeLog.XML
|
||||
_UpgradeReport_Files/
|
||||
bin/ScriptEngines/*-*-*-*-*
|
||||
bin/ScriptEngines/*.dll
|
||||
bin/ScriptEngines/*/*.dll
|
||||
@@ -41,6 +46,8 @@ bin/Physics*
|
||||
bin/Terrain*
|
||||
bin/Regions/*
|
||||
bin/UserAssets
|
||||
bin/assetcache
|
||||
bin/maptiles
|
||||
bin/estate_settings.xml
|
||||
bin/config-include/CenomeCache.ini
|
||||
bin/config-include/FlotsamCache.ini
|
||||
|
||||
@@ -135,14 +135,25 @@
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
<target name="torture" depends="build, find-nunit">
|
||||
<target name="test-stress" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.torture">
|
||||
<arg value="./bin/OpenSim.Tests.Torture.dll" />
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.stress">
|
||||
<arg value="./bin/OpenSim.Tests.Stress.dll" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.torture)==0}" />
|
||||
<fail message="Failures reported in stress tests." unless="${int::parse(testresult.opensim.tests.stress)==0}" />
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
<target name="test-perf" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.performance">
|
||||
<arg value="./bin/OpenSim.Tests.Performance.dll" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in performance tests." unless="${int::parse(testresult.opensim.tests.performance)==0}" />
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
|
||||
@@ -91,6 +91,8 @@ what it is today.
|
||||
* Fly-Man
|
||||
* Flyte Xevious
|
||||
* Garmin Kawaguichi
|
||||
* Gryc Ueusp
|
||||
* Hiro Lecker
|
||||
* Imaze Rhiano
|
||||
* Intimidated
|
||||
* Jeremy Bongio (IBM)
|
||||
@@ -143,7 +145,11 @@ what it is today.
|
||||
* sempuki
|
||||
* SignpostMarv
|
||||
* SpotOn3D
|
||||
* Stefan_Boom / stoehr
|
||||
* Strawberry Fride
|
||||
* Talun
|
||||
* TechplexEngineer (Blake Bourque)
|
||||
* TBG Renfold
|
||||
* tglion
|
||||
* tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud)
|
||||
* tyre
|
||||
@@ -202,3 +208,4 @@ In addition, we would like to thank:
|
||||
* The Mono Project
|
||||
* The NANT Developers
|
||||
* Microsoft (.NET, MSSQL-Adapters)
|
||||
*x
|
||||
|
||||
@@ -122,9 +122,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||
Thread.CurrentThread.ManagedThreadId.ToString() +
|
||||
")");
|
||||
|
||||
m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
|
||||
bool changed = m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
|
||||
m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
|
||||
regionsToLoad[i].EstateSettings.Save();
|
||||
if (changed)
|
||||
regionsToLoad[i].EstateSettings.Save();
|
||||
|
||||
if (scene != null)
|
||||
{
|
||||
|
||||
@@ -539,7 +539,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
/// path has not already been registered, the method is added to the active
|
||||
/// handler table.
|
||||
/// </summary>
|
||||
|
||||
public void AddStreamHandler(string httpMethod, string path, RestMethod method)
|
||||
{
|
||||
if (!IsEnabled)
|
||||
|
||||
@@ -101,18 +101,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||
llsdItem.item_id = invItem.ID;
|
||||
llsdItem.name = invItem.Name;
|
||||
llsdItem.parent_id = invItem.Folder;
|
||||
|
||||
try
|
||||
{
|
||||
llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType);
|
||||
llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[WEB FETCH INV DESC HANDLER]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}",
|
||||
invItem.AssetType, invItem.InvType, invItem.Name, e.Message);
|
||||
}
|
||||
llsdItem.type = invItem.AssetType;
|
||||
llsdItem.inv_type = invItem.InvType;
|
||||
|
||||
llsdItem.permissions = new LLSDPermissions();
|
||||
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
|
||||
@@ -126,21 +116,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.sale_info = new LLSDSaleInfo();
|
||||
llsdItem.sale_info.sale_price = invItem.SalePrice;
|
||||
switch (invItem.SaleType)
|
||||
{
|
||||
default:
|
||||
llsdItem.sale_info.sale_type = "not";
|
||||
break;
|
||||
case 1:
|
||||
llsdItem.sale_info.sale_type = "original";
|
||||
break;
|
||||
case 2:
|
||||
llsdItem.sale_info.sale_type = "copy";
|
||||
break;
|
||||
case 3:
|
||||
llsdItem.sale_info.sale_type = "contents";
|
||||
break;
|
||||
}
|
||||
llsdItem.sale_info.sale_type = invItem.SaleType;
|
||||
|
||||
return llsdItem;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||
|
||||
FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService);
|
||||
IRequestHandler reqHandler
|
||||
= new RestStreamHandler("POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest);
|
||||
= new RestStreamHandler(
|
||||
"POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest, "FetchInventory", null);
|
||||
server.AddStreamHandler(reqHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,13 +66,14 @@ namespace OpenSim.Capabilities.Handlers
|
||||
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||
|
||||
GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
|
||||
IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(),
|
||||
delegate(Hashtable m_dhttpMethod)
|
||||
{
|
||||
return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null);
|
||||
});
|
||||
IRequestHandler reqHandler
|
||||
= new RestHTTPHandler(
|
||||
"GET",
|
||||
"/CAPS/" + UUID.Random(),
|
||||
httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
|
||||
"GetMesh",
|
||||
null);
|
||||
server.AddStreamHandler(reqHandler);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,8 +58,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
|
||||
public GetTextureHandler(string path, IAssetService assService) :
|
||||
base("GET", path)
|
||||
public GetTextureHandler(string path, IAssetService assService, string name, string description)
|
||||
: base("GET", path, name, description)
|
||||
{
|
||||
m_assetService = assService;
|
||||
}
|
||||
@@ -77,7 +77,6 @@ namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return null;
|
||||
}
|
||||
|
||||
UUID textureID;
|
||||
@@ -115,7 +114,6 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
|
||||
// textureID, httpResponse.StatusCode, httpResponse.ContentLength);
|
||||
|
||||
httpResponse.Send();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||
if (m_AssetService == null)
|
||||
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||
|
||||
server.AddStreamHandler(new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService));
|
||||
server.AddStreamHandler(
|
||||
new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,9 +50,9 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Overkill - we only really need the asset service, not a whole scene.
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService);
|
||||
GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService, "TestGetTexture", null);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012");
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||
uploader.OnUpLoad += BakedTextureUploaded;
|
||||
|
||||
m_HostCapsObj.HttpListener.AddStreamHandler(
|
||||
new BinaryStreamHandler("POST", capsBase + uploaderPath,
|
||||
uploader.uploaderCaps));
|
||||
new BinaryStreamHandler(
|
||||
"POST", capsBase + uploaderPath, uploader.uploaderCaps, "UploadBakedTexture", null));
|
||||
|
||||
string protocol = "http://";
|
||||
|
||||
|
||||
@@ -156,11 +156,12 @@ namespace OpenSim.Capabilities.Handlers
|
||||
inv.Folders = new List<InventoryFolderBase>();
|
||||
inv.Items = new List<InventoryItemBase>();
|
||||
int version = 0;
|
||||
int descendents = 0;
|
||||
|
||||
inv
|
||||
= Fetch(
|
||||
invFetch.owner_id, invFetch.folder_id, invFetch.owner_id,
|
||||
invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
|
||||
invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version, out descendents);
|
||||
|
||||
if (inv != null && inv.Folders != null)
|
||||
{
|
||||
@@ -168,6 +169,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
contents.categories.Array.Add(ConvertInventoryFolder(invFolder));
|
||||
}
|
||||
|
||||
descendents += inv.Folders.Count;
|
||||
}
|
||||
|
||||
if (inv != null && inv.Items != null)
|
||||
@@ -178,7 +181,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
}
|
||||
}
|
||||
|
||||
contents.descendents = contents.items.Array.Count + contents.categories.Array.Count;
|
||||
contents.descendents = descendents;
|
||||
contents.version = version;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
@@ -206,7 +209,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
/// <returns>An empty InventoryCollection if the inventory look up failed</returns>
|
||||
private InventoryCollection Fetch(
|
||||
UUID agentID, UUID folderID, UUID ownerID,
|
||||
bool fetchFolders, bool fetchItems, int sortOrder, out int version)
|
||||
bool fetchFolders, bool fetchItems, int sortOrder, out int version, out int descendents)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
|
||||
@@ -215,6 +218,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// FIXME MAYBE: We're not handling sortOrder!
|
||||
|
||||
version = 0;
|
||||
descendents = 0;
|
||||
|
||||
InventoryFolderImpl fold;
|
||||
if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner)
|
||||
{
|
||||
@@ -223,6 +228,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
InventoryCollection ret = new InventoryCollection();
|
||||
ret.Folders = new List<InventoryFolderBase>();
|
||||
ret.Items = fold.RequestListOfItems();
|
||||
descendents = ret.Folders.Count + ret.Items.Count;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -246,24 +252,72 @@ namespace OpenSim.Capabilities.Handlers
|
||||
|
||||
version = containingFolder.Version;
|
||||
|
||||
// if (fetchItems)
|
||||
if (fetchItems)
|
||||
{
|
||||
List<InventoryItemBase> itemsToReturn = contents.Items;
|
||||
List<InventoryItemBase> originalItems = new List<InventoryItemBase>(itemsToReturn);
|
||||
|
||||
// descendents must only include the links, not the linked items we add
|
||||
descendents = originalItems.Count;
|
||||
|
||||
// Add target items for links in this folder before the links themselves.
|
||||
foreach (InventoryItemBase item in originalItems)
|
||||
{
|
||||
if (item.AssetType == (int)AssetType.Link)
|
||||
{
|
||||
InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
|
||||
|
||||
// Take care of genuinely broken links where the target doesn't exist
|
||||
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
|
||||
// but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
|
||||
// rather than having to keep track of every folder requested in the recursion.
|
||||
if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
|
||||
itemsToReturn.Insert(0, linkedItem);
|
||||
}
|
||||
}
|
||||
|
||||
// Now scan for folder links and insert the items they target and those links at the head of the return data
|
||||
foreach (InventoryItemBase item in originalItems)
|
||||
{
|
||||
if (item.AssetType == (int)AssetType.LinkFolder)
|
||||
{
|
||||
InventoryCollection linkedFolderContents = m_InventoryService.GetFolderContent(ownerID, item.AssetID);
|
||||
List<InventoryItemBase> links = linkedFolderContents.Items;
|
||||
|
||||
itemsToReturn.InsertRange(0, links);
|
||||
|
||||
foreach (InventoryItemBase link in linkedFolderContents.Items)
|
||||
{
|
||||
// Take care of genuinely broken links where the target doesn't exist
|
||||
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
|
||||
// but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
|
||||
// rather than having to keep track of every folder requested in the recursion.
|
||||
if (link != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Adding item {0} {1} from folder {2} linked from {3}",
|
||||
// link.Name, (AssetType)link.AssetType, item.AssetID, containingFolder.Name);
|
||||
|
||||
InventoryItemBase linkedItem
|
||||
= m_InventoryService.GetItem(new InventoryItemBase(link.AssetID));
|
||||
|
||||
if (linkedItem != null)
|
||||
itemsToReturn.Insert(0, linkedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// foreach (InventoryItemBase item in contents.Items)
|
||||
// {
|
||||
// List<InventoryItemBase> linkedItemsToAdd = new List<InventoryItemBase>();
|
||||
//
|
||||
// foreach (InventoryItemBase item in contents.Items)
|
||||
// {
|
||||
// if (item.AssetType == (int)AssetType.Link)
|
||||
// {
|
||||
// InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
|
||||
//
|
||||
// // Take care of genuinely broken links where the target doesn't exist
|
||||
// // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
|
||||
// // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
|
||||
// // rather than having to keep track of every folder requested in the recursion.
|
||||
// if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
|
||||
// linkedItemsToAdd.Insert(0, linkedItem);
|
||||
// }
|
||||
// }
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Returning item {0}, type {1}, parent {2} in {3} {4}",
|
||||
// item.Name, (AssetType)item.AssetType, item.Folder, containingFolder.Name, containingFolder.ID);
|
||||
// }
|
||||
|
||||
// =====
|
||||
|
||||
//
|
||||
// foreach (InventoryItemBase linkedItem in linkedItemsToAdd)
|
||||
// {
|
||||
@@ -340,12 +394,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||
llsdFolder.folder_id = invFolder.ID;
|
||||
llsdFolder.parent_id = invFolder.ParentID;
|
||||
llsdFolder.name = invFolder.Name;
|
||||
|
||||
if (invFolder.Type == (short)AssetType.Unknown || !Enum.IsDefined(typeof(AssetType), (sbyte)invFolder.Type))
|
||||
llsdFolder.type = "-1";
|
||||
else
|
||||
llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type);
|
||||
llsdFolder.preferred_type = "-1";
|
||||
llsdFolder.type = invFolder.Type;
|
||||
llsdFolder.preferred_type = -1;
|
||||
|
||||
return llsdFolder;
|
||||
}
|
||||
@@ -365,18 +415,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||
llsdItem.item_id = invItem.ID;
|
||||
llsdItem.name = invItem.Name;
|
||||
llsdItem.parent_id = invItem.Folder;
|
||||
|
||||
try
|
||||
{
|
||||
llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType);
|
||||
llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[WEB FETCH INV DESC HANDLER]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}",
|
||||
invItem.AssetType, invItem.InvType, invItem.Name, e.Message);
|
||||
}
|
||||
llsdItem.type = invItem.AssetType;
|
||||
llsdItem.inv_type = invItem.InvType;
|
||||
|
||||
llsdItem.permissions = new LLSDPermissions();
|
||||
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
|
||||
@@ -390,21 +430,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.sale_info = new LLSDSaleInfo();
|
||||
llsdItem.sale_info.sale_price = invItem.SalePrice;
|
||||
switch (invItem.SaleType)
|
||||
{
|
||||
default:
|
||||
llsdItem.sale_info.sale_type = "not";
|
||||
break;
|
||||
case 1:
|
||||
llsdItem.sale_info.sale_type = "original";
|
||||
break;
|
||||
case 2:
|
||||
llsdItem.sale_info.sale_type = "copy";
|
||||
break;
|
||||
case 3:
|
||||
llsdItem.sale_info.sale_type = "contents";
|
||||
break;
|
||||
}
|
||||
llsdItem.sale_info.sale_type = invItem.SaleType;
|
||||
|
||||
return llsdItem;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,13 @@ namespace OpenSim.Capabilities.Handlers
|
||||
ServerUtils.LoadPlugin<ILibraryService>(libService, args);
|
||||
|
||||
WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
|
||||
IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, webFetchHandler.FetchInventoryDescendentsRequest);
|
||||
IRequestHandler reqHandler
|
||||
= new RestStreamHandler(
|
||||
"POST",
|
||||
"/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/,
|
||||
webFetchHandler.FetchInventoryDescendentsRequest,
|
||||
"WebFetchInvDesc",
|
||||
null);
|
||||
server.AddStreamHandler(reqHandler);
|
||||
}
|
||||
|
||||
|
||||
68
OpenSim/Capabilities/LLSDEnvironmentSettings.cs
Normal file
68
OpenSim/Capabilities/LLSDEnvironmentSettings.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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 OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
[OSDMap]
|
||||
public class LLSDEnvironmentRequest
|
||||
{
|
||||
public UUID messageID;
|
||||
public UUID regionID;
|
||||
}
|
||||
|
||||
[OSDMap]
|
||||
public class LLSDEnvironmentSetResponse
|
||||
{
|
||||
public UUID regionID;
|
||||
public UUID messageID;
|
||||
public Boolean success;
|
||||
public String fail_reason;
|
||||
}
|
||||
|
||||
public class EnvironmentSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// generates a empty llsd settings response for viewer
|
||||
/// </summary>
|
||||
/// <param name="messageID">the message UUID</param>
|
||||
/// <param name="regionID">the region UUID</param>
|
||||
public static string EmptySettings(UUID messageID, UUID regionID)
|
||||
{
|
||||
OSDArray arr = new OSDArray();
|
||||
LLSDEnvironmentRequest msg = new LLSDEnvironmentRequest();
|
||||
msg.messageID = messageID;
|
||||
msg.regionID = regionID;
|
||||
arr.Array.Add(msg);
|
||||
return LLSDHelpers.SerialiseLLSDReply(arr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
public UUID folder_id;
|
||||
public UUID parent_id;
|
||||
public string name;
|
||||
public string type;
|
||||
public string preferred_type;
|
||||
public int type;
|
||||
public int preferred_type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ namespace OpenSim.Framework.Capabilities
|
||||
public UUID asset_id;
|
||||
public UUID item_id;
|
||||
public LLSDPermissions permissions;
|
||||
public string type;
|
||||
public string inv_type;
|
||||
public int type;
|
||||
public int inv_type;
|
||||
public int flags;
|
||||
|
||||
public LLSDSaleInfo sale_info;
|
||||
@@ -65,7 +65,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
public class LLSDSaleInfo
|
||||
{
|
||||
public int sale_price;
|
||||
public string sale_type;
|
||||
public int sale_type;
|
||||
}
|
||||
|
||||
[OSDMap]
|
||||
|
||||
@@ -39,7 +39,11 @@ namespace OpenSim.Framework.Capabilities
|
||||
private LLSDMethod<TRequest, TResponse> m_method;
|
||||
|
||||
public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
|
||||
: base(httpMethod, path)
|
||||
: this(httpMethod, path, method, null, null) {}
|
||||
|
||||
public LLSDStreamhandler(
|
||||
string httpMethod, string path, LLSDMethod<TRequest, TResponse> method, string name, string description)
|
||||
: base(httpMethod, path, name, description)
|
||||
{
|
||||
m_method = method;
|
||||
}
|
||||
@@ -62,9 +66,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
|
||||
TResponse response = m_method(llsdRequest);
|
||||
|
||||
Encoding encoding = new UTF8Encoding(false);
|
||||
|
||||
return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
|
||||
return Util.UTF8NoBomEncoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenSim.ConsoleClient
|
||||
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
|
||||
byte[] buffer = new System.Text.ASCIIEncoding().GetBytes(data);
|
||||
byte[] buffer = Encoding.ASCII.GetBytes(data);
|
||||
int length = (int) buffer.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
|
||||
@@ -40,6 +40,11 @@ namespace OpenSim.Data
|
||||
public UUID folderID;
|
||||
public UUID agentID;
|
||||
public UUID parentFolderID;
|
||||
|
||||
public XInventoryFolder Clone()
|
||||
{
|
||||
return (XInventoryFolder)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public class XInventoryItem
|
||||
@@ -64,6 +69,11 @@ namespace OpenSim.Data
|
||||
public UUID avatarID;
|
||||
public UUID parentFolderID;
|
||||
public int inventoryGroupPermissions;
|
||||
|
||||
public XInventoryItem Clone()
|
||||
{
|
||||
return (XInventoryItem)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IXInventoryData
|
||||
|
||||
@@ -1181,6 +1181,72 @@ VALUES
|
||||
// }
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Environment Settings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
string sql = "select * from [regionenvironment] where region_id = @region_id";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID));
|
||||
conn.Open();
|
||||
using (SqlDataReader result = cmd.ExecuteReader())
|
||||
{
|
||||
if (!result.Read())
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToString(result["llsd_settings"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
||||
{
|
||||
{
|
||||
string sql = "DELETE FROM [regionenvironment] WHERE region_id = @region_id";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID));
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
sql = "INSERT INTO [regionenvironment] (region_id, llsd_settings) VALUES (@region_id, @llsd_settings)";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@llsd_settings", settings));
|
||||
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
string sql = "delete from [regionenvironment] where region_id = @region_id";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionUUID));
|
||||
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Loads the settings of a region.
|
||||
/// </summary>
|
||||
@@ -2136,5 +2202,18 @@ VALUES
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveExtra(UUID regionID, string name, string value)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveExtra(UUID regionID, string name)
|
||||
{
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetExtra(UUID regionID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1134,3 +1134,17 @@ ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0;
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 37 #---------------- Environment Settings
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
CREATE TABLE [dbo].[regionenvironment](
|
||||
[region_id] [uniqueidentifier] NOT NULL,
|
||||
[llsd_settings] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[region_id] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
COMMIT
|
||||
|
||||
@@ -163,52 +163,51 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd =
|
||||
using (MySqlCommand cmd =
|
||||
new MySqlCommand(
|
||||
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
|
||||
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
|
||||
dbcon);
|
||||
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
dbcon))
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add");
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
|
||||
}
|
||||
|
||||
// need to ensure we dispose
|
||||
try
|
||||
{
|
||||
using (cmd)
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?name", assetName);
|
||||
cmd.Parameters.AddWithValue("?description", assetDescription);
|
||||
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
||||
cmd.Parameters.AddWithValue("?local", asset.Local);
|
||||
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
||||
cmd.Parameters.AddWithValue("?create_time", now);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Dispose();
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add");
|
||||
}
|
||||
|
||||
string assetDescription = asset.Description;
|
||||
if (asset.Description.Length > 64)
|
||||
{
|
||||
assetDescription = asset.Description.Substring(0, 64);
|
||||
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (cmd)
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?name", assetName);
|
||||
cmd.Parameters.AddWithValue("?description", assetDescription);
|
||||
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
||||
cmd.Parameters.AddWithValue("?local", asset.Local);
|
||||
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
||||
cmd.Parameters.AddWithValue("?create_time", now);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
|
||||
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
|
||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
||||
asset.FullID, asset.Name, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,33 +220,31 @@ namespace OpenSim.Data.MySQL
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd =
|
||||
new MySqlCommand("update assets set access_time=?access_time where id=?id",
|
||||
dbcon);
|
||||
|
||||
// need to ensure we dispose
|
||||
try
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon))
|
||||
{
|
||||
using (cmd)
|
||||
try
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Dispose();
|
||||
using (cmd)
|
||||
{
|
||||
// create unix epoch time
|
||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||
cmd.Parameters.AddWithValue("?id", asset.ID);
|
||||
cmd.Parameters.AddWithValue("?access_time", now);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASSETS DB]: " +
|
||||
"MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString()
|
||||
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASSETS DB]: " +
|
||||
"MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString()
|
||||
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -310,35 +307,41 @@ namespace OpenSim.Data.MySQL
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count", dbcon);
|
||||
cmd.Parameters.AddWithValue("?start", start);
|
||||
cmd.Parameters.AddWithValue("?count", count);
|
||||
|
||||
try
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand(
|
||||
"SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count",
|
||||
dbcon))
|
||||
{
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
cmd.Parameters.AddWithValue("?start", start);
|
||||
cmd.Parameters.AddWithValue("?count", count);
|
||||
|
||||
try
|
||||
{
|
||||
while (dbReader.Read())
|
||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||
{
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
metadata.Name = (string)dbReader["name"];
|
||||
metadata.Description = (string)dbReader["description"];
|
||||
metadata.Type = (sbyte)dbReader["assetType"];
|
||||
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
|
||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
|
||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||
|
||||
// Current SHA1s are not stored/computed.
|
||||
metadata.SHA1 = new byte[] { };
|
||||
|
||||
retList.Add(metadata);
|
||||
while (dbReader.Read())
|
||||
{
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
metadata.Name = (string)dbReader["name"];
|
||||
metadata.Description = (string)dbReader["description"];
|
||||
metadata.Type = (sbyte)dbReader["assetType"];
|
||||
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
|
||||
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
|
||||
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
|
||||
metadata.CreatorID = dbReader["CreatorID"].ToString();
|
||||
|
||||
// Current SHA1s are not stored/computed.
|
||||
metadata.SHA1 = new byte[] { };
|
||||
|
||||
retList.Add(metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[ASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[ASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,11 +356,12 @@ namespace OpenSim.Data.MySQL
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon);
|
||||
cmd.Parameters.AddWithValue("?id", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.Dispose();
|
||||
using (MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?id", id);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,4 +370,4 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,41 +70,52 @@ namespace OpenSim.Data.MySQL
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID", dbcon);
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
|
||||
IDataReader result = cmd.ExecuteReader();
|
||||
|
||||
if (result.Read())
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID", dbcon))
|
||||
{
|
||||
ret.PrincipalID = principalID;
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
|
||||
if (m_ColumnNames == null)
|
||||
IDataReader result = cmd.ExecuteReader();
|
||||
|
||||
if (result.Read())
|
||||
{
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
ret.PrincipalID = principalID;
|
||||
|
||||
CheckColumnNames(result);
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
if (s == "UUID")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
else
|
||||
{
|
||||
if (s == "UUID")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
return null;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckColumnNames(IDataReader result)
|
||||
{
|
||||
if (m_ColumnNames != null)
|
||||
return;
|
||||
|
||||
List<string> columnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
columnNames.Add(row["ColumnName"].ToString());
|
||||
|
||||
m_ColumnNames = columnNames;
|
||||
}
|
||||
|
||||
public bool Store(AuthenticationData data)
|
||||
{
|
||||
if (data.Data.ContainsKey("UUID"))
|
||||
@@ -112,57 +123,53 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
string update = "update `"+m_Realm+"` set ";
|
||||
bool first = true;
|
||||
foreach (string field in fields)
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
if (!first)
|
||||
update += ", ";
|
||||
update += "`" + field + "` = ?"+field;
|
||||
|
||||
first = false;
|
||||
|
||||
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
|
||||
}
|
||||
|
||||
update += " where UUID = ?principalID";
|
||||
|
||||
cmd.CommandText = update;
|
||||
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) < 1)
|
||||
{
|
||||
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
||||
String.Join("`, `", fields) +
|
||||
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
|
||||
|
||||
cmd.CommandText = insert;
|
||||
|
||||
string update = "update `"+m_Realm+"` set ";
|
||||
bool first = true;
|
||||
foreach (string field in fields)
|
||||
{
|
||||
if (!first)
|
||||
update += ", ";
|
||||
update += "`" + field + "` = ?"+field;
|
||||
|
||||
first = false;
|
||||
|
||||
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
|
||||
}
|
||||
|
||||
update += " where UUID = ?principalID";
|
||||
|
||||
cmd.CommandText = update;
|
||||
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) < 1)
|
||||
{
|
||||
cmd.Dispose();
|
||||
return false;
|
||||
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
||||
String.Join("`, `", fields) +
|
||||
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
|
||||
|
||||
cmd.CommandText = insert;
|
||||
|
||||
if (ExecuteNonQuery(cmd) < 1)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetDataItem(UUID principalID, string item, string value)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand("update `" + m_Realm +
|
||||
"` set `" + item + "` = ?" + item + " where UUID = ?UUID");
|
||||
|
||||
|
||||
cmd.Parameters.AddWithValue("?"+item, value);
|
||||
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand("update `" + m_Realm + "` set `" + item + "` = ?" + item + " where UUID = ?UUID"))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?"+item, value);
|
||||
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -172,18 +179,18 @@ namespace OpenSim.Data.MySQL
|
||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||
DoExpire();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand("insert into tokens (UUID, token, validity) values (?principalID, ?token, date_add(now(), interval ?lifetime minute))");
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?token", token);
|
||||
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand(
|
||||
"insert into tokens (UUID, token, validity) values (?principalID, ?token, date_add(now(), interval ?lifetime minute))"))
|
||||
{
|
||||
cmd.Dispose();
|
||||
return true;
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?token", token);
|
||||
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -192,30 +199,29 @@ namespace OpenSim.Data.MySQL
|
||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||
DoExpire();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand("update tokens set validity = date_add(now(), interval ?lifetime minute) where UUID = ?principalID and token = ?token and validity > now()");
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?token", token);
|
||||
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
using (MySqlCommand cmd
|
||||
= new MySqlCommand(
|
||||
"update tokens set validity = date_add(now(), interval ?lifetime minute) where UUID = ?principalID and token = ?token and validity > now()"))
|
||||
{
|
||||
cmd.Dispose();
|
||||
return true;
|
||||
}
|
||||
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?token", token);
|
||||
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
|
||||
|
||||
cmd.Dispose();
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void DoExpire()
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand("delete from tokens where validity < now()");
|
||||
ExecuteNonQuery(cmd);
|
||||
|
||||
cmd.Dispose();
|
||||
using (MySqlCommand cmd = new MySqlCommand("delete from tokens where validity < now()"))
|
||||
{
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
|
||||
m_LastExpire = System.Environment.TickCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,14 +52,15 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public bool Delete(UUID principalID, string name)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Name", name);
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Name", name);
|
||||
|
||||
if (ExecuteNonQuery(cmd) > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -49,34 +49,38 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public bool Delete(string principalID, string friend)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Friend", friend);
|
||||
|
||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Friend", friend);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public FriendsData[] GetFriends(UUID principalID)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
|
||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
|
||||
|
||||
return DoQuery(cmd);
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public FriendsData[] GetFriends(string principalID)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID LIKE ?PrincipalID", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%');
|
||||
|
||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID LIKE ?PrincipalID", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%');
|
||||
return DoQuery(cmd);
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,15 +91,17 @@ namespace OpenSim.Data.MySQL
|
||||
if (m_ColumnNames != null)
|
||||
return;
|
||||
|
||||
m_ColumnNames = new List<string>();
|
||||
List<string> columnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = reader.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
{
|
||||
if (row["ColumnName"] != null &&
|
||||
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
columnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
|
||||
m_ColumnNames = columnNames;
|
||||
}
|
||||
|
||||
public virtual T[] Get(string field, string key)
|
||||
|
||||
@@ -467,43 +467,43 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand result = new MySqlCommand(sql, dbcon);
|
||||
result.Parameters.AddWithValue("?inventoryID", item.ID.ToString());
|
||||
result.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
|
||||
result.Parameters.AddWithValue("?assetType", item.AssetType.ToString());
|
||||
result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString());
|
||||
result.Parameters.AddWithValue("?avatarID", item.Owner.ToString());
|
||||
result.Parameters.AddWithValue("?inventoryName", itemName);
|
||||
result.Parameters.AddWithValue("?inventoryDescription", itemDesc);
|
||||
result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString());
|
||||
result.Parameters.AddWithValue("?inventoryCurrentPermissions",
|
||||
item.CurrentPermissions.ToString());
|
||||
result.Parameters.AddWithValue("?invType", item.InvType);
|
||||
result.Parameters.AddWithValue("?creatorID", item.CreatorId);
|
||||
result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
|
||||
result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
|
||||
result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
|
||||
result.Parameters.AddWithValue("?salePrice", item.SalePrice);
|
||||
result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
|
||||
result.Parameters.AddWithValue("?creationDate", item.CreationDate);
|
||||
result.Parameters.AddWithValue("?groupID", item.GroupID);
|
||||
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
|
||||
result.Parameters.AddWithValue("?flags", item.Flags);
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlCommand result = new MySqlCommand(sql, dbcon))
|
||||
{
|
||||
result.ExecuteNonQuery();
|
||||
result.Parameters.AddWithValue("?inventoryID", item.ID.ToString());
|
||||
result.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
|
||||
result.Parameters.AddWithValue("?assetType", item.AssetType.ToString());
|
||||
result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString());
|
||||
result.Parameters.AddWithValue("?avatarID", item.Owner.ToString());
|
||||
result.Parameters.AddWithValue("?inventoryName", itemName);
|
||||
result.Parameters.AddWithValue("?inventoryDescription", itemDesc);
|
||||
result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString());
|
||||
result.Parameters.AddWithValue("?inventoryCurrentPermissions",
|
||||
item.CurrentPermissions.ToString());
|
||||
result.Parameters.AddWithValue("?invType", item.InvType);
|
||||
result.Parameters.AddWithValue("?creatorID", item.CreatorId);
|
||||
result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
|
||||
result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
|
||||
result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
|
||||
result.Parameters.AddWithValue("?salePrice", item.SalePrice);
|
||||
result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
|
||||
result.Parameters.AddWithValue("?creationDate", item.CreationDate);
|
||||
result.Parameters.AddWithValue("?groupID", item.GroupID);
|
||||
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
|
||||
result.Parameters.AddWithValue("?flags", item.Flags);
|
||||
|
||||
lock (m_dbLock)
|
||||
result.ExecuteNonQuery();
|
||||
|
||||
result.Dispose();
|
||||
}
|
||||
|
||||
result.Dispose();
|
||||
|
||||
result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon);
|
||||
result.Parameters.AddWithValue("?folderID", item.Folder.ToString());
|
||||
lock (m_dbLock)
|
||||
using (MySqlCommand result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon))
|
||||
{
|
||||
result.ExecuteNonQuery();
|
||||
result.Parameters.AddWithValue("?folderID", item.Folder.ToString());
|
||||
|
||||
lock (m_dbLock)
|
||||
result.ExecuteNonQuery();
|
||||
}
|
||||
result.Dispose();
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
@@ -533,12 +533,12 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon);
|
||||
cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
|
||||
|
||||
lock (m_dbLock)
|
||||
using (MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
|
||||
|
||||
lock (m_dbLock)
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -579,24 +579,26 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
|
||||
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
||||
cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString());
|
||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
||||
cmd.Parameters.AddWithValue("?folderName", folderName);
|
||||
cmd.Parameters.AddWithValue("?type", folder.Type);
|
||||
cmd.Parameters.AddWithValue("?version", folder.Version);
|
||||
using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
||||
cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString());
|
||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
||||
cmd.Parameters.AddWithValue("?folderName", folderName);
|
||||
cmd.Parameters.AddWithValue("?type", folder.Type);
|
||||
cmd.Parameters.AddWithValue("?version", folder.Version);
|
||||
|
||||
try
|
||||
{
|
||||
lock (m_dbLock)
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
lock (m_dbLock)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -624,20 +626,22 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
|
||||
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
||||
|
||||
try
|
||||
using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
|
||||
{
|
||||
lock (m_dbLock)
|
||||
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
|
||||
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
lock (m_dbLock)
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,13 +63,14 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public void LogoutRegionAgents(UUID regionID)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReportAgent(UUID sessionID, UUID regionID)
|
||||
@@ -81,17 +82,18 @@ namespace OpenSim.Data.MySQL
|
||||
if (regionID == UUID.Zero)
|
||||
return false;
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) == 0)
|
||||
return false;
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm);
|
||||
|
||||
cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,17 +162,7 @@ namespace OpenSim.Data.MySQL
|
||||
ret.sizeX = Convert.ToInt32(result["sizeX"]);
|
||||
ret.sizeY = Convert.ToInt32(result["sizeY"]);
|
||||
|
||||
if (m_ColumnNames == null)
|
||||
{
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
{
|
||||
if (row["ColumnName"] != null)
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
}
|
||||
CheckColumnNames(result);
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
@@ -187,7 +177,11 @@ namespace OpenSim.Data.MySQL
|
||||
if (s == "locY")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
object value = result[s];
|
||||
if (value is DBNull)
|
||||
ret.Data[s] = null;
|
||||
else
|
||||
ret.Data[s] = result[s].ToString();
|
||||
}
|
||||
|
||||
retList.Add(ret);
|
||||
@@ -198,6 +192,23 @@ namespace OpenSim.Data.MySQL
|
||||
return retList;
|
||||
}
|
||||
|
||||
private void CheckColumnNames(IDataReader result)
|
||||
{
|
||||
if (m_ColumnNames != null)
|
||||
return;
|
||||
|
||||
List<string> columnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
{
|
||||
if (row["ColumnName"] != null)
|
||||
columnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
|
||||
m_ColumnNames = columnNames;
|
||||
}
|
||||
|
||||
public bool Store(RegionData data)
|
||||
{
|
||||
if (data.Data.ContainsKey("uuid"))
|
||||
@@ -318,11 +329,12 @@ namespace OpenSim.Data.MySQL
|
||||
if (scopeID != UUID.Zero)
|
||||
command += " and ScopeID = ?scopeID";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command);
|
||||
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
return RunCommand(cmd);
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
return RunCommand(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,114 +129,114 @@ namespace OpenSim.Data.MySQL
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
MySqlCommand cmd = dbcon.CreateCommand();
|
||||
|
||||
foreach (SceneObjectPart prim in obj.Parts)
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "replace into prims (" +
|
||||
"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, " +
|
||||
"RotationW, SitTargetOffsetX, " +
|
||||
"SitTargetOffsetY, SitTargetOffsetZ, " +
|
||||
"SitTargetOrientW, SitTargetOrientX, " +
|
||||
"SitTargetOrientY, SitTargetOrientZ, " +
|
||||
"RegionUUID, CreatorID, " +
|
||||
"OwnerID, GroupID, " +
|
||||
"LastOwnerID, SceneGroupID, " +
|
||||
"PayPrice, PayButton1, " +
|
||||
"PayButton2, PayButton3, " +
|
||||
"PayButton4, LoopedSound, " +
|
||||
"LoopedSoundGain, TextureAnimation, " +
|
||||
"OmegaX, 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) 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, " +
|
||||
"?RotationW, ?SitTargetOffsetX, " +
|
||||
"?SitTargetOffsetY, ?SitTargetOffsetZ, " +
|
||||
"?SitTargetOrientW, ?SitTargetOrientX, " +
|
||||
"?SitTargetOrientY, ?SitTargetOrientZ, " +
|
||||
"?RegionUUID, ?CreatorID, ?OwnerID, " +
|
||||
"?GroupID, ?LastOwnerID, ?SceneGroupID, " +
|
||||
"?PayPrice, ?PayButton1, ?PayButton2, " +
|
||||
"?PayButton3, ?PayButton4, ?LoopedSound, " +
|
||||
"?LoopedSoundGain, ?TextureAnimation, " +
|
||||
"?OmegaX, ?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)";
|
||||
|
||||
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "replace into primshapes (" +
|
||||
"UUID, Shape, ScaleX, ScaleY, " +
|
||||
"ScaleZ, PCode, PathBegin, PathEnd, " +
|
||||
"PathScaleX, PathScaleY, PathShearX, " +
|
||||
"PathShearY, PathSkew, PathCurve, " +
|
||||
"PathRadiusOffset, PathRevolutions, " +
|
||||
"PathTaperX, PathTaperY, PathTwist, " +
|
||||
"PathTwistBegin, ProfileBegin, ProfileEnd, " +
|
||||
"ProfileCurve, ProfileHollow, Texture, " +
|
||||
"ExtraParams, State, Media) values (?UUID, " +
|
||||
"?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
|
||||
"?PCode, ?PathBegin, ?PathEnd, " +
|
||||
"?PathScaleX, ?PathScaleY, " +
|
||||
"?PathShearX, ?PathShearY, " +
|
||||
"?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
|
||||
"?PathRevolutions, ?PathTaperX, " +
|
||||
"?PathTaperY, ?PathTwist, " +
|
||||
"?PathTwistBegin, ?ProfileBegin, " +
|
||||
"?ProfileEnd, ?ProfileCurve, " +
|
||||
"?ProfileHollow, ?Texture, ?ExtraParams, " +
|
||||
"?State, ?Media)";
|
||||
|
||||
FillShapeCommand(cmd, prim);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
foreach (SceneObjectPart prim in obj.Parts)
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "replace into prims (" +
|
||||
"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, " +
|
||||
"RotationW, SitTargetOffsetX, " +
|
||||
"SitTargetOffsetY, SitTargetOffsetZ, " +
|
||||
"SitTargetOrientW, SitTargetOrientX, " +
|
||||
"SitTargetOrientY, SitTargetOrientZ, " +
|
||||
"RegionUUID, CreatorID, " +
|
||||
"OwnerID, GroupID, " +
|
||||
"LastOwnerID, SceneGroupID, " +
|
||||
"PayPrice, PayButton1, " +
|
||||
"PayButton2, PayButton3, " +
|
||||
"PayButton4, LoopedSound, " +
|
||||
"LoopedSoundGain, TextureAnimation, " +
|
||||
"OmegaX, 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) 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, " +
|
||||
"?RotationW, ?SitTargetOffsetX, " +
|
||||
"?SitTargetOffsetY, ?SitTargetOffsetZ, " +
|
||||
"?SitTargetOrientW, ?SitTargetOrientX, " +
|
||||
"?SitTargetOrientY, ?SitTargetOrientZ, " +
|
||||
"?RegionUUID, ?CreatorID, ?OwnerID, " +
|
||||
"?GroupID, ?LastOwnerID, ?SceneGroupID, " +
|
||||
"?PayPrice, ?PayButton1, ?PayButton2, " +
|
||||
"?PayButton3, ?PayButton4, ?LoopedSound, " +
|
||||
"?LoopedSoundGain, ?TextureAnimation, " +
|
||||
"?OmegaX, ?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)";
|
||||
|
||||
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "replace into primshapes (" +
|
||||
"UUID, Shape, ScaleX, ScaleY, " +
|
||||
"ScaleZ, PCode, PathBegin, PathEnd, " +
|
||||
"PathScaleX, PathScaleY, PathShearX, " +
|
||||
"PathShearY, PathSkew, PathCurve, " +
|
||||
"PathRadiusOffset, PathRevolutions, " +
|
||||
"PathTaperX, PathTaperY, PathTwist, " +
|
||||
"PathTwistBegin, ProfileBegin, ProfileEnd, " +
|
||||
"ProfileCurve, ProfileHollow, Texture, " +
|
||||
"ExtraParams, State, Media) values (?UUID, " +
|
||||
"?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
|
||||
"?PCode, ?PathBegin, ?PathEnd, " +
|
||||
"?PathScaleX, ?PathScaleY, " +
|
||||
"?PathShearX, ?PathShearY, " +
|
||||
"?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
|
||||
"?PathRevolutions, ?PathTaperX, " +
|
||||
"?PathTaperY, ?PathTwist, " +
|
||||
"?PathTwistBegin, ?ProfileBegin, " +
|
||||
"?ProfileEnd, ?ProfileCurve, " +
|
||||
"?ProfileHollow, ?Texture, ?ExtraParams, " +
|
||||
"?State, ?Media)";
|
||||
|
||||
FillShapeCommand(cmd, prim);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -719,95 +719,99 @@ namespace OpenSim.Data.MySQL
|
||||
RegionLightShareData nWP = new RegionLightShareData();
|
||||
nWP.OnSave += StoreRegionWindlightSettings;
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
//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;
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nWP;
|
||||
}
|
||||
|
||||
@@ -853,122 +857,199 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||
cmd.CommandText += "?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.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||
cmd.CommandText += "?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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region RegionEnvironmentSettings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToString(result["llsd_settings"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
||||
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void StoreRegionSettings(RegionSettings rs)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
@@ -1800,41 +1881,40 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
RemoveItems(primID);
|
||||
|
||||
if (items.Count == 0)
|
||||
return;
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = dbcon.CreateCommand();
|
||||
|
||||
if (items.Count == 0)
|
||||
return;
|
||||
|
||||
cmd.CommandText = "insert into primitems (" +
|
||||
"invType, assetType, name, " +
|
||||
"description, creationDate, nextPermissions, " +
|
||||
"currentPermissions, basePermissions, " +
|
||||
"everyonePermissions, groupPermissions, " +
|
||||
"flags, itemID, primID, assetID, " +
|
||||
"parentFolderID, creatorID, ownerID, " +
|
||||
"groupID, lastOwnerID) values (?invType, " +
|
||||
"?assetType, ?name, ?description, " +
|
||||
"?creationDate, ?nextPermissions, " +
|
||||
"?currentPermissions, ?basePermissions, " +
|
||||
"?everyonePermissions, ?groupPermissions, " +
|
||||
"?flags, ?itemID, ?primID, ?assetID, " +
|
||||
"?parentFolderID, ?creatorID, ?ownerID, " +
|
||||
"?groupID, ?lastOwnerID)";
|
||||
|
||||
foreach (TaskInventoryItem item in items)
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
FillItemCommand(cmd, item);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
cmd.CommandText = "insert into primitems (" +
|
||||
"invType, assetType, name, " +
|
||||
"description, creationDate, nextPermissions, " +
|
||||
"currentPermissions, basePermissions, " +
|
||||
"everyonePermissions, groupPermissions, " +
|
||||
"flags, itemID, primID, assetID, " +
|
||||
"parentFolderID, creatorID, ownerID, " +
|
||||
"groupID, lastOwnerID) values (?invType, " +
|
||||
"?assetType, ?name, ?description, " +
|
||||
"?creationDate, ?nextPermissions, " +
|
||||
"?currentPermissions, ?basePermissions, " +
|
||||
"?everyonePermissions, ?groupPermissions, " +
|
||||
"?flags, ?itemID, ?primID, ?assetID, " +
|
||||
"?parentFolderID, ?creatorID, ?ownerID, " +
|
||||
"?groupID, ?lastOwnerID)";
|
||||
|
||||
foreach (TaskInventoryItem item in items)
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
FillItemCommand(cmd, item);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1905,5 +1985,74 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveExtra(UUID regionID, string name, string val)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "replace into regionextra values (?RegionID, ?Name, ?value)";
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Name", name);
|
||||
cmd.Parameters.AddWithValue("?value", val);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveExtra(UUID regionID, string name)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from regionextra where RegionID=?RegionID and Name=?Name";
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?Name", name);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetExtra(UUID regionID)
|
||||
{
|
||||
Dictionary<string, string> ret = new Dictionary<string, string>();
|
||||
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "select * from regionextra where RegionID=?RegionID";
|
||||
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
|
||||
using (IDataReader r = cmd.ExecuteReader())
|
||||
{
|
||||
while (r.Read())
|
||||
{
|
||||
ret[r["Name"].ToString()] = r["value"].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,23 +62,24 @@ namespace OpenSim.Data.MySQL
|
||||
if (words.Length > 2)
|
||||
return new UserAccountData[0];
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
if (words.Length == 1)
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
if (words.Length == 1)
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
|
||||
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
|
||||
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
|
||||
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
|
||||
}
|
||||
|
||||
return DoQuery(cmd);
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -883,4 +883,22 @@ ALTER TABLE `regionsettings` MODIFY COLUMN `TelehubObject` VARCHAR(36) NOT NULL
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 44 #--------------------- Environment Settings
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE `regionenvironment` (
|
||||
`region_id` varchar(36) NOT NULL,
|
||||
`llsd_settings` TEXT NOT NULL,
|
||||
PRIMARY KEY (`region_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 45
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE `regionextra` (`RegionID` char(36) not null, `Name` varchar(32) not null, `value` text, primary key(`RegionID`, `Name`));
|
||||
|
||||
COMMIT;
|
||||
|
||||
@@ -76,9 +76,27 @@ namespace OpenSim.Data.Null
|
||||
//This connector doesn't support the windlight module yet
|
||||
}
|
||||
|
||||
#region Environment Settings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
//This connector doesn't support the Environment module yet
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
||||
{
|
||||
//This connector doesn't support the Environment module yet
|
||||
}
|
||||
|
||||
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
//This connector doesn't support the Environment module yet
|
||||
}
|
||||
#endregion
|
||||
|
||||
public RegionSettings LoadRegionSettings(UUID regionUUID)
|
||||
{
|
||||
RegionSettings rs = new RegionSettings();
|
||||
{
|
||||
RegionSettings rs = new RegionSettings();
|
||||
rs.RegionUUID = regionUUID;
|
||||
return rs;
|
||||
}
|
||||
@@ -133,5 +151,18 @@ namespace OpenSim.Data.Null
|
||||
public void Shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveExtra(UUID regionID, string name, string value)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveExtra(UUID regionID, string name)
|
||||
{
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetExtra(UUID regionID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,3 +564,14 @@ COMMIT;
|
||||
BEGIN;
|
||||
ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
COMMIT;
|
||||
|
||||
:VERSION 26
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE `regionenvironment` (
|
||||
`region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY,
|
||||
`llsd_settings` TEXT NOT NULL
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace OpenSim.Data.SQLite
|
||||
private const string regionbanListSelect = "select * from regionban";
|
||||
private const string regionSettingsSelect = "select * from regionsettings";
|
||||
private const string regionWindlightSelect = "select * from regionwindlight";
|
||||
private const string regionEnvironmentSelect = "select * from regionenvironment";
|
||||
private const string regionSpawnPointsSelect = "select * from spawn_points";
|
||||
|
||||
private DataSet ds;
|
||||
@@ -72,6 +73,7 @@ namespace OpenSim.Data.SQLite
|
||||
private SqliteDataAdapter landAccessListDa;
|
||||
private SqliteDataAdapter regionSettingsDa;
|
||||
private SqliteDataAdapter regionWindlightDa;
|
||||
private SqliteDataAdapter regionEnvironmentDa;
|
||||
private SqliteDataAdapter regionSpawnPointsDa;
|
||||
|
||||
private SqliteConnection m_conn;
|
||||
@@ -146,6 +148,9 @@ namespace OpenSim.Data.SQLite
|
||||
SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn);
|
||||
regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd);
|
||||
|
||||
SqliteCommand regionEnvironmentSelectCmd = new SqliteCommand(regionEnvironmentSelect, m_conn);
|
||||
regionEnvironmentDa = new SqliteDataAdapter(regionEnvironmentSelectCmd);
|
||||
|
||||
SqliteCommand regionSpawnPointsSelectCmd = new SqliteCommand(regionSpawnPointsSelect, m_conn);
|
||||
regionSpawnPointsDa = new SqliteDataAdapter(regionSpawnPointsSelectCmd);
|
||||
|
||||
@@ -179,6 +184,9 @@ namespace OpenSim.Data.SQLite
|
||||
ds.Tables.Add(createRegionWindlightTable());
|
||||
setupRegionWindlightCommands(regionWindlightDa, m_conn);
|
||||
|
||||
ds.Tables.Add(createRegionEnvironmentTable());
|
||||
setupRegionEnvironmentCommands(regionEnvironmentDa, m_conn);
|
||||
|
||||
ds.Tables.Add(createRegionSpawnPointsTable());
|
||||
setupRegionSpawnPointsCommands(regionSpawnPointsDa, m_conn);
|
||||
|
||||
@@ -258,6 +266,15 @@ namespace OpenSim.Data.SQLite
|
||||
m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionwindlight table :{0}", e.Message);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
regionEnvironmentDa.Fill(ds.Tables["regionenvironment"]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionenvironment table :{0}", e.Message);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
regionSpawnPointsDa.Fill(ds.Tables["spawn_points"]);
|
||||
@@ -278,12 +295,13 @@ namespace OpenSim.Data.SQLite
|
||||
CreateDataSetMapping(landAccessListDa, "landaccesslist");
|
||||
CreateDataSetMapping(regionSettingsDa, "regionsettings");
|
||||
CreateDataSetMapping(regionWindlightDa, "regionwindlight");
|
||||
CreateDataSetMapping(regionEnvironmentDa, "regionenvironment");
|
||||
CreateDataSetMapping(regionSpawnPointsDa, "spawn_points");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[SQLITE REGION DB]: ", e);
|
||||
m_log.ErrorFormat("[SQLITE REGION DB]: {0} - {1}", e.Message, e.StackTrace);
|
||||
Environment.Exit(23);
|
||||
}
|
||||
return;
|
||||
@@ -341,6 +359,11 @@ namespace OpenSim.Data.SQLite
|
||||
regionWindlightDa.Dispose();
|
||||
regionWindlightDa = null;
|
||||
}
|
||||
if (regionEnvironmentDa != null)
|
||||
{
|
||||
regionEnvironmentDa.Dispose();
|
||||
regionEnvironmentDa = null;
|
||||
}
|
||||
if (regionSpawnPointsDa != null)
|
||||
{
|
||||
regionSpawnPointsDa.Dispose();
|
||||
@@ -474,6 +497,63 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
}
|
||||
|
||||
#region Region Environment Settings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable environmentTable = ds.Tables["regionenvironment"];
|
||||
DataRow row = environmentTable.Rows.Find(regionUUID.ToString());
|
||||
if (row == null)
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
return (String)row["llsd_settings"];
|
||||
}
|
||||
}
|
||||
|
||||
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable environmentTable = ds.Tables["regionenvironment"];
|
||||
DataRow row = environmentTable.Rows.Find(regionUUID.ToString());
|
||||
|
||||
if (row == null)
|
||||
{
|
||||
row = environmentTable.NewRow();
|
||||
row["region_id"] = regionUUID.ToString();
|
||||
row["llsd_settings"] = settings;
|
||||
environmentTable.Rows.Add(row);
|
||||
}
|
||||
else
|
||||
{
|
||||
row["llsd_settings"] = settings;
|
||||
}
|
||||
|
||||
regionEnvironmentDa.Update(ds, "regionenvironment");
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable environmentTable = ds.Tables["regionenvironment"];
|
||||
DataRow row = environmentTable.Rows.Find(regionUUID.ToString());
|
||||
|
||||
if (row != null)
|
||||
{
|
||||
row.Delete();
|
||||
}
|
||||
|
||||
regionEnvironmentDa.Update(ds, "regionenvironment");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public RegionSettings LoadRegionSettings(UUID regionUUID)
|
||||
{
|
||||
lock (ds)
|
||||
@@ -1430,6 +1510,17 @@ namespace OpenSim.Data.SQLite
|
||||
return regionwindlight;
|
||||
}
|
||||
|
||||
private static DataTable createRegionEnvironmentTable()
|
||||
{
|
||||
DataTable regionEnvironment = new DataTable("regionenvironment");
|
||||
createCol(regionEnvironment, "region_id", typeof(String));
|
||||
createCol(regionEnvironment, "llsd_settings", typeof(String));
|
||||
|
||||
regionEnvironment.PrimaryKey = new DataColumn[] { regionEnvironment.Columns["region_id"] };
|
||||
|
||||
return regionEnvironment;
|
||||
}
|
||||
|
||||
private static DataTable createRegionSpawnPointsTable()
|
||||
{
|
||||
DataTable spawn_points = new DataTable("spawn_points");
|
||||
@@ -2691,6 +2782,14 @@ namespace OpenSim.Data.SQLite
|
||||
da.UpdateCommand.Connection = conn;
|
||||
}
|
||||
|
||||
private void setupRegionEnvironmentCommands(SqliteDataAdapter da, SqliteConnection conn)
|
||||
{
|
||||
da.InsertCommand = createInsertCommand("regionenvironment", ds.Tables["regionenvironment"]);
|
||||
da.InsertCommand.Connection = conn;
|
||||
da.UpdateCommand = createUpdateCommand("regionenvironment", "region_id=:region_id", ds.Tables["regionenvironment"]);
|
||||
da.UpdateCommand.Connection = conn;
|
||||
}
|
||||
|
||||
private void setupRegionSpawnPointsCommands(SqliteDataAdapter da, SqliteConnection conn)
|
||||
{
|
||||
da.InsertCommand = createInsertCommand("spawn_points", ds.Tables["spawn_points"]);
|
||||
@@ -2791,5 +2890,17 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveExtra(UUID regionID, string name, string value)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveExtra(UUID regionID, string name)
|
||||
{
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetExtra(UUID regionID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,7 +632,6 @@ namespace OpenSim.Data.Tests
|
||||
.IgnoreProperty(x=>x.RegionUUID)
|
||||
.IgnoreProperty(x=>x.Scene)
|
||||
.IgnoreProperty(x=>x.Parts)
|
||||
.IgnoreProperty(x=>x.PassCollision)
|
||||
.IgnoreProperty(x=>x.RootPart));
|
||||
}
|
||||
|
||||
@@ -1070,8 +1069,6 @@ namespace OpenSim.Data.Tests
|
||||
regionInfo.RegionLocX = 0;
|
||||
regionInfo.RegionLocY = 0;
|
||||
|
||||
Scene scene = new Scene(regionInfo);
|
||||
|
||||
SceneObjectPart sop = new SceneObjectPart();
|
||||
sop.Name = name;
|
||||
sop.Description = name;
|
||||
@@ -1082,7 +1079,7 @@ namespace OpenSim.Data.Tests
|
||||
sop.Shape = PrimitiveBaseShape.Default;
|
||||
|
||||
SceneObjectGroup sog = new SceneObjectGroup(sop);
|
||||
sog.SetScene(scene);
|
||||
// sog.SetScene(scene);
|
||||
|
||||
return sog;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,11 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
public string lastname;
|
||||
|
||||
/// <summary>
|
||||
/// Agent's full name.
|
||||
/// </summary>
|
||||
public string Name { get { return string.Format("{0} {1}", firstname, lastname); } }
|
||||
|
||||
/// <summary>
|
||||
/// Random Unique GUID for this session. Client gets this at login and it's
|
||||
/// only supposed to be disclosed over secure channels
|
||||
|
||||
@@ -199,7 +199,14 @@ namespace OpenSim.Framework
|
||||
//
|
||||
public class Cache
|
||||
{
|
||||
/// <summary>
|
||||
/// Must only be accessed under lock.
|
||||
/// </summary>
|
||||
private List<CacheItemBase> m_Index = new List<CacheItemBase>();
|
||||
|
||||
/// <summary>
|
||||
/// Must only be accessed under m_Index lock.
|
||||
/// </summary>
|
||||
private Dictionary<string, CacheItemBase> m_Lookup =
|
||||
new Dictionary<string, CacheItemBase>();
|
||||
|
||||
@@ -320,19 +327,19 @@ namespace OpenSim.Framework
|
||||
{
|
||||
if (m_Lookup.ContainsKey(index))
|
||||
item = m_Lookup[index];
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
Expire(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
item.hits++;
|
||||
item.lastUsed = DateTime.Now;
|
||||
|
||||
Expire(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
item.hits++;
|
||||
item.lastUsed = DateTime.Now;
|
||||
|
||||
Expire(true);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -385,7 +392,10 @@ namespace OpenSim.Framework
|
||||
//
|
||||
public Object Find(Predicate<CacheItemBase> d)
|
||||
{
|
||||
CacheItemBase item = m_Index.Find(d);
|
||||
CacheItemBase item;
|
||||
|
||||
lock (m_Index)
|
||||
item = m_Index.Find(d);
|
||||
|
||||
if (item == null)
|
||||
return null;
|
||||
@@ -419,12 +429,12 @@ namespace OpenSim.Framework
|
||||
public virtual void Store(string index, Object data, Type container,
|
||||
Object[] parameters)
|
||||
{
|
||||
Expire(false);
|
||||
|
||||
CacheItemBase item;
|
||||
|
||||
lock (m_Index)
|
||||
{
|
||||
Expire(false);
|
||||
|
||||
if (m_Index.Contains(new CacheItemBase(index)))
|
||||
{
|
||||
if ((m_Flags & CacheFlags.AllowUpdate) != 0)
|
||||
@@ -450,9 +460,17 @@ namespace OpenSim.Framework
|
||||
m_Index.Add(item);
|
||||
m_Lookup[index] = item;
|
||||
}
|
||||
|
||||
item.Store(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expire items as appropriate.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Callers must lock m_Index.
|
||||
/// </remarks>
|
||||
/// <param name='getting'></param>
|
||||
protected virtual void Expire(bool getting)
|
||||
{
|
||||
if (getting && (m_Strategy == CacheStrategy.Aggressive))
|
||||
@@ -475,12 +493,10 @@ namespace OpenSim.Framework
|
||||
|
||||
switch (m_Strategy)
|
||||
{
|
||||
case CacheStrategy.Aggressive:
|
||||
if (Count < Size)
|
||||
return;
|
||||
case CacheStrategy.Aggressive:
|
||||
if (Count < Size)
|
||||
return;
|
||||
|
||||
lock (m_Index)
|
||||
{
|
||||
m_Index.Sort(new SortLRU());
|
||||
m_Index.Reverse();
|
||||
|
||||
@@ -490,7 +506,7 @@ namespace OpenSim.Framework
|
||||
|
||||
ExpireDelegate doExpire = OnExpire;
|
||||
|
||||
if (doExpire != null)
|
||||
if (doExpire != null)
|
||||
{
|
||||
List<CacheItemBase> candidates =
|
||||
m_Index.GetRange(target, Count - target);
|
||||
@@ -513,27 +529,34 @@ namespace OpenSim.Framework
|
||||
foreach (CacheItemBase item in m_Index)
|
||||
m_Lookup[item.uuid] = item;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Invalidate(string uuid)
|
||||
{
|
||||
if (!m_Lookup.ContainsKey(uuid))
|
||||
return;
|
||||
lock (m_Index)
|
||||
{
|
||||
if (!m_Lookup.ContainsKey(uuid))
|
||||
return;
|
||||
|
||||
CacheItemBase item = m_Lookup[uuid];
|
||||
m_Lookup.Remove(uuid);
|
||||
m_Index.Remove(item);
|
||||
CacheItemBase item = m_Lookup[uuid];
|
||||
m_Lookup.Remove(uuid);
|
||||
m_Index.Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_Index.Clear();
|
||||
m_Lookup.Clear();
|
||||
lock (m_Index)
|
||||
{
|
||||
m_Index.Clear();
|
||||
m_Lookup.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,11 @@ namespace OpenSim.Framework.Console
|
||||
public List<CommandDelegate> fn;
|
||||
}
|
||||
|
||||
public const string GeneralHelpText = "For more information, type 'help <item>' where <item> is one of the following categories:";
|
||||
public const string GeneralHelpText
|
||||
= "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n";
|
||||
|
||||
public const string ItemHelpText
|
||||
= "For more information, type 'help <item>' where <item> is one of the following:";
|
||||
|
||||
/// <value>
|
||||
/// Commands organized by keyword in a tree
|
||||
@@ -108,7 +112,9 @@ namespace OpenSim.Framework.Console
|
||||
// General help
|
||||
if (helpParts.Count == 0)
|
||||
{
|
||||
help.Add(""); // Will become a newline.
|
||||
help.Add(GeneralHelpText);
|
||||
help.Add(ItemHelpText);
|
||||
help.AddRange(CollectModulesHelp(tree));
|
||||
}
|
||||
else
|
||||
@@ -132,7 +138,7 @@ namespace OpenSim.Framework.Console
|
||||
// Check modules first to see if we just need to display a list of those commands
|
||||
if (TryCollectModuleHelp(originalHelpRequest, help))
|
||||
{
|
||||
help.Insert(0, GeneralHelpText);
|
||||
help.Insert(0, ItemHelpText);
|
||||
return help;
|
||||
}
|
||||
|
||||
@@ -672,6 +678,8 @@ namespace OpenSim.Framework.Console
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public event OnOutputDelegate OnOutput;
|
||||
|
||||
public ICommands Commands { get; private set; }
|
||||
|
||||
public CommandConsole(string defaultPrompt) : base(defaultPrompt)
|
||||
@@ -691,6 +699,13 @@ namespace OpenSim.Framework.Console
|
||||
Output(s);
|
||||
}
|
||||
|
||||
protected void FireOnOutput(string text)
|
||||
{
|
||||
OnOutputDelegate onOutput = OnOutput;
|
||||
if (onOutput != null)
|
||||
onOutput(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Display a command prompt on the console and wait for user input
|
||||
/// </summary>
|
||||
|
||||
112
OpenSim/Framework/Console/ConsoleDisplayList.cs
Normal file
112
OpenSim/Framework/Console/ConsoleDisplayList.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Framework.Console
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to generated a formatted table for the console.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Currently subject to change. If you use this, be prepared to change your code when this class changes.
|
||||
/// </remarks>
|
||||
public class ConsoleDisplayList
|
||||
{
|
||||
/// <summary>
|
||||
/// The default divider between key and value for a list item.
|
||||
/// </summary>
|
||||
public const string DefaultKeyValueDivider = " : ";
|
||||
|
||||
/// <summary>
|
||||
/// The divider used between key and value for a list item.
|
||||
/// </summary>
|
||||
public string KeyValueDivider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Table rows
|
||||
/// </summary>
|
||||
public List<KeyValuePair<string, string>> Rows { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of spaces to indent the list.
|
||||
/// </summary>
|
||||
public int Indent { get; set; }
|
||||
|
||||
public ConsoleDisplayList()
|
||||
{
|
||||
Rows = new List<KeyValuePair<string, string>>();
|
||||
KeyValueDivider = DefaultKeyValueDivider;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
AddToStringBuilder(sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public void AddToStringBuilder(StringBuilder sb)
|
||||
{
|
||||
string formatString = GetFormatString();
|
||||
// System.Console.WriteLine("FORMAT STRING [{0}]", formatString);
|
||||
|
||||
// rows
|
||||
foreach (KeyValuePair<string, string> row in Rows)
|
||||
sb.AppendFormat(formatString, row.Key, row.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the format string for the table.
|
||||
/// </summary>
|
||||
private string GetFormatString()
|
||||
{
|
||||
StringBuilder formatSb = new StringBuilder();
|
||||
|
||||
int longestKey = -1;
|
||||
|
||||
foreach (KeyValuePair<string, string> row in Rows)
|
||||
if (row.Key.Length > longestKey)
|
||||
longestKey = row.Key.Length;
|
||||
|
||||
formatSb.Append(' ', Indent);
|
||||
|
||||
// Can only do left formatting for now
|
||||
formatSb.AppendFormat("{{0,-{0}}}{1}{{1}}\n", longestKey, KeyValueDivider);
|
||||
|
||||
return formatSb.ToString();
|
||||
}
|
||||
|
||||
public void AddRow(object key, object value)
|
||||
{
|
||||
Rows.Add(new KeyValuePair<string, string>(key.ToString(), value.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
154
OpenSim/Framework/Console/ConsoleDisplayTable.cs
Normal file
154
OpenSim/Framework/Console/ConsoleDisplayTable.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Framework.Console
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to generated a formatted table for the console.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Currently subject to change. If you use this, be prepared to change your code when this class changes.
|
||||
/// </remarks>
|
||||
public class ConsoleDisplayTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Default number of spaces between table columns.
|
||||
/// </summary>
|
||||
public const int DefaultTableSpacing = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Table columns.
|
||||
/// </summary>
|
||||
public List<ConsoleDisplayTableColumn> Columns { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Table rows
|
||||
/// </summary>
|
||||
public List<ConsoleDisplayTableRow> Rows { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of spaces to indent the table.
|
||||
/// </summary>
|
||||
public int Indent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Spacing between table columns
|
||||
/// </summary>
|
||||
public int TableSpacing { get; set; }
|
||||
|
||||
public ConsoleDisplayTable()
|
||||
{
|
||||
TableSpacing = DefaultTableSpacing;
|
||||
Columns = new List<ConsoleDisplayTableColumn>();
|
||||
Rows = new List<ConsoleDisplayTableRow>();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
AddToStringBuilder(sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public void AddColumn(string name, int width)
|
||||
{
|
||||
Columns.Add(new ConsoleDisplayTableColumn(name, width));
|
||||
}
|
||||
|
||||
public void AddRow(params string[] cells)
|
||||
{
|
||||
Rows.Add(new ConsoleDisplayTableRow(cells));
|
||||
}
|
||||
|
||||
public void AddToStringBuilder(StringBuilder sb)
|
||||
{
|
||||
string formatString = GetFormatString();
|
||||
// System.Console.WriteLine("FORMAT STRING [{0}]", formatString);
|
||||
|
||||
// columns
|
||||
sb.AppendFormat(formatString, Columns.ConvertAll(c => c.Header).ToArray());
|
||||
|
||||
// rows
|
||||
foreach (ConsoleDisplayTableRow row in Rows)
|
||||
sb.AppendFormat(formatString, row.Cells.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the format string for the table.
|
||||
/// </summary>
|
||||
private string GetFormatString()
|
||||
{
|
||||
StringBuilder formatSb = new StringBuilder();
|
||||
|
||||
formatSb.Append(' ', Indent);
|
||||
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
formatSb.Append(' ', TableSpacing);
|
||||
|
||||
// Can only do left formatting for now
|
||||
formatSb.AppendFormat("{{{0},-{1}}}", i, Columns[i].Width);
|
||||
}
|
||||
|
||||
formatSb.Append('\n');
|
||||
|
||||
return formatSb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public struct ConsoleDisplayTableColumn
|
||||
{
|
||||
public string Header { get; set; }
|
||||
public int Width { get; set; }
|
||||
|
||||
public ConsoleDisplayTableColumn(string header, int width) : this()
|
||||
{
|
||||
Header = header;
|
||||
Width = width;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ConsoleDisplayTableRow
|
||||
{
|
||||
public List<string> Cells { get; private set; }
|
||||
|
||||
public ConsoleDisplayTableRow(List<string> cells) : this()
|
||||
{
|
||||
Cells = cells;
|
||||
}
|
||||
|
||||
public ConsoleDisplayTableRow(params string[] cells) : this()
|
||||
{
|
||||
Cells = new List<string>(cells);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,6 +296,10 @@ namespace OpenSim.Framework.Console
|
||||
matches[0].Groups["Category"].Value);
|
||||
System.Console.Write("]:");
|
||||
}
|
||||
else
|
||||
{
|
||||
outText = outText.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
if (level == "error")
|
||||
@@ -315,6 +319,8 @@ namespace OpenSim.Framework.Console
|
||||
|
||||
public override void Output(string text, string level)
|
||||
{
|
||||
FireOnOutput(text);
|
||||
|
||||
lock (m_commandLine)
|
||||
{
|
||||
if (m_cursorYPosition == -1)
|
||||
@@ -505,4 +511,4 @@ namespace OpenSim.Framework.Console
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ namespace OpenSim.Framework.Console
|
||||
/// </summary>
|
||||
public class MockConsole : ICommandConsole
|
||||
{
|
||||
public event OnOutputDelegate OnOutput;
|
||||
|
||||
private MockCommands m_commands = new MockCommands();
|
||||
|
||||
public ICommands Commands { get { return m_commands; } }
|
||||
@@ -76,4 +78,4 @@ namespace OpenSim.Framework.Console
|
||||
public string[] Resolve(string[] cmd) { return null; }
|
||||
public XmlElement GetXml(XmlDocument doc) { return null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace OpenSim.Framework.Console
|
||||
m_LineNumber++;
|
||||
m_Scrollback.Add(String.Format("{0}", m_LineNumber)+":"+level+":"+text);
|
||||
}
|
||||
FireOnOutput(text.Trim());
|
||||
System.Console.WriteLine(text.Trim());
|
||||
}
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ namespace OpenSim.Framework
|
||||
l_EstateManagers.Remove(avatarID);
|
||||
}
|
||||
|
||||
public bool IsEstateManager(UUID avatarID)
|
||||
public bool IsEstateManagerOrOwner(UUID avatarID)
|
||||
{
|
||||
if (IsEstateOwner(avatarID))
|
||||
return true;
|
||||
@@ -368,7 +368,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public bool HasAccess(UUID user)
|
||||
{
|
||||
if (IsEstateManager(user))
|
||||
if (IsEstateManagerOrOwner(user))
|
||||
return true;
|
||||
|
||||
return l_EstateAccess.Contains(user);
|
||||
|
||||
@@ -740,14 +740,21 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <value>
|
||||
/// Determines whether the client thread is doing anything or not.
|
||||
/// </value>
|
||||
/// <summary>
|
||||
/// True if the client is active (sending and receiving new UDP messages). False if the client is being closed.
|
||||
/// </summary>
|
||||
bool IsActive { get; set; }
|
||||
|
||||
/// <value>
|
||||
/// Determines whether the client is or has been removed from a given scene
|
||||
/// </value>
|
||||
/// <summary>
|
||||
/// Set if the client is closing due to a logout request
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Do not use this flag if you want to know if the client is closing, since it will not be set in other
|
||||
/// circumstances (e.g. if a child agent is closed or the agent is kicked off the simulator). Use IsActive
|
||||
/// instead with a IClientAPI.SceneAgent.IsChildAgent check if necessary.
|
||||
///
|
||||
/// Only set for root agents.
|
||||
/// </remarks>
|
||||
bool IsLoggingOut { get; set; }
|
||||
|
||||
bool SendLogoutPacketWhenClosing { set; }
|
||||
@@ -1026,7 +1033,21 @@ namespace OpenSim.Framework
|
||||
|
||||
void InPacket(object NewPack);
|
||||
void ProcessInPacket(Packet NewPack);
|
||||
|
||||
/// <summary>
|
||||
/// Close this client
|
||||
/// </summary>
|
||||
void Close();
|
||||
|
||||
/// <summary>
|
||||
/// Close this client
|
||||
/// </summary>
|
||||
/// <param name='force'>
|
||||
/// If true, attempts the close without checking active status. You do not want to try this except as a last
|
||||
/// ditch attempt where Active == false but the ScenePresence still exists.
|
||||
/// </param>
|
||||
void Close(bool force);
|
||||
|
||||
void Kick(string message);
|
||||
|
||||
/// <summary>
|
||||
@@ -1346,7 +1367,6 @@ namespace OpenSim.Framework
|
||||
void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message);
|
||||
|
||||
void SendLogoutPacket();
|
||||
EndPoint GetClientEP();
|
||||
|
||||
// WARNING WARNING WARNING
|
||||
//
|
||||
@@ -1407,8 +1427,6 @@ namespace OpenSim.Framework
|
||||
|
||||
void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes);
|
||||
|
||||
void KillEndDone();
|
||||
|
||||
bool AddGenericPacketHandler(string MethodName, GenericMessage handler);
|
||||
|
||||
void SendRebakeAvatarTextures(UUID textureID);
|
||||
|
||||
@@ -74,8 +74,12 @@ namespace OpenSim.Framework
|
||||
XmlElement GetXml(XmlDocument doc);
|
||||
}
|
||||
|
||||
public delegate void OnOutputDelegate(string message);
|
||||
|
||||
public interface ICommandConsole : IConsole
|
||||
{
|
||||
event OnOutputDelegate OnOutput;
|
||||
|
||||
ICommands Commands { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -87,4 +91,4 @@ namespace OpenSim.Framework
|
||||
|
||||
string ReadLine(string p, bool isCommand, bool e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,11 +56,29 @@ namespace OpenSim.Framework
|
||||
|
||||
public interface IScene
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of this scene.
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
RegionInfo RegionInfo { get; }
|
||||
RegionStatus RegionStatus { get; set; }
|
||||
|
||||
IConfigSource Config { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Are logins enabled on this simulator?
|
||||
/// </summary>
|
||||
bool LoginsEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Is this region ready for use?
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This does not mean that logins are enabled, merely that they can be.
|
||||
/// </remarks>
|
||||
bool Ready { get; set; }
|
||||
|
||||
float TimeDilation { get; }
|
||||
|
||||
bool AllowScriptCrossings { get; }
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
@@ -71,5 +72,11 @@ namespace OpenSim.Framework
|
||||
/// This includes scene object data and the appearance data of other avatars.
|
||||
/// </remarks>
|
||||
void SendInitialDataToMe();
|
||||
|
||||
/// <summary>
|
||||
/// Direction in which the scene presence is looking.
|
||||
/// </summary>
|
||||
/// <remarks>Will be Vector3.Zero for a child agent.</remarks>
|
||||
Vector3 Lookat { get; }
|
||||
}
|
||||
}
|
||||
@@ -73,33 +73,27 @@ namespace OpenSim.Framework
|
||||
{
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id)
|
||||
public InventoryFolderBase(UUID id) : this()
|
||||
{
|
||||
ID = id;
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id, UUID owner)
|
||||
public InventoryFolderBase(UUID id, UUID owner) : this(id)
|
||||
{
|
||||
ID = id;
|
||||
Owner = owner;
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent)
|
||||
public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent) : this(id, owner)
|
||||
{
|
||||
ID = id;
|
||||
Name = name;
|
||||
Owner = owner;
|
||||
ParentID = parent;
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
|
||||
public InventoryFolderBase(
|
||||
UUID id, string name, UUID owner, short type, UUID parent, ushort version) : this(id, name, owner, parent)
|
||||
{
|
||||
ID = id;
|
||||
Name = name;
|
||||
Owner = owner;
|
||||
Type = type;
|
||||
ParentID = parent;
|
||||
Version = version;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,8 +99,13 @@ namespace OpenSim.Framework
|
||||
}
|
||||
else
|
||||
{
|
||||
item = oldHeadNext.Item;
|
||||
item = oldHeadNext.Item;
|
||||
haveAdvancedHead = CAS(ref head, oldHead, oldHeadNext);
|
||||
if (haveAdvancedHead)
|
||||
{
|
||||
oldHeadNext.Item = default(T);
|
||||
oldHead.Next = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,6 +116,10 @@ namespace OpenSim.Framework
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
// ugly
|
||||
T item;
|
||||
while(count > 0)
|
||||
Dequeue(out item);
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,12 +63,15 @@ namespace OpenSim.Framework
|
||||
|
||||
internal void Clear()
|
||||
{
|
||||
this.value = default(T);
|
||||
if (this.handle != null)
|
||||
{
|
||||
this.handle.Clear();
|
||||
this.handle = null;
|
||||
}
|
||||
ClearRef();
|
||||
}
|
||||
|
||||
internal void ClearRef()
|
||||
{
|
||||
this.value = default(T);
|
||||
this.handle = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,6 +288,7 @@ namespace OpenSim.Framework
|
||||
if (--this.size > 0 && index != this.size)
|
||||
{
|
||||
Set(this.items[this.size], index);
|
||||
this.items[this.size].ClearRef();
|
||||
if (!BubbleUp(index))
|
||||
BubbleDown(index);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
using System;
|
||||
using System.Timers;
|
||||
|
||||
namespace OpenSim.Framework.Statistics
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Asset service statistics collection
|
||||
@@ -31,8 +31,7 @@ using System.Text;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
|
||||
namespace OpenSim.Framework.Statistics
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Statistics which all collectors are interested in reporting
|
||||
@@ -44,14 +43,18 @@ namespace OpenSim.Framework.Statistics
|
||||
StringBuilder sb = new StringBuilder(Environment.NewLine);
|
||||
sb.Append("MEMORY STATISTICS");
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append(
|
||||
string.Format(
|
||||
"Allocated to OpenSim objects: {0} MB\n",
|
||||
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
|
||||
sb.Append(
|
||||
string.Format(
|
||||
"Process memory : {0} MB\n",
|
||||
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0)));
|
||||
|
||||
sb.AppendFormat(
|
||||
"Allocated to OpenSim objects: {0} MB\n",
|
||||
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
|
||||
|
||||
sb.AppendFormat(
|
||||
"OpenSim object memory churn : {0} MB/s\n",
|
||||
Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3));
|
||||
|
||||
sb.AppendFormat(
|
||||
"Process memory : {0} MB\n",
|
||||
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OpenSim.Framework.Statistics.Interfaces
|
||||
namespace OpenSim.Framework.Monitoring.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Implemented by objects which allow statistical information to be pulled from them.
|
||||
@@ -25,7 +25,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OpenSim.Framework.Statistics
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Implemented by classes which collect up non-viewer statistical information
|
||||
129
OpenSim/Framework/Monitoring/MemoryWatchdog.cs
Normal file
129
OpenSim/Framework/Monitoring/MemoryWatchdog.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Experimental watchdog for memory usage.
|
||||
/// </summary>
|
||||
public static class MemoryWatchdog
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Is this watchdog active?
|
||||
/// </summary>
|
||||
public static bool Enabled
|
||||
{
|
||||
get { return m_enabled; }
|
||||
set
|
||||
{
|
||||
// m_log.DebugFormat("[MEMORY WATCHDOG]: Setting MemoryWatchdog.Enabled to {0}", value);
|
||||
|
||||
if (value && !m_enabled)
|
||||
UpdateLastRecord(GC.GetTotalMemory(false), Util.EnvironmentTickCount());
|
||||
|
||||
m_enabled = value;
|
||||
}
|
||||
}
|
||||
private static bool m_enabled;
|
||||
|
||||
/// <summary>
|
||||
/// Average memory churn in bytes per millisecond.
|
||||
/// </summary>
|
||||
public static double AverageMemoryChurn
|
||||
{
|
||||
get { if (m_samples.Count > 0) return m_samples.Average(); else return 0; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of statistical samples.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// At the moment this corresponds to 1 minute since the sampling rate is every 2.5 seconds as triggered from
|
||||
/// the main Watchdog.
|
||||
/// </remarks>
|
||||
private static int m_maxSamples = 24;
|
||||
|
||||
/// <summary>
|
||||
/// Time when the watchdog was last updated.
|
||||
/// </summary>
|
||||
private static int m_lastUpdateTick;
|
||||
|
||||
/// <summary>
|
||||
/// Memory used at time of last watchdog update.
|
||||
/// </summary>
|
||||
private static long m_lastUpdateMemory;
|
||||
|
||||
/// <summary>
|
||||
/// Memory churn rate per millisecond.
|
||||
/// </summary>
|
||||
// private static double m_churnRatePerMillisecond;
|
||||
|
||||
/// <summary>
|
||||
/// Historical samples for calculating moving average.
|
||||
/// </summary>
|
||||
private static Queue<double> m_samples = new Queue<double>(m_maxSamples);
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
int now = Util.EnvironmentTickCount();
|
||||
long memoryNow = GC.GetTotalMemory(false);
|
||||
long memoryDiff = memoryNow - m_lastUpdateMemory;
|
||||
|
||||
if (memoryDiff >= 0)
|
||||
{
|
||||
if (m_samples.Count >= m_maxSamples)
|
||||
m_samples.Dequeue();
|
||||
|
||||
double elapsed = Util.EnvironmentTickCountSubtract(now, m_lastUpdateTick);
|
||||
|
||||
// This should never happen since it's not useful for updates to occur with no time elapsed, but
|
||||
// protect ourselves from a divide-by-zero just in case.
|
||||
if (elapsed == 0)
|
||||
return;
|
||||
|
||||
m_samples.Enqueue(memoryDiff / (double)elapsed);
|
||||
}
|
||||
|
||||
UpdateLastRecord(memoryNow, now);
|
||||
}
|
||||
|
||||
private static void UpdateLastRecord(long memoryNow, int timeNow)
|
||||
{
|
||||
m_lastUpdateMemory = memoryNow;
|
||||
m_lastUpdateTick = timeNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,12 +28,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework.Statistics.Interfaces;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework.Monitoring.Interfaces;
|
||||
|
||||
namespace OpenSim.Framework.Statistics
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane
|
||||
@@ -25,7 +25,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OpenSim.Framework.Statistics
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Singleton used to provide access to statistics reporters
|
||||
@@ -34,14 +34,12 @@ namespace OpenSim.Framework.Statistics
|
||||
{
|
||||
private static AssetStatsCollector assetStats;
|
||||
private static UserStatsCollector userStats;
|
||||
private static SimExtraStatsCollector simExtraStats;
|
||||
private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector();
|
||||
|
||||
public static AssetStatsCollector AssetStats { get { return assetStats; } }
|
||||
public static UserStatsCollector UserStats { get { return userStats; } }
|
||||
public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } }
|
||||
|
||||
private StatsManager() {}
|
||||
|
||||
/// <summary>
|
||||
/// Start collecting statistics related to assets.
|
||||
/// Should only be called once.
|
||||
@@ -63,16 +61,5 @@ namespace OpenSim.Framework.Statistics
|
||||
|
||||
return userStats;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start collecting extra sim statistics apart from those collected for the client.
|
||||
/// Should only be called once.
|
||||
/// </summary>
|
||||
public static SimExtraStatsCollector StartCollectingSimExtraStats()
|
||||
{
|
||||
simExtraStats = new SimExtraStatsCollector();
|
||||
|
||||
return simExtraStats;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
using System.Timers;
|
||||
|
||||
namespace OpenSim.Framework.Statistics
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Collects user service statistics
|
||||
@@ -31,7 +31,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages launching threads and keeping watch over them for timeouts
|
||||
@@ -41,8 +41,8 @@ namespace OpenSim.Framework
|
||||
/// <summary>Timer interval in milliseconds for the watchdog timer</summary>
|
||||
const double WATCHDOG_INTERVAL_MS = 2500.0d;
|
||||
|
||||
/// <summary>Maximum timeout in milliseconds before a thread is considered dead</summary>
|
||||
const int WATCHDOG_TIMEOUT_MS = 5000;
|
||||
/// <summary>Default timeout in milliseconds before a thread is considered dead</summary>
|
||||
public const int DEFAULT_WATCHDOG_TIMEOUT_MS = 5000;
|
||||
|
||||
[System.Diagnostics.DebuggerDisplay("{Thread.Name}")]
|
||||
public class ThreadWatchdogInfo
|
||||
@@ -58,7 +58,7 @@ namespace OpenSim.Framework
|
||||
public int FirstTick { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// First time this heartbeat update was invoked
|
||||
/// Last time this heartbeat update was invoked
|
||||
/// </summary>
|
||||
public int LastTick { get; set; }
|
||||
|
||||
@@ -77,6 +77,11 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
public bool AlarmIfTimeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Method execute if alarm goes off. If null then no alarm method is fired.
|
||||
/// </summary>
|
||||
public Func<string> AlarmMethod { get; set; }
|
||||
|
||||
public ThreadWatchdogInfo(Thread thread, int timeout)
|
||||
{
|
||||
Thread = thread;
|
||||
@@ -84,31 +89,69 @@ namespace OpenSim.Framework
|
||||
FirstTick = Environment.TickCount & Int32.MaxValue;
|
||||
LastTick = FirstTick;
|
||||
}
|
||||
|
||||
public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi)
|
||||
{
|
||||
Thread = previousTwi.Thread;
|
||||
FirstTick = previousTwi.FirstTick;
|
||||
LastTick = previousTwi.LastTick;
|
||||
Timeout = previousTwi.Timeout;
|
||||
IsTimedOut = previousTwi.IsTimedOut;
|
||||
AlarmIfTimeout = previousTwi.AlarmIfTimeout;
|
||||
AlarmMethod = previousTwi.AlarmMethod;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This event is called whenever a tracked thread is stopped or
|
||||
/// has not called UpdateThread() in time
|
||||
/// </summary>
|
||||
/// <param name="thread">The thread that has been identified as dead</param>
|
||||
/// <param name="lastTick">The last time this thread called UpdateThread()</param>
|
||||
public delegate void WatchdogTimeout(Thread thread, int lastTick);
|
||||
/// This event is called whenever a tracked thread is
|
||||
/// stopped or has not called UpdateThread() in time<
|
||||
/// /summary>
|
||||
public static event Action<ThreadWatchdogInfo> OnWatchdogTimeout;
|
||||
|
||||
/// <summary>This event is called whenever a tracked thread is
|
||||
/// stopped or has not called UpdateThread() in time</summary>
|
||||
public static event WatchdogTimeout OnWatchdogTimeout;
|
||||
/// <summary>
|
||||
/// Is this watchdog active?
|
||||
/// </summary>
|
||||
public static bool Enabled
|
||||
{
|
||||
get { return m_enabled; }
|
||||
set
|
||||
{
|
||||
// m_log.DebugFormat("[MEMORY WATCHDOG]: Setting MemoryWatchdog.Enabled to {0}", value);
|
||||
|
||||
if (value == m_enabled)
|
||||
return;
|
||||
|
||||
m_enabled = value;
|
||||
|
||||
if (m_enabled)
|
||||
{
|
||||
// Set now so we don't get alerted on the first run
|
||||
LastWatchdogThreadTick = Environment.TickCount & Int32.MaxValue;
|
||||
}
|
||||
|
||||
m_watchdogTimer.Enabled = m_enabled;
|
||||
}
|
||||
}
|
||||
private static bool m_enabled;
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static Dictionary<int, ThreadWatchdogInfo> m_threads;
|
||||
private static System.Timers.Timer m_watchdogTimer;
|
||||
|
||||
/// <summary>
|
||||
/// Last time the watchdog thread ran.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Should run every WATCHDOG_INTERVAL_MS
|
||||
/// </remarks>
|
||||
public static int LastWatchdogThreadTick { get; private set; }
|
||||
|
||||
static Watchdog()
|
||||
{
|
||||
m_threads = new Dictionary<int, ThreadWatchdogInfo>();
|
||||
m_watchdogTimer = new System.Timers.Timer(WATCHDOG_INTERVAL_MS);
|
||||
m_watchdogTimer.AutoReset = false;
|
||||
m_watchdogTimer.Elapsed += WatchdogTimerElapsed;
|
||||
m_watchdogTimer.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -123,7 +166,7 @@ namespace OpenSim.Framework
|
||||
public static Thread StartThread(
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout)
|
||||
{
|
||||
return StartThread(start, name, priority, isBackground, alarmIfTimeout, WATCHDOG_TIMEOUT_MS);
|
||||
return StartThread(start, name, priority, isBackground, alarmIfTimeout, null, DEFAULT_WATCHDOG_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -135,17 +178,24 @@ namespace OpenSim.Framework
|
||||
/// <param name="isBackground">True to run this thread as a background
|
||||
/// thread, otherwise false</param>
|
||||
/// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
|
||||
/// <param name="alarmMethod">
|
||||
/// Alarm method to call if alarmIfTimeout is true and there is a timeout.
|
||||
/// Normally, this will just return some useful debugging information.
|
||||
/// </param>
|
||||
/// <param name="timeout">Number of milliseconds to wait until we issue a warning about timeout.</param>
|
||||
/// <returns>The newly created Thread object</returns>
|
||||
public static Thread StartThread(
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, int timeout)
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground,
|
||||
bool alarmIfTimeout, Func<string> alarmMethod, int timeout)
|
||||
{
|
||||
Thread thread = new Thread(start);
|
||||
thread.Name = name;
|
||||
thread.Priority = priority;
|
||||
thread.IsBackground = isBackground;
|
||||
|
||||
ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout };
|
||||
ThreadWatchdogInfo twi
|
||||
= new ThreadWatchdogInfo(thread, timeout)
|
||||
{ AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod };
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[WATCHDOG]: Started tracking thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
|
||||
@@ -258,7 +308,17 @@ namespace OpenSim.Framework
|
||||
/// <param name="e"></param>
|
||||
private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
WatchdogTimeout callback = OnWatchdogTimeout;
|
||||
int now = Environment.TickCount & Int32.MaxValue;
|
||||
int msElapsed = now - LastWatchdogThreadTick;
|
||||
|
||||
if (msElapsed > WATCHDOG_INTERVAL_MS * 2)
|
||||
m_log.WarnFormat(
|
||||
"[WATCHDOG]: {0} ms since Watchdog last ran. Interval should be approximately {1} ms",
|
||||
msElapsed, WATCHDOG_INTERVAL_MS);
|
||||
|
||||
LastWatchdogThreadTick = Environment.TickCount & Int32.MaxValue;
|
||||
|
||||
Action<ThreadWatchdogInfo> callback = OnWatchdogTimeout;
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
@@ -266,8 +326,6 @@ namespace OpenSim.Framework
|
||||
|
||||
lock (m_threads)
|
||||
{
|
||||
int now = Environment.TickCount & Int32.MaxValue;
|
||||
|
||||
foreach (ThreadWatchdogInfo threadInfo in m_threads.Values)
|
||||
{
|
||||
if (threadInfo.Thread.ThreadState == ThreadState.Stopped)
|
||||
@@ -288,7 +346,9 @@ namespace OpenSim.Framework
|
||||
if (callbackInfos == null)
|
||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||
|
||||
callbackInfos.Add(threadInfo);
|
||||
// Send a copy of the watchdog info to prevent race conditions where the watchdog
|
||||
// thread updates the monitoring info after an alarm has been sent out.
|
||||
callbackInfos.Add(new ThreadWatchdogInfo(threadInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,9 +356,12 @@ namespace OpenSim.Framework
|
||||
|
||||
if (callbackInfos != null)
|
||||
foreach (ThreadWatchdogInfo callbackInfo in callbackInfos)
|
||||
callback(callbackInfo.Thread, callbackInfo.LastTick);
|
||||
callback(callbackInfo);
|
||||
}
|
||||
|
||||
if (MemoryWatchdog.Enabled)
|
||||
MemoryWatchdog.Update();
|
||||
|
||||
m_watchdogTimer.Start();
|
||||
}
|
||||
}
|
||||
@@ -51,10 +51,12 @@ namespace OpenSim.Framework
|
||||
protected object m_senderObject;
|
||||
protected ChatTypeEnum m_type;
|
||||
protected UUID m_fromID;
|
||||
protected UUID m_toID;
|
||||
|
||||
public OSChatMessage()
|
||||
{
|
||||
m_position = new Vector3();
|
||||
m_toID = UUID.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,6 +104,15 @@ namespace OpenSim.Framework
|
||||
set { m_from = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name of the sender (needed for scripts)
|
||||
/// </summary>
|
||||
public string To
|
||||
{
|
||||
get { return m_from; }
|
||||
set { m_from = value; }
|
||||
}
|
||||
|
||||
#region IEventArgs Members
|
||||
|
||||
/// TODO: Sender and SenderObject should just be Sender and of
|
||||
@@ -131,6 +142,15 @@ namespace OpenSim.Framework
|
||||
set { m_fromID = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The single recipient or all if not set.
|
||||
/// </summary>
|
||||
public UUID TargetUUID
|
||||
{
|
||||
get { return m_toID; }
|
||||
set { m_toID = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@@ -241,10 +241,14 @@ namespace OpenSim.Framework
|
||||
|
||||
m_textureEntry = prim.Textures.GetBytes();
|
||||
|
||||
SculptEntry = (prim.Sculpt.Type != OpenMetaverse.SculptType.None);
|
||||
SculptData = prim.Sculpt.GetBytes();
|
||||
SculptTexture = prim.Sculpt.SculptTexture;
|
||||
SculptType = (byte)prim.Sculpt.Type;
|
||||
if (prim.Sculpt != null)
|
||||
{
|
||||
SculptEntry = (prim.Sculpt.Type != OpenMetaverse.SculptType.None);
|
||||
SculptData = prim.Sculpt.GetBytes();
|
||||
SculptTexture = prim.Sculpt.SculptTexture;
|
||||
SculptType = (byte)prim.Sculpt.Type;
|
||||
}
|
||||
else SculptType = (byte)OpenMetaverse.SculptType.None;
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
|
||||
@@ -120,7 +120,9 @@ namespace OpenSim.Framework
|
||||
public UUID lastMapUUID = UUID.Zero;
|
||||
public string lastMapRefresh = "0";
|
||||
|
||||
private float m_nonphysPrimMin = 0;
|
||||
private int m_nonphysPrimMax = 0;
|
||||
private float m_physPrimMin = 0;
|
||||
private int m_physPrimMax = 0;
|
||||
private bool m_clampPrimSize = false;
|
||||
private int m_objectCapacity = 0;
|
||||
@@ -285,11 +287,21 @@ namespace OpenSim.Framework
|
||||
set { m_windlight = value; }
|
||||
}
|
||||
|
||||
public float NonphysPrimMin
|
||||
{
|
||||
get { return m_nonphysPrimMin; }
|
||||
}
|
||||
|
||||
public int NonphysPrimMax
|
||||
{
|
||||
get { return m_nonphysPrimMax; }
|
||||
}
|
||||
|
||||
public float PhysPrimMin
|
||||
{
|
||||
get { return m_physPrimMin; }
|
||||
}
|
||||
|
||||
public int PhysPrimMax
|
||||
{
|
||||
get { return m_physPrimMax; }
|
||||
@@ -480,9 +492,16 @@ namespace OpenSim.Framework
|
||||
MainConsole.Instance.Output("=====================================\n");
|
||||
|
||||
if (name == String.Empty)
|
||||
name = MainConsole.Instance.CmdPrompt("New region name", name);
|
||||
if (name == String.Empty)
|
||||
throw new Exception("Cannot interactively create region with no name");
|
||||
{
|
||||
while (name.Trim() == string.Empty)
|
||||
{
|
||||
name = MainConsole.Instance.CmdPrompt("New region name", name);
|
||||
if (name.Trim() == string.Empty)
|
||||
{
|
||||
MainConsole.Instance.Output("Cannot interactively create region with no name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
source.AddConfig(name);
|
||||
|
||||
@@ -513,15 +532,20 @@ namespace OpenSim.Framework
|
||||
//
|
||||
allKeys.Remove("RegionUUID");
|
||||
string regionUUID = config.GetString("RegionUUID", string.Empty);
|
||||
if (regionUUID == String.Empty)
|
||||
if (!UUID.TryParse(regionUUID.Trim(), out RegionID))
|
||||
{
|
||||
UUID newID = UUID.Random();
|
||||
|
||||
regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString());
|
||||
while (RegionID == UUID.Zero)
|
||||
{
|
||||
regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString());
|
||||
if (!UUID.TryParse(regionUUID.Trim(), out RegionID))
|
||||
{
|
||||
MainConsole.Instance.Output("RegionUUID must be a valid UUID");
|
||||
}
|
||||
}
|
||||
config.Set("RegionUUID", regionUUID);
|
||||
}
|
||||
|
||||
RegionID = new UUID(regionUUID);
|
||||
originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?)
|
||||
|
||||
// Location
|
||||
@@ -611,16 +635,28 @@ namespace OpenSim.Framework
|
||||
m_regionType = config.GetString("RegionType", String.Empty);
|
||||
allKeys.Remove("RegionType");
|
||||
|
||||
// Prim stuff
|
||||
//
|
||||
#region Prim stuff
|
||||
|
||||
m_nonphysPrimMin = config.GetFloat("NonphysicalPrimMin", 0);
|
||||
allKeys.Remove("NonphysicalPrimMin");
|
||||
|
||||
m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0);
|
||||
allKeys.Remove("NonphysicalPrimMax");
|
||||
|
||||
m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0);
|
||||
allKeys.Remove("PhysicalPrimMin");
|
||||
|
||||
m_physPrimMax = config.GetInt("PhysicalPrimMax", 0);
|
||||
allKeys.Remove("PhysicalPrimMax");
|
||||
|
||||
m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
|
||||
allKeys.Remove("ClampPrimSize");
|
||||
|
||||
m_objectCapacity = config.GetInt("MaxPrims", 15000);
|
||||
allKeys.Remove("MaxPrims");
|
||||
|
||||
#endregion
|
||||
|
||||
m_agentCapacity = config.GetInt("MaxAgents", 100);
|
||||
allKeys.Remove("MaxAgents");
|
||||
|
||||
@@ -656,10 +692,18 @@ namespace OpenSim.Framework
|
||||
|
||||
config.Set("ExternalHostName", m_externalHostName);
|
||||
|
||||
if (m_nonphysPrimMin != 0)
|
||||
config.Set("NonphysicalPrimMax", m_nonphysPrimMin);
|
||||
|
||||
if (m_nonphysPrimMax != 0)
|
||||
config.Set("NonphysicalPrimMax", m_nonphysPrimMax);
|
||||
|
||||
if (m_physPrimMin != 0)
|
||||
config.Set("PhysicalPrimMax", m_physPrimMin);
|
||||
|
||||
if (m_physPrimMax != 0)
|
||||
config.Set("PhysicalPrimMax", m_physPrimMax);
|
||||
|
||||
config.Set("ClampPrimSize", m_clampPrimSize.ToString());
|
||||
|
||||
if (m_objectCapacity != 0)
|
||||
@@ -742,9 +786,15 @@ namespace OpenSim.Framework
|
||||
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
|
||||
"Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||
"Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
|
||||
"Minimum size for nonphysical prims", m_physPrimMin.ToString(), true);
|
||||
|
||||
configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||
"Maximum size for physical prims", m_physPrimMax.ToString(), true);
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using OpenMetaverse;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
@@ -71,6 +72,32 @@ namespace OpenSim.Framework
|
||||
|
||||
return pos + offset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a string representation of this SpawnPoint.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0},{1},{2}", Yaw, Pitch, Distance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a SpawnPoint from a string
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
public static SpawnPoint Parse(string str)
|
||||
{
|
||||
string[] parts = str.Split(',');
|
||||
if (parts.Length != 3)
|
||||
throw new ArgumentException("Invalid string: " + str);
|
||||
|
||||
SpawnPoint sp = new SpawnPoint();
|
||||
sp.Yaw = float.Parse(parts[0]);
|
||||
sp.Pitch = float.Parse(parts[1]);
|
||||
sp.Distance = float.Parse(parts[2]);
|
||||
return sp;
|
||||
}
|
||||
}
|
||||
|
||||
public class RegionSettings
|
||||
@@ -456,7 +483,7 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
// Connected Telehub object
|
||||
private UUID m_TelehubObject;
|
||||
private UUID m_TelehubObject = UUID.Zero;
|
||||
public UUID TelehubObject
|
||||
{
|
||||
get
|
||||
|
||||
@@ -38,239 +38,189 @@ namespace OpenSim.Framework
|
||||
public static class SLUtil
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
||||
#region SL / file extension / content-type conversions
|
||||
|
||||
private class TypeMapping
|
||||
{
|
||||
private sbyte assetType;
|
||||
private InventoryType inventoryType;
|
||||
private string contentType;
|
||||
private string contentType2;
|
||||
private string extension;
|
||||
|
||||
public sbyte AssetTypeCode
|
||||
{
|
||||
get { return assetType; }
|
||||
}
|
||||
|
||||
public object AssetType
|
||||
{
|
||||
get {
|
||||
if (Enum.IsDefined(typeof(OpenMetaverse.AssetType), assetType))
|
||||
return (OpenMetaverse.AssetType)assetType;
|
||||
else
|
||||
return OpenMetaverse.AssetType.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
public InventoryType InventoryType
|
||||
{
|
||||
get { return inventoryType; }
|
||||
}
|
||||
|
||||
public string ContentType
|
||||
{
|
||||
get { return contentType; }
|
||||
}
|
||||
|
||||
public string ContentType2
|
||||
{
|
||||
get { return contentType2; }
|
||||
}
|
||||
|
||||
public string Extension
|
||||
{
|
||||
get { return extension; }
|
||||
}
|
||||
|
||||
private TypeMapping(sbyte assetType, InventoryType inventoryType, string contentType, string contentType2, string extension)
|
||||
{
|
||||
this.assetType = assetType;
|
||||
this.inventoryType = inventoryType;
|
||||
this.contentType = contentType;
|
||||
this.contentType2 = contentType2;
|
||||
this.extension = extension;
|
||||
}
|
||||
|
||||
public TypeMapping(AssetType assetType, InventoryType inventoryType, string contentType, string contentType2, string extension)
|
||||
: this((sbyte)assetType, inventoryType, contentType, contentType2, extension)
|
||||
{
|
||||
}
|
||||
|
||||
public TypeMapping(AssetType assetType, InventoryType inventoryType, string contentType, string extension)
|
||||
: this((sbyte)assetType, inventoryType, contentType, null, extension)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps between AssetType, InventoryType and Content-Type.
|
||||
/// Where more than one possibility exists, the first one takes precedence. E.g.:
|
||||
/// AssetType "AssetType.Texture" -> Content-Type "image-xj2c"
|
||||
/// Content-Type "image/x-j2c" -> InventoryType "InventoryType.Texture"
|
||||
/// </summary>
|
||||
private static TypeMapping[] MAPPINGS = new TypeMapping[] {
|
||||
new TypeMapping(AssetType.Unknown, InventoryType.Unknown, "application/octet-stream", "bin"),
|
||||
new TypeMapping(AssetType.Texture, InventoryType.Texture, "image/x-j2c", "image/jp2", "j2c"),
|
||||
new TypeMapping(AssetType.Texture, InventoryType.Snapshot, "image/x-j2c", "image/jp2", "j2c"),
|
||||
new TypeMapping(AssetType.TextureTGA, InventoryType.Texture, "image/tga", "tga"),
|
||||
new TypeMapping(AssetType.ImageTGA, InventoryType.Texture, "image/tga", "tga"),
|
||||
new TypeMapping(AssetType.ImageJPEG, InventoryType.Texture, "image/jpeg", "jpg"),
|
||||
new TypeMapping(AssetType.Sound, InventoryType.Sound, "audio/ogg", "application/ogg", "ogg"),
|
||||
new TypeMapping(AssetType.SoundWAV, InventoryType.Sound, "audio/x-wav", "wav"),
|
||||
new TypeMapping(AssetType.CallingCard, InventoryType.CallingCard, "application/vnd.ll.callingcard", "application/x-metaverse-callingcard", "callingcard"),
|
||||
new TypeMapping(AssetType.Landmark, InventoryType.Landmark, "application/vnd.ll.landmark", "application/x-metaverse-landmark", "landmark"),
|
||||
new TypeMapping(AssetType.Clothing, InventoryType.Wearable, "application/vnd.ll.clothing", "application/x-metaverse-clothing", "clothing"),
|
||||
new TypeMapping(AssetType.Object, InventoryType.Object, "application/vnd.ll.primitive", "application/x-metaverse-primitive", "primitive"),
|
||||
new TypeMapping(AssetType.Object, InventoryType.Attachment, "application/vnd.ll.primitive", "application/x-metaverse-primitive", "primitive"),
|
||||
new TypeMapping(AssetType.Notecard, InventoryType.Notecard, "application/vnd.ll.notecard", "application/x-metaverse-notecard", "notecard"),
|
||||
new TypeMapping(AssetType.Folder, InventoryType.Folder, "application/vnd.ll.folder", "folder"),
|
||||
new TypeMapping(AssetType.RootFolder, InventoryType.RootCategory, "application/vnd.ll.rootfolder", "rootfolder"),
|
||||
new TypeMapping(AssetType.LSLText, InventoryType.LSL, "application/vnd.ll.lsltext", "application/x-metaverse-lsl", "lsl"),
|
||||
new TypeMapping(AssetType.LSLBytecode, InventoryType.LSL, "application/vnd.ll.lslbyte", "application/x-metaverse-lso", "lso"),
|
||||
new TypeMapping(AssetType.Bodypart, InventoryType.Wearable, "application/vnd.ll.bodypart", "application/x-metaverse-bodypart", "bodypart"),
|
||||
new TypeMapping(AssetType.TrashFolder, InventoryType.Folder, "application/vnd.ll.trashfolder", "trashfolder"),
|
||||
new TypeMapping(AssetType.SnapshotFolder, InventoryType.Folder, "application/vnd.ll.snapshotfolder", "snapshotfolder"),
|
||||
new TypeMapping(AssetType.LostAndFoundFolder, InventoryType.Folder, "application/vnd.ll.lostandfoundfolder", "lostandfoundfolder"),
|
||||
new TypeMapping(AssetType.Animation, InventoryType.Animation, "application/vnd.ll.animation", "application/x-metaverse-animation", "animation"),
|
||||
new TypeMapping(AssetType.Gesture, InventoryType.Gesture, "application/vnd.ll.gesture", "application/x-metaverse-gesture", "gesture"),
|
||||
new TypeMapping(AssetType.Simstate, InventoryType.Snapshot, "application/x-metaverse-simstate", "simstate"),
|
||||
new TypeMapping(AssetType.FavoriteFolder, InventoryType.Unknown, "application/vnd.ll.favoritefolder", "favoritefolder"),
|
||||
new TypeMapping(AssetType.Link, InventoryType.Unknown, "application/vnd.ll.link", "link"),
|
||||
new TypeMapping(AssetType.LinkFolder, InventoryType.Unknown, "application/vnd.ll.linkfolder", "linkfolder"),
|
||||
new TypeMapping(AssetType.CurrentOutfitFolder, InventoryType.Unknown, "application/vnd.ll.currentoutfitfolder", "currentoutfitfolder"),
|
||||
new TypeMapping(AssetType.OutfitFolder, InventoryType.Unknown, "application/vnd.ll.outfitfolder", "outfitfolder"),
|
||||
new TypeMapping(AssetType.MyOutfitsFolder, InventoryType.Unknown, "application/vnd.ll.myoutfitsfolder", "myoutfitsfolder"),
|
||||
new TypeMapping(AssetType.Mesh, InventoryType.Mesh, "application/vnd.ll.mesh", "llm")
|
||||
};
|
||||
|
||||
private static Dictionary<sbyte, string> asset2Content;
|
||||
private static Dictionary<sbyte, string> asset2Extension;
|
||||
private static Dictionary<InventoryType, string> inventory2Content;
|
||||
private static Dictionary<string, sbyte> content2Asset;
|
||||
private static Dictionary<string, InventoryType> content2Inventory;
|
||||
|
||||
static SLUtil()
|
||||
{
|
||||
asset2Content = new Dictionary<sbyte, string>();
|
||||
asset2Extension = new Dictionary<sbyte, string>();
|
||||
inventory2Content = new Dictionary<InventoryType, string>();
|
||||
content2Asset = new Dictionary<string, sbyte>();
|
||||
content2Inventory = new Dictionary<string, InventoryType>();
|
||||
|
||||
foreach (TypeMapping mapping in MAPPINGS)
|
||||
{
|
||||
sbyte assetType = mapping.AssetTypeCode;
|
||||
if (!asset2Content.ContainsKey(assetType))
|
||||
asset2Content.Add(assetType, mapping.ContentType);
|
||||
if (!asset2Extension.ContainsKey(assetType))
|
||||
asset2Extension.Add(assetType, mapping.Extension);
|
||||
if (!inventory2Content.ContainsKey(mapping.InventoryType))
|
||||
inventory2Content.Add(mapping.InventoryType, mapping.ContentType);
|
||||
if (!content2Asset.ContainsKey(mapping.ContentType))
|
||||
content2Asset.Add(mapping.ContentType, assetType);
|
||||
if (!content2Inventory.ContainsKey(mapping.ContentType))
|
||||
content2Inventory.Add(mapping.ContentType, mapping.InventoryType);
|
||||
|
||||
if (mapping.ContentType2 != null)
|
||||
{
|
||||
if (!content2Asset.ContainsKey(mapping.ContentType2))
|
||||
content2Asset.Add(mapping.ContentType2, assetType);
|
||||
if (!content2Inventory.ContainsKey(mapping.ContentType2))
|
||||
content2Inventory.Add(mapping.ContentType2, mapping.InventoryType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string SLAssetTypeToContentType(int assetType)
|
||||
{
|
||||
switch ((AssetType)assetType)
|
||||
{
|
||||
case AssetType.Texture:
|
||||
return "image/x-j2c";
|
||||
case AssetType.Sound:
|
||||
return "audio/ogg";
|
||||
case AssetType.CallingCard:
|
||||
return "application/vnd.ll.callingcard";
|
||||
case AssetType.Landmark:
|
||||
return "application/vnd.ll.landmark";
|
||||
case AssetType.Clothing:
|
||||
return "application/vnd.ll.clothing";
|
||||
case AssetType.Object:
|
||||
return "application/vnd.ll.primitive";
|
||||
case AssetType.Notecard:
|
||||
return "application/vnd.ll.notecard";
|
||||
case AssetType.Folder:
|
||||
return "application/vnd.ll.folder";
|
||||
case AssetType.RootFolder:
|
||||
return "application/vnd.ll.rootfolder";
|
||||
case AssetType.LSLText:
|
||||
return "application/vnd.ll.lsltext";
|
||||
case AssetType.LSLBytecode:
|
||||
return "application/vnd.ll.lslbyte";
|
||||
case AssetType.TextureTGA:
|
||||
case AssetType.ImageTGA:
|
||||
return "image/tga";
|
||||
case AssetType.Bodypart:
|
||||
return "application/vnd.ll.bodypart";
|
||||
case AssetType.TrashFolder:
|
||||
return "application/vnd.ll.trashfolder";
|
||||
case AssetType.SnapshotFolder:
|
||||
return "application/vnd.ll.snapshotfolder";
|
||||
case AssetType.LostAndFoundFolder:
|
||||
return "application/vnd.ll.lostandfoundfolder";
|
||||
case AssetType.SoundWAV:
|
||||
return "audio/x-wav";
|
||||
case AssetType.ImageJPEG:
|
||||
return "image/jpeg";
|
||||
case AssetType.Animation:
|
||||
return "application/vnd.ll.animation";
|
||||
case AssetType.Gesture:
|
||||
return "application/vnd.ll.gesture";
|
||||
case AssetType.Simstate:
|
||||
return "application/x-metaverse-simstate";
|
||||
case AssetType.FavoriteFolder:
|
||||
return "application/vnd.ll.favoritefolder";
|
||||
case AssetType.Link:
|
||||
return "application/vnd.ll.link";
|
||||
case AssetType.LinkFolder:
|
||||
return "application/vnd.ll.linkfolder";
|
||||
case AssetType.CurrentOutfitFolder:
|
||||
return "application/vnd.ll.currentoutfitfolder";
|
||||
case AssetType.OutfitFolder:
|
||||
return "application/vnd.ll.outfitfolder";
|
||||
case AssetType.MyOutfitsFolder:
|
||||
return "application/vnd.ll.myoutfitsfolder";
|
||||
case AssetType.Unknown:
|
||||
default:
|
||||
return "application/octet-stream";
|
||||
}
|
||||
string contentType;
|
||||
if (!asset2Content.TryGetValue((sbyte)assetType, out contentType))
|
||||
contentType = asset2Content[(sbyte)AssetType.Unknown];
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public static string SLInvTypeToContentType(int invType)
|
||||
{
|
||||
switch ((InventoryType)invType)
|
||||
{
|
||||
case InventoryType.Animation:
|
||||
return "application/vnd.ll.animation";
|
||||
case InventoryType.CallingCard:
|
||||
return "application/vnd.ll.callingcard";
|
||||
case InventoryType.Folder:
|
||||
return "application/vnd.ll.folder";
|
||||
case InventoryType.Gesture:
|
||||
return "application/vnd.ll.gesture";
|
||||
case InventoryType.Landmark:
|
||||
return "application/vnd.ll.landmark";
|
||||
case InventoryType.LSL:
|
||||
return "application/vnd.ll.lsltext";
|
||||
case InventoryType.Notecard:
|
||||
return "application/vnd.ll.notecard";
|
||||
case InventoryType.Attachment:
|
||||
case InventoryType.Object:
|
||||
return "application/vnd.ll.primitive";
|
||||
case InventoryType.Sound:
|
||||
return "audio/ogg";
|
||||
case InventoryType.Snapshot:
|
||||
case InventoryType.Texture:
|
||||
return "image/x-j2c";
|
||||
case InventoryType.Wearable:
|
||||
return "application/vnd.ll.clothing";
|
||||
default:
|
||||
return "application/octet-stream";
|
||||
}
|
||||
string contentType;
|
||||
if (!inventory2Content.TryGetValue((InventoryType)invType, out contentType))
|
||||
contentType = inventory2Content[InventoryType.Unknown];
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public static sbyte ContentTypeToSLAssetType(string contentType)
|
||||
{
|
||||
switch (contentType)
|
||||
{
|
||||
case "image/x-j2c":
|
||||
case "image/jp2":
|
||||
return (sbyte)AssetType.Texture;
|
||||
case "application/ogg":
|
||||
case "audio/ogg":
|
||||
return (sbyte)AssetType.Sound;
|
||||
case "application/vnd.ll.callingcard":
|
||||
case "application/x-metaverse-callingcard":
|
||||
return (sbyte)AssetType.CallingCard;
|
||||
case "application/vnd.ll.landmark":
|
||||
case "application/x-metaverse-landmark":
|
||||
return (sbyte)AssetType.Landmark;
|
||||
case "application/vnd.ll.clothing":
|
||||
case "application/x-metaverse-clothing":
|
||||
return (sbyte)AssetType.Clothing;
|
||||
case "application/vnd.ll.primitive":
|
||||
case "application/x-metaverse-primitive":
|
||||
return (sbyte)AssetType.Object;
|
||||
case "application/vnd.ll.notecard":
|
||||
case "application/x-metaverse-notecard":
|
||||
return (sbyte)AssetType.Notecard;
|
||||
case "application/vnd.ll.folder":
|
||||
return (sbyte)AssetType.Folder;
|
||||
case "application/vnd.ll.rootfolder":
|
||||
return (sbyte)AssetType.RootFolder;
|
||||
case "application/vnd.ll.lsltext":
|
||||
case "application/x-metaverse-lsl":
|
||||
return (sbyte)AssetType.LSLText;
|
||||
case "application/vnd.ll.lslbyte":
|
||||
case "application/x-metaverse-lso":
|
||||
return (sbyte)AssetType.LSLBytecode;
|
||||
case "image/tga":
|
||||
// Note that AssetType.TextureTGA will be converted to AssetType.ImageTGA
|
||||
return (sbyte)AssetType.ImageTGA;
|
||||
case "application/vnd.ll.bodypart":
|
||||
case "application/x-metaverse-bodypart":
|
||||
return (sbyte)AssetType.Bodypart;
|
||||
case "application/vnd.ll.trashfolder":
|
||||
return (sbyte)AssetType.TrashFolder;
|
||||
case "application/vnd.ll.snapshotfolder":
|
||||
return (sbyte)AssetType.SnapshotFolder;
|
||||
case "application/vnd.ll.lostandfoundfolder":
|
||||
return (sbyte)AssetType.LostAndFoundFolder;
|
||||
case "audio/x-wav":
|
||||
return (sbyte)AssetType.SoundWAV;
|
||||
case "image/jpeg":
|
||||
return (sbyte)AssetType.ImageJPEG;
|
||||
case "application/vnd.ll.animation":
|
||||
case "application/x-metaverse-animation":
|
||||
return (sbyte)AssetType.Animation;
|
||||
case "application/vnd.ll.gesture":
|
||||
case "application/x-metaverse-gesture":
|
||||
return (sbyte)AssetType.Gesture;
|
||||
case "application/x-metaverse-simstate":
|
||||
return (sbyte)AssetType.Simstate;
|
||||
case "application/vnd.ll.favoritefolder":
|
||||
return (sbyte)AssetType.FavoriteFolder;
|
||||
case "application/vnd.ll.link":
|
||||
return (sbyte)AssetType.Link;
|
||||
case "application/vnd.ll.linkfolder":
|
||||
return (sbyte)AssetType.LinkFolder;
|
||||
case "application/vnd.ll.currentoutfitfolder":
|
||||
return (sbyte)AssetType.CurrentOutfitFolder;
|
||||
case "application/vnd.ll.outfitfolder":
|
||||
return (sbyte)AssetType.OutfitFolder;
|
||||
case "application/vnd.ll.myoutfitsfolder":
|
||||
return (sbyte)AssetType.MyOutfitsFolder;
|
||||
case "application/octet-stream":
|
||||
default:
|
||||
return (sbyte)AssetType.Unknown;
|
||||
}
|
||||
sbyte assetType;
|
||||
if (!content2Asset.TryGetValue(contentType, out assetType))
|
||||
assetType = (sbyte)AssetType.Unknown;
|
||||
return (sbyte)assetType;
|
||||
}
|
||||
|
||||
public static sbyte ContentTypeToSLInvType(string contentType)
|
||||
{
|
||||
switch (contentType)
|
||||
{
|
||||
case "image/x-j2c":
|
||||
case "image/jp2":
|
||||
case "image/tga":
|
||||
case "image/jpeg":
|
||||
return (sbyte)InventoryType.Texture;
|
||||
case "application/ogg":
|
||||
case "audio/ogg":
|
||||
case "audio/x-wav":
|
||||
return (sbyte)InventoryType.Sound;
|
||||
case "application/vnd.ll.callingcard":
|
||||
case "application/x-metaverse-callingcard":
|
||||
return (sbyte)InventoryType.CallingCard;
|
||||
case "application/vnd.ll.landmark":
|
||||
case "application/x-metaverse-landmark":
|
||||
return (sbyte)InventoryType.Landmark;
|
||||
case "application/vnd.ll.clothing":
|
||||
case "application/x-metaverse-clothing":
|
||||
case "application/vnd.ll.bodypart":
|
||||
case "application/x-metaverse-bodypart":
|
||||
return (sbyte)InventoryType.Wearable;
|
||||
case "application/vnd.ll.primitive":
|
||||
case "application/x-metaverse-primitive":
|
||||
return (sbyte)InventoryType.Object;
|
||||
case "application/vnd.ll.notecard":
|
||||
case "application/x-metaverse-notecard":
|
||||
return (sbyte)InventoryType.Notecard;
|
||||
case "application/vnd.ll.folder":
|
||||
return (sbyte)InventoryType.Folder;
|
||||
case "application/vnd.ll.rootfolder":
|
||||
return (sbyte)InventoryType.RootCategory;
|
||||
case "application/vnd.ll.lsltext":
|
||||
case "application/x-metaverse-lsl":
|
||||
case "application/vnd.ll.lslbyte":
|
||||
case "application/x-metaverse-lso":
|
||||
return (sbyte)InventoryType.LSL;
|
||||
case "application/vnd.ll.trashfolder":
|
||||
case "application/vnd.ll.snapshotfolder":
|
||||
case "application/vnd.ll.lostandfoundfolder":
|
||||
return (sbyte)InventoryType.Folder;
|
||||
case "application/vnd.ll.animation":
|
||||
case "application/x-metaverse-animation":
|
||||
return (sbyte)InventoryType.Animation;
|
||||
case "application/vnd.ll.gesture":
|
||||
case "application/x-metaverse-gesture":
|
||||
return (sbyte)InventoryType.Gesture;
|
||||
case "application/x-metaverse-simstate":
|
||||
return (sbyte)InventoryType.Snapshot;
|
||||
case "application/octet-stream":
|
||||
default:
|
||||
return (sbyte)InventoryType.Unknown;
|
||||
}
|
||||
InventoryType invType;
|
||||
if (!content2Inventory.TryGetValue(contentType, out invType))
|
||||
invType = InventoryType.Unknown;
|
||||
return (sbyte)invType;
|
||||
}
|
||||
|
||||
public static string SLAssetTypeToExtension(int assetType)
|
||||
{
|
||||
string extension;
|
||||
if (!asset2Extension.TryGetValue((sbyte)assetType, out extension))
|
||||
extension = asset2Extension[(sbyte)AssetType.Unknown];
|
||||
return extension;
|
||||
}
|
||||
|
||||
#endregion SL / file extension / content-type conversions
|
||||
@@ -377,4 +327,4 @@ namespace OpenSim.Framework
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
/// </summary>
|
||||
public class LandDataSerializer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static Dictionary<string, Action<LandData, XmlTextReader>> m_ldProcessors
|
||||
= new Dictionary<string, Action<LandData, XmlTextReader>>();
|
||||
@@ -95,6 +93,8 @@ namespace OpenSim.Framework.Serialization.External
|
||||
"MediaURL", (ld, xtr) => ld.MediaURL = xtr.ReadElementString("MediaURL"));
|
||||
m_ldProcessors.Add(
|
||||
"MusicURL", (ld, xtr) => ld.MusicURL = xtr.ReadElementString("MusicURL"));
|
||||
m_ldProcessors.Add(
|
||||
"OwnerID", (ld, xtr) => ld.OwnerID = UUID.Parse(xtr.ReadElementString("OwnerID")));
|
||||
|
||||
m_ldProcessors.Add(
|
||||
"ParcelAccessList", ProcessParcelAccessList);
|
||||
@@ -163,7 +163,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
/// <exception cref="System.Xml.XmlException"></exception>
|
||||
public static LandData Deserialize(byte[] serializedLandData)
|
||||
{
|
||||
return Deserialize(m_utf8Encoding.GetString(serializedLandData, 0, serializedLandData.Length));
|
||||
return Deserialize(Encoding.UTF8.GetString(serializedLandData, 0, serializedLandData.Length));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -188,7 +188,16 @@ namespace OpenSim.Framework.Serialization.External
|
||||
return landData;
|
||||
}
|
||||
|
||||
public static string Serialize(LandData landData)
|
||||
/// <summary>
|
||||
/// Serialize land data
|
||||
/// </summary>
|
||||
/// <param name='landData'></param>
|
||||
/// <param name='options'>
|
||||
/// Serialization options.
|
||||
/// Can be null if there are no options.
|
||||
/// "wipe-owners" will write UUID.Zero rather than the ownerID so that a later reload loads all parcels with the estate owner as the owner
|
||||
/// </param>
|
||||
public static string Serialize(LandData landData, Dictionary<string, object> options)
|
||||
{
|
||||
StringWriter sw = new StringWriter();
|
||||
XmlTextWriter xtw = new XmlTextWriter(sw);
|
||||
@@ -217,7 +226,14 @@ namespace OpenSim.Framework.Serialization.External
|
||||
xtw.WriteElementString("MediaID", landData.MediaID.ToString());
|
||||
xtw.WriteElementString("MediaURL", landData.MediaURL);
|
||||
xtw.WriteElementString("MusicURL", landData.MusicURL);
|
||||
xtw.WriteElementString("OwnerID", landData.OwnerID.ToString());
|
||||
|
||||
UUID ownerIdToWrite;
|
||||
if (options != null && options.ContainsKey("wipe-owners"))
|
||||
ownerIdToWrite = UUID.Zero;
|
||||
else
|
||||
ownerIdToWrite = landData.OwnerID;
|
||||
|
||||
xtw.WriteElementString("OwnerID", ownerIdToWrite.ToString());
|
||||
|
||||
xtw.WriteStartElement("ParcelAccessList");
|
||||
foreach (LandAccessEntry pal in landData.ParcelAccessList)
|
||||
|
||||
@@ -65,9 +65,14 @@ namespace OpenSim.Framework.Serialization
|
||||
|
||||
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
|
||||
if (account != null)
|
||||
{
|
||||
return MakeOspa(account.FirstName, account.LastName);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId);
|
||||
// System.Console.WriteLine("[OSP RESOLVER]: No user account for {0}", userId);
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -79,10 +84,13 @@ namespace OpenSim.Framework.Serialization
|
||||
/// <returns></returns>
|
||||
public static string MakeOspa(string firstName, string lastName)
|
||||
{
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName);
|
||||
string ospa
|
||||
= OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
||||
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
|
||||
// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
|
||||
|
||||
return
|
||||
OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
||||
return ospa;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -30,6 +30,8 @@ using System.Text;
|
||||
using System.Xml;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
|
||||
namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
@@ -38,8 +40,6 @@ namespace OpenSim.Framework.Serialization.External
|
||||
/// </summary>
|
||||
public class RegionSettingsSerializer
|
||||
{
|
||||
protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize settings
|
||||
/// </summary>
|
||||
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
/// <exception cref="System.Xml.XmlException"></exception>
|
||||
public static RegionSettings Deserialize(byte[] serializedSettings)
|
||||
{
|
||||
return Deserialize(m_asciiEncoding.GetString(serializedSettings, 0, serializedSettings.Length));
|
||||
return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -187,7 +187,29 @@ namespace OpenSim.Framework.Serialization.External
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
xtr.ReadEndElement();
|
||||
|
||||
if (xtr.IsStartElement("Telehub"))
|
||||
{
|
||||
xtr.ReadStartElement("Telehub");
|
||||
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
switch (xtr.Name)
|
||||
{
|
||||
case "TelehubObject":
|
||||
settings.TelehubObject = UUID.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
case "SpawnPoint":
|
||||
string str = xtr.ReadElementContentAsString();
|
||||
SpawnPoint sp = SpawnPoint.Parse(str);
|
||||
settings.AddSpawnPoint(sp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xtr.Close();
|
||||
sr.Close();
|
||||
|
||||
@@ -243,7 +265,16 @@ namespace OpenSim.Framework.Serialization.External
|
||||
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.WriteEndElement();
|
||||
|
||||
xtw.WriteStartElement("Telehub");
|
||||
if (settings.TelehubObject != UUID.Zero)
|
||||
{
|
||||
xtw.WriteElementString("TelehubObject", settings.TelehubObject.ToString());
|
||||
foreach (SpawnPoint sp in settings.SpawnPoints())
|
||||
xtw.WriteElementString("SpawnPoint", sp.ToString());
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.WriteEndElement();
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
/// </summary>
|
||||
public class UserInventoryItemSerializer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static Dictionary<string, Action<InventoryItemBase, XmlTextReader>> m_InventoryItemXmlProcessors
|
||||
= new Dictionary<string, Action<InventoryItemBase, XmlTextReader>>();
|
||||
|
||||
@@ -53,8 +53,6 @@ namespace OpenSim.Framework.Serialization
|
||||
TYPE_CONTIGUOUS_FILE = 8,
|
||||
}
|
||||
|
||||
protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
|
||||
|
||||
/// <summary>
|
||||
/// Binary reader for the underlying stream
|
||||
/// </summary>
|
||||
@@ -120,13 +118,13 @@ namespace OpenSim.Framework.Serialization
|
||||
if (header[156] == (byte)'L')
|
||||
{
|
||||
int longNameLength = ConvertOctalBytesToDecimal(header, 124, 11);
|
||||
tarHeader.FilePath = m_asciiEncoding.GetString(ReadData(longNameLength));
|
||||
tarHeader.FilePath = Encoding.ASCII.GetString(ReadData(longNameLength));
|
||||
//m_log.DebugFormat("[TAR ARCHIVE READER]: Got long file name {0}", tarHeader.FilePath);
|
||||
header = m_br.ReadBytes(512);
|
||||
}
|
||||
else
|
||||
{
|
||||
tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100);
|
||||
tarHeader.FilePath = Encoding.ASCII.GetString(header, 0, 100);
|
||||
tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray);
|
||||
//m_log.DebugFormat("[TAR ARCHIVE READER]: Got short file name {0}", tarHeader.FilePath);
|
||||
}
|
||||
@@ -205,7 +203,7 @@ namespace OpenSim.Framework.Serialization
|
||||
{
|
||||
// Trim leading white space: ancient tars do that instead
|
||||
// of leading 0s :-( don't ask. really.
|
||||
string oString = m_asciiEncoding.GetString(bytes, startIndex, count).TrimStart(m_spaceCharArray);
|
||||
string oString = Encoding.ASCII.GetString(bytes, startIndex, count).TrimStart(m_spaceCharArray);
|
||||
|
||||
int d = 0;
|
||||
|
||||
|
||||
@@ -41,9 +41,6 @@ namespace OpenSim.Framework.Serialization
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
|
||||
protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
|
||||
|
||||
/// <summary>
|
||||
/// Binary writer for the underlying stream
|
||||
/// </summary>
|
||||
@@ -74,7 +71,7 @@ namespace OpenSim.Framework.Serialization
|
||||
/// <param name="data"></param>
|
||||
public void WriteFile(string filePath, string data)
|
||||
{
|
||||
WriteFile(filePath, m_utf8Encoding.GetBytes(data));
|
||||
WriteFile(filePath, Util.UTF8NoBomEncoding.GetBytes(data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -85,7 +82,7 @@ namespace OpenSim.Framework.Serialization
|
||||
public void WriteFile(string filePath, byte[] data)
|
||||
{
|
||||
if (filePath.Length > 100)
|
||||
WriteEntry("././@LongLink", m_asciiEncoding.GetBytes(filePath), 'L');
|
||||
WriteEntry("././@LongLink", Encoding.ASCII.GetBytes(filePath), 'L');
|
||||
|
||||
char fileType;
|
||||
|
||||
@@ -137,7 +134,7 @@ namespace OpenSim.Framework.Serialization
|
||||
oString = "0" + oString;
|
||||
}
|
||||
|
||||
byte[] oBytes = m_asciiEncoding.GetBytes(oString);
|
||||
byte[] oBytes = Encoding.ASCII.GetBytes(oString);
|
||||
|
||||
return oBytes;
|
||||
}
|
||||
@@ -156,20 +153,20 @@ namespace OpenSim.Framework.Serialization
|
||||
byte[] header = new byte[512];
|
||||
|
||||
// file path field (100)
|
||||
byte[] nameBytes = m_asciiEncoding.GetBytes(filePath);
|
||||
byte[] nameBytes = Encoding.ASCII.GetBytes(filePath);
|
||||
int nameSize = (nameBytes.Length >= 100) ? 100 : nameBytes.Length;
|
||||
Array.Copy(nameBytes, header, nameSize);
|
||||
|
||||
// file mode (8)
|
||||
byte[] modeBytes = m_asciiEncoding.GetBytes("0000777");
|
||||
byte[] modeBytes = Encoding.ASCII.GetBytes("0000777");
|
||||
Array.Copy(modeBytes, 0, header, 100, 7);
|
||||
|
||||
// owner user id (8)
|
||||
byte[] ownerIdBytes = m_asciiEncoding.GetBytes("0000764");
|
||||
byte[] ownerIdBytes = Encoding.ASCII.GetBytes("0000764");
|
||||
Array.Copy(ownerIdBytes, 0, header, 108, 7);
|
||||
|
||||
// group user id (8)
|
||||
byte[] groupIdBytes = m_asciiEncoding.GetBytes("0000764");
|
||||
byte[] groupIdBytes = Encoding.ASCII.GetBytes("0000764");
|
||||
Array.Copy(groupIdBytes, 0, header, 116, 7);
|
||||
|
||||
// file size in bytes (12)
|
||||
@@ -181,17 +178,17 @@ namespace OpenSim.Framework.Serialization
|
||||
Array.Copy(fileSizeBytes, 0, header, 124, 11);
|
||||
|
||||
// last modification time (12)
|
||||
byte[] lastModTimeBytes = m_asciiEncoding.GetBytes("11017037332");
|
||||
byte[] lastModTimeBytes = Encoding.ASCII.GetBytes("11017037332");
|
||||
Array.Copy(lastModTimeBytes, 0, header, 136, 11);
|
||||
|
||||
// entry type indicator (1)
|
||||
header[156] = m_asciiEncoding.GetBytes(new char[] { fileType })[0];
|
||||
header[156] = Encoding.ASCII.GetBytes(new char[] { fileType })[0];
|
||||
|
||||
Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 329, 7);
|
||||
Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 337, 7);
|
||||
Array.Copy(Encoding.ASCII.GetBytes("0000000"), 0, header, 329, 7);
|
||||
Array.Copy(Encoding.ASCII.GetBytes("0000000"), 0, header, 337, 7);
|
||||
|
||||
// check sum for header block (8) [calculated last]
|
||||
Array.Copy(m_asciiEncoding.GetBytes(" "), 0, header, 148, 8);
|
||||
Array.Copy(Encoding.ASCII.GetBytes(" "), 0, header, 148, 8);
|
||||
|
||||
int checksum = 0;
|
||||
foreach (byte b in header)
|
||||
|
||||
@@ -42,22 +42,23 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
private LandData land;
|
||||
private LandData landWithParcelAccessList;
|
||||
|
||||
private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
||||
private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>0</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>0</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
||||
// private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
||||
private static string preSerializedWithParcelAccessList
|
||||
= "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>0</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>0</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
||||
|
||||
[SetUp]
|
||||
public void setup()
|
||||
{
|
||||
// setup LandData object
|
||||
this.land = new LandData();
|
||||
this.land.AABBMax = new Vector3(0, 0, 0);
|
||||
this.land.AABBMin = new Vector3(128, 128, 128);
|
||||
this.land.AABBMax = new Vector3(1, 2, 3);
|
||||
this.land.AABBMin = new Vector3(129, 130, 131);
|
||||
this.land.Area = 128;
|
||||
this.land.AuctionID = 0;
|
||||
this.land.AuthBuyerID = new UUID();
|
||||
this.land.AuctionID = 4;
|
||||
this.land.AuthBuyerID = new UUID("7176df0c-6c50-45db-8a37-5e78be56a0cd");
|
||||
this.land.Category = ParcelCategory.Residential;
|
||||
this.land.ClaimDate = 0;
|
||||
this.land.ClaimPrice = 0;
|
||||
this.land.ClaimDate = 1;
|
||||
this.land.ClaimPrice = 2;
|
||||
this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50");
|
||||
this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5");
|
||||
this.land.Description = "land data to test LandDataSerializer";
|
||||
@@ -65,7 +66,7 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
this.land.LandingType = (byte)LandingType.Direct;
|
||||
this.land.Name = "LandDataSerializerTest Land";
|
||||
this.land.Status = ParcelStatus.Leased;
|
||||
this.land.LocalID = 0;
|
||||
this.land.LocalID = 1;
|
||||
this.land.MediaAutoScale = (byte)0x01;
|
||||
this.land.MediaID = new UUID("d4452578-2f25-4b97-a81b-819af559cfd7");
|
||||
this.land.MediaURL = "http://videos.opensimulator.org/bumblebee.mp4";
|
||||
@@ -90,26 +91,26 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
/// <summary>
|
||||
/// Test the LandDataSerializer.Serialize() method
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void LandDataSerializerSerializeTest()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string serialized = LandDataSerializer.Serialize(this.land).Replace("\r\n", "\n");
|
||||
Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string");
|
||||
|
||||
// adding a simple boolean variable because resharper nUnit integration doesn't like this
|
||||
// XML data in the Assert.That statement. Not sure why.
|
||||
bool result = (serialized == preSerialized);
|
||||
Assert.That(result, "result of Serialize LandData does not match expected result");
|
||||
|
||||
string serializedWithParcelAccessList = LandDataSerializer.Serialize(this.landWithParcelAccessList).Replace("\r\n", "\n");
|
||||
Assert.That(serializedWithParcelAccessList.Length > 0,
|
||||
"Serialize(LandData) returned empty string for LandData object with ParcelAccessList");
|
||||
result = (serializedWithParcelAccessList == preSerializedWithParcelAccessList);
|
||||
Assert.That(result,
|
||||
"result of Serialize(LandData) does not match expected result (pre-serialized with parcel access list");
|
||||
}
|
||||
// [Test]
|
||||
// public void LandDataSerializerSerializeTest()
|
||||
// {
|
||||
// TestHelpers.InMethod();
|
||||
//
|
||||
// string serialized = LandDataSerializer.Serialize(this.land).Replace("\r\n", "\n");
|
||||
// Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string");
|
||||
//
|
||||
// // adding a simple boolean variable because resharper nUnit integration doesn't like this
|
||||
// // XML data in the Assert.That statement. Not sure why.
|
||||
// bool result = (serialized == preSerialized);
|
||||
// Assert.That(result, "result of Serialize LandData does not match expected result");
|
||||
//
|
||||
// string serializedWithParcelAccessList = LandDataSerializer.Serialize(this.landWithParcelAccessList).Replace("\r\n", "\n");
|
||||
// Assert.That(serializedWithParcelAccessList.Length > 0,
|
||||
// "Serialize(LandData) returned empty string for LandData object with ParcelAccessList");
|
||||
// result = (serializedWithParcelAccessList == preSerializedWithParcelAccessList);
|
||||
// Assert.That(result,
|
||||
// "result of Serialize(LandData) does not match expected result (pre-serialized with parcel access list");
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Test the LandDataSerializer.Deserialize() method
|
||||
@@ -120,10 +121,28 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized);
|
||||
Assert.That(ld != null, "Deserialize(string) returned null");
|
||||
Assert.That(ld.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID");
|
||||
Assert.That(ld.Name == this.land.Name, "Reified LandData.Name != original LandData.Name");
|
||||
LandData ld = LandDataSerializer.Deserialize(LandDataSerializer.Serialize(this.land, null));
|
||||
Assert.That(ld, Is.Not.Null, "Deserialize(string) returned null");
|
||||
// Assert.That(ld.AABBMax, Is.EqualTo(land.AABBMax));
|
||||
// Assert.That(ld.AABBMin, Is.EqualTo(land.AABBMin));
|
||||
Assert.That(ld.Area, Is.EqualTo(land.Area));
|
||||
Assert.That(ld.AuctionID, Is.EqualTo(land.AuctionID));
|
||||
Assert.That(ld.AuthBuyerID, Is.EqualTo(land.AuthBuyerID));
|
||||
Assert.That(ld.Category, Is.EqualTo(land.Category));
|
||||
Assert.That(ld.ClaimDate, Is.EqualTo(land.ClaimDate));
|
||||
Assert.That(ld.ClaimPrice, Is.EqualTo(land.ClaimPrice));
|
||||
Assert.That(ld.GlobalID, Is.EqualTo(land.GlobalID), "Reified LandData.GlobalID != original LandData.GlobalID");
|
||||
Assert.That(ld.GroupID, Is.EqualTo(land.GroupID));
|
||||
Assert.That(ld.Description, Is.EqualTo(land.Description));
|
||||
Assert.That(ld.Flags, Is.EqualTo(land.Flags));
|
||||
Assert.That(ld.LandingType, Is.EqualTo(land.LandingType));
|
||||
Assert.That(ld.Name, Is.EqualTo(land.Name), "Reified LandData.Name != original LandData.Name");
|
||||
Assert.That(ld.Status, Is.EqualTo(land.Status));
|
||||
Assert.That(ld.LocalID, Is.EqualTo(land.LocalID));
|
||||
Assert.That(ld.MediaAutoScale, Is.EqualTo(land.MediaAutoScale));
|
||||
Assert.That(ld.MediaID, Is.EqualTo(land.MediaID));
|
||||
Assert.That(ld.MediaURL, Is.EqualTo(land.MediaURL));
|
||||
Assert.That(ld.OwnerID, Is.EqualTo(land.OwnerID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -78,6 +78,10 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
<FixedSun>true</FixedSun>
|
||||
<SunPosition>12</SunPosition>
|
||||
</Terrain>
|
||||
<Telehub>
|
||||
<TelehubObject>00000000-0000-0000-0000-111111111111</TelehubObject>
|
||||
<SpawnPoint>1,-2,0.33</SpawnPoint>
|
||||
</Telehub>
|
||||
</RegionSettings>";
|
||||
|
||||
private RegionSettings m_rs;
|
||||
@@ -116,6 +120,8 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
|
||||
m_rs.UseEstateSun = true;
|
||||
m_rs.WaterHeight = 23;
|
||||
m_rs.TelehubObject = UUID.Parse("00000000-0000-0000-0000-111111111111");
|
||||
m_rs.AddSpawnPoint(SpawnPoint.Parse("1,-2,0.33"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -129,6 +135,8 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||
Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2));
|
||||
Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics));
|
||||
Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit));
|
||||
Assert.That(deserRs.TelehubObject, Is.EqualTo(m_rs.TelehubObject));
|
||||
Assert.That(deserRs.SpawnPoints()[0].ToString(), Is.EqualTo(m_rs.SpawnPoints()[0].ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ using log4net.Core;
|
||||
using log4net.Repository;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.Statistics;
|
||||
using Timer=System.Timers.Timer;
|
||||
|
||||
using OpenMetaverse;
|
||||
@@ -320,7 +320,9 @@ namespace OpenSim.Framework.Servers
|
||||
|
||||
TimeSpan timeTaken = DateTime.Now - m_startuptime;
|
||||
|
||||
m_log.InfoFormat("[STARTUP]: Startup took {0}m {1}s", timeTaken.Minutes, timeTaken.Seconds);
|
||||
m_log.InfoFormat(
|
||||
"[STARTUP]: Non-script portion of startup took {0}m {1}s. PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED.",
|
||||
timeTaken.Minutes, timeTaken.Seconds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -589,8 +591,8 @@ namespace OpenSim.Framework.Servers
|
||||
{
|
||||
string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
|
||||
FileStream fs = File.Create(path);
|
||||
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||
Byte[] buf = enc.GetBytes(pidstring);
|
||||
|
||||
Byte[] buf = Encoding.ASCII.GetBytes(pidstring);
|
||||
fs.Write(buf, 0, buf.Length);
|
||||
fs.Close();
|
||||
m_pidFile = path;
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public abstract Hashtable Handle(string path, Hashtable Request);
|
||||
|
||||
protected BaseHTTPHandler(string httpMethod, string path)
|
||||
: base(httpMethod, path)
|
||||
{
|
||||
}
|
||||
protected BaseHTTPHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {}
|
||||
|
||||
protected BaseHTTPHandler(string httpMethod, string path, string name, string description)
|
||||
: base(httpMethod, path, name, description) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ using OpenMetaverse.StructuredData;
|
||||
using CoolHTTPListener = HttpServer.HttpListener;
|
||||
using HttpListener=System.Net.HttpListener;
|
||||
using LogPrio=HttpServer.LogPrio;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
@@ -53,6 +54,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
|
||||
|
||||
public int DebugLevel { get; set; }
|
||||
|
||||
private volatile int NotSocketErrors = 0;
|
||||
public volatile bool HTTPDRunning = false;
|
||||
|
||||
@@ -79,11 +82,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
private PollServiceRequestManager m_PollServiceManager;
|
||||
|
||||
/// <summary>
|
||||
/// Control the printing of certain debug messages.
|
||||
/// </summary>
|
||||
public int DebugLevel { get; set; }
|
||||
|
||||
public uint SSLPort
|
||||
{
|
||||
get { return m_sslport; }
|
||||
@@ -156,7 +154,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> GetStreamHandlerKeys()
|
||||
public List<string> GetStreamHandlerKeys()
|
||||
{
|
||||
lock (m_streamHandlers)
|
||||
return new List<string>(m_streamHandlers.Keys);
|
||||
@@ -356,7 +354,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: OnRequest() failed with {0}{1}", e.Message, e.StackTrace);
|
||||
m_log.Error(String.Format("[BASE HTTP SERVER]: OnRequest() failed: {0} ", e.Message), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +406,12 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
string uriString = request.RawUrl;
|
||||
|
||||
// string reqnum = "unknown";
|
||||
int tickstart = Environment.TickCount;
|
||||
int requestStartTick = Environment.TickCount;
|
||||
|
||||
// Will be adjusted later on.
|
||||
int requestEndTick = requestStartTick;
|
||||
|
||||
IRequestHandler requestHandler = null;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -431,6 +434,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
if (HandleAgentRequest(agentHandler, request, response))
|
||||
{
|
||||
requestEndTick = Environment.TickCount;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -438,20 +442,16 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
//response.KeepAlive = true;
|
||||
response.SendChunked = false;
|
||||
|
||||
IRequestHandler requestHandler;
|
||||
|
||||
string path = request.RawUrl;
|
||||
string handlerKey = GetHandlerKey(request.HttpMethod, path);
|
||||
byte[] buffer = null;
|
||||
|
||||
if (TryGetStreamHandler(handlerKey, out requestHandler))
|
||||
{
|
||||
if (DebugLevel >= 1)
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found stream handler for {0} {1}",
|
||||
request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
// Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
|
||||
byte[] buffer = null;
|
||||
"[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}",
|
||||
request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description);
|
||||
|
||||
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
|
||||
|
||||
@@ -507,8 +507,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
//m_log.Warn("[HTTP]: " + requestBody);
|
||||
|
||||
}
|
||||
DoHTTPGruntWork(HTTPRequestHandler.Handle(path, keysvals), response);
|
||||
return;
|
||||
|
||||
buffer = DoHTTPGruntWork(HTTPRequestHandler.Handle(path, keysvals), response);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -521,133 +521,99 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
buffer = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (request.ContentType)
|
||||
{
|
||||
case null:
|
||||
case "text/html":
|
||||
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
buffer = HandleHTTPRequest(request, response);
|
||||
break;
|
||||
|
||||
case "application/llsd+xml":
|
||||
case "application/xml+llsd":
|
||||
case "application/llsd+json":
|
||||
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
buffer = HandleLLSDRequests(request, response);
|
||||
break;
|
||||
|
||||
case "text/xml":
|
||||
case "application/xml":
|
||||
case "application/json":
|
||||
default:
|
||||
//m_log.Info("[Debug BASE HTTP SERVER]: in default handler");
|
||||
// Point of note.. the DoWeHaveA methods check for an EXACT path
|
||||
// if (request.RawUrl.Contains("/CAPS/EQG"))
|
||||
// {
|
||||
// int i = 1;
|
||||
// }
|
||||
//m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler");
|
||||
if (DoWeHaveALLSDHandler(request.RawUrl))
|
||||
{
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
buffer = HandleLLSDRequests(request, response);
|
||||
}
|
||||
// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl);
|
||||
else if (DoWeHaveAHTTPHandler(request.RawUrl))
|
||||
{
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
buffer = HandleHTTPRequest(request, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}",
|
||||
request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
// generic login request.
|
||||
buffer = HandleXmlRpcRequests(request, response);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
request.InputStream.Close();
|
||||
|
||||
// HTTP IN support. The script engine takes it from here
|
||||
// Nothing to worry about for us.
|
||||
//
|
||||
if (buffer == null)
|
||||
return;
|
||||
request.InputStream.Close();
|
||||
|
||||
if (buffer != null)
|
||||
{
|
||||
if (!response.SendChunked)
|
||||
response.ContentLength64 = buffer.LongLength;
|
||||
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
//response.OutputStream.Close();
|
||||
}
|
||||
catch (HttpListenerException)
|
||||
{
|
||||
m_log.WarnFormat("[BASE HTTP SERVER]: HTTP request abnormally terminated.");
|
||||
}
|
||||
//response.OutputStream.Close();
|
||||
try
|
||||
{
|
||||
response.Send();
|
||||
//response.FreeContext();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This has to be here to prevent a Linux/Mono crash
|
||||
m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message);
|
||||
}
|
||||
|
||||
return;
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
if (request.AcceptTypes != null && request.AcceptTypes.Length > 0)
|
||||
{
|
||||
foreach (string strAccept in request.AcceptTypes)
|
||||
{
|
||||
if (strAccept.Contains("application/llsd+xml") ||
|
||||
strAccept.Contains("application/llsd+json"))
|
||||
{
|
||||
if (DebugLevel >= 1)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found application/llsd+xml accept header handler for {0} {1}",
|
||||
request.HttpMethod, request.Url.PathAndQuery);
|
||||
// Do not include the time taken to actually send the response to the caller in the measurement
|
||||
// time. This is to avoid logging when it's the client that is slow to process rather than the
|
||||
// server
|
||||
requestEndTick = Environment.TickCount;
|
||||
|
||||
HandleLLSDRequests(request, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
response.Send();
|
||||
|
||||
switch (request.ContentType)
|
||||
{
|
||||
case null:
|
||||
case "text/html":
|
||||
//response.OutputStream.Close();
|
||||
|
||||
if (DebugLevel >= 1)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
HandleHTTPRequest(request, response);
|
||||
return;
|
||||
|
||||
case "application/llsd+xml":
|
||||
case "application/xml+llsd":
|
||||
case "application/llsd+json":
|
||||
|
||||
if (DebugLevel >= 1)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
HandleLLSDRequests(request, response);
|
||||
return;
|
||||
|
||||
case "text/xml":
|
||||
case "application/xml":
|
||||
case "application/json":
|
||||
default:
|
||||
//m_log.Info("[Debug BASE HTTP SERVER]: in default handler");
|
||||
// Point of note.. the DoWeHaveA methods check for an EXACT path
|
||||
// if (request.RawUrl.Contains("/CAPS/EQG"))
|
||||
// {
|
||||
// int i = 1;
|
||||
// }
|
||||
//m_log.Info("[Debug BASE HTTP SERVER]: Checking for LLSD Handler");
|
||||
if (DoWeHaveALLSDHandler(request.RawUrl))
|
||||
{
|
||||
if (DebugLevel >= 1)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
HandleLLSDRequests(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl);
|
||||
if (DoWeHaveAHTTPHandler(request.RawUrl))
|
||||
{
|
||||
if (DebugLevel >= 1)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
HandleHTTPRequest(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (DebugLevel >= 1)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}",
|
||||
request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
// generic login request.
|
||||
HandleXmlRpcRequests(request, response);
|
||||
|
||||
return;
|
||||
}
|
||||
//response.FreeContext();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
@@ -658,25 +624,33 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
//
|
||||
// An alternative may be to turn off all response write exceptions on the HttpListener, but let's go
|
||||
// with the minimum first
|
||||
m_log.WarnFormat("[BASE HTTP SERVER]: HandleRequest threw {0}.\nNOTE: this may be spurious on Linux", e);
|
||||
m_log.Warn(String.Format("[BASE HTTP SERVER]: HandleRequest threw {0}.\nNOTE: this may be spurious on Linux ", e.Message), e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e);
|
||||
m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e.StackTrace);
|
||||
m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e);
|
||||
SendHTML500(response);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Every month or so this will wrap and give bad numbers, not really a problem
|
||||
// since its just for reporting, tickdiff limit can be adjusted
|
||||
int tickdiff = Environment.TickCount - tickstart;
|
||||
// since its just for reporting
|
||||
int tickdiff = requestEndTick - requestStartTick;
|
||||
if (tickdiff > 3000)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[BASE HTTP SERVER]: slow {0} request for {1} from {2} took {3} ms", requestMethod, uriString, request.RemoteIPEndPoint.ToString(), tickdiff);
|
||||
"[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms",
|
||||
requestMethod,
|
||||
uriString,
|
||||
requestHandler != null ? requestHandler.Name : "",
|
||||
requestHandler != null ? requestHandler.Description : "",
|
||||
request.RemoteIPEndPoint.ToString(),
|
||||
tickdiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,7 +771,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="response"></param>
|
||||
private void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
|
||||
private byte[] HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
|
||||
{
|
||||
Stream requestStream = request.InputStream;
|
||||
|
||||
@@ -816,8 +790,23 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
||||
}
|
||||
catch (XmlException)
|
||||
catch (XmlException e)
|
||||
{
|
||||
if (DebugLevel >= 1)
|
||||
{
|
||||
if (DebugLevel >= 2)
|
||||
m_log.Warn(
|
||||
string.Format(
|
||||
"[BASE HTTP SERVER]: Got XMLRPC request with invalid XML from {0}. XML was '{1}'. Sending blank response. Exception ",
|
||||
request.RemoteIPEndPoint, requestBody),
|
||||
e);
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[BASE HTTP SERVER]: Got XMLRPC request with invalid XML from {0}, length {1}. Sending blank response.",
|
||||
request.RemoteIPEndPoint, requestBody.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (xmlRprcRequest != null)
|
||||
@@ -887,6 +876,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
String.Format("Requested method [{0}] not found", methodName));
|
||||
}
|
||||
|
||||
response.ContentType = "text/xml";
|
||||
responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
|
||||
}
|
||||
else
|
||||
@@ -896,82 +886,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
response.StatusCode = 404;
|
||||
response.StatusDescription = "Not Found";
|
||||
response.ProtocolVersion = "HTTP/1.0";
|
||||
byte[] buf = Encoding.UTF8.GetBytes("Not found");
|
||||
responseString = "Not found";
|
||||
response.KeepAlive = false;
|
||||
|
||||
m_log.ErrorFormat(
|
||||
"[BASE HTTP SERVER]: Handler not found for http request {0} {1}",
|
||||
request.HttpMethod, request.Url.PathAndQuery);
|
||||
|
||||
response.SendChunked = false;
|
||||
response.ContentLength64 = buf.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buf, 0, buf.Length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
response.Send();
|
||||
//response.FreeContext();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This has to be here to prevent a Linux/Mono crash
|
||||
m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message);
|
||||
}
|
||||
}
|
||||
return;
|
||||
//responseString = "Error";
|
||||
}
|
||||
}
|
||||
|
||||
response.ContentType = "text/xml";
|
||||
|
||||
byte[] buffer = Encoding.UTF8.GetBytes(responseString);
|
||||
|
||||
response.SendChunked = false;
|
||||
response.ContentLength64 = buffer.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
response.Send();
|
||||
//response.FreeContext();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This has to be here to prevent a Linux/Mono crash
|
||||
m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private void HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response)
|
||||
private byte[] HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response)
|
||||
{
|
||||
//m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request");
|
||||
Stream requestStream = request.InputStream;
|
||||
@@ -1057,34 +990,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
response.KeepAlive = true;
|
||||
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
//response.OutputStream.Close();
|
||||
try
|
||||
{
|
||||
response.Send();
|
||||
response.OutputStream.Flush();
|
||||
//response.FreeContext();
|
||||
//response.OutputStream.Close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
m_log.WarnFormat("[BASE HTTP SERVER]: LLSD IOException {0}.", e);
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This has to be here to prevent a Linux/Mono crash
|
||||
m_log.WarnFormat("[BASE HTTP SERVER]: LLSD issue {0}.\nNOTE: this may be spurious on Linux.", e);
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private byte[] BuildLLSDResponse(OSHttpRequest request, OSHttpResponse response, OSD llsdResponse)
|
||||
@@ -1334,8 +1240,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
catch (SocketException f)
|
||||
{
|
||||
// This has to be here to prevent a Linux/Mono crash
|
||||
m_log.WarnFormat(
|
||||
"[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", f);
|
||||
m_log.Warn(
|
||||
String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", f.Message), f);
|
||||
}
|
||||
}
|
||||
catch(Exception)
|
||||
@@ -1349,7 +1255,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
}
|
||||
|
||||
public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response)
|
||||
public byte[] HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}",
|
||||
@@ -1359,15 +1265,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
case "OPTIONS":
|
||||
response.StatusCode = (int)OSHttpStatusCode.SuccessOk;
|
||||
return;
|
||||
return null;
|
||||
|
||||
default:
|
||||
HandleContentVerbs(request, response);
|
||||
return;
|
||||
return HandleContentVerbs(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response)
|
||||
private byte[] HandleContentVerbs(OSHttpRequest request, OSHttpResponse response)
|
||||
{
|
||||
// m_log.DebugFormat("[BASE HTTP SERVER]: HandleContentVerbs for request to {0}", request.RawUrl);
|
||||
|
||||
@@ -1383,6 +1288,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
// to display the form, or process it.
|
||||
// a better way would be nifty.
|
||||
|
||||
byte[] buffer;
|
||||
|
||||
Stream requestStream = request.InputStream;
|
||||
|
||||
Encoding encoding = Encoding.UTF8;
|
||||
@@ -1443,14 +1350,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
if (foundHandler)
|
||||
{
|
||||
Hashtable responsedata1 = requestprocessor(keysvals);
|
||||
DoHTTPGruntWork(responsedata1,response);
|
||||
buffer = DoHTTPGruntWork(responsedata1,response);
|
||||
|
||||
//SendHTML500(response);
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.Warn("[BASE HTTP SERVER]: Handler Not Found");
|
||||
SendHTML404(response, host);
|
||||
buffer = SendHTML404(response, host);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1460,16 +1367,18 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
if (foundHandler)
|
||||
{
|
||||
Hashtable responsedata2 = requestprocessor(keysvals);
|
||||
DoHTTPGruntWork(responsedata2, response);
|
||||
buffer = DoHTTPGruntWork(responsedata2, response);
|
||||
|
||||
//SendHTML500(response);
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.Warn("[BASE HTTP SERVER]: Handler Not Found2");
|
||||
SendHTML404(response, host);
|
||||
buffer = SendHTML404(response, host);
|
||||
}
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private bool TryGetHTTPHandlerPathBased(string path, out GenericHTTPMethod httpHandler)
|
||||
@@ -1537,14 +1446,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
}
|
||||
|
||||
internal void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
|
||||
internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
|
||||
{
|
||||
//m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response");
|
||||
int responsecode = (int)responsedata["int_response_code"];
|
||||
string responseString = (string)responsedata["str_response_string"];
|
||||
string contentType = (string)responsedata["content_type"];
|
||||
|
||||
|
||||
if (responsedata.ContainsKey("error_status_text"))
|
||||
{
|
||||
response.StatusDescription = (string)responsedata["error_status_text"];
|
||||
@@ -1608,38 +1516,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
response.ContentLength64 = buffer.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("[HTTPD]: Error - " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
//response.OutputStream.Close();
|
||||
try
|
||||
{
|
||||
response.OutputStream.Flush();
|
||||
response.Send();
|
||||
|
||||
//if (!response.KeepAlive && response.ReuseContext)
|
||||
// response.FreeContext();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This has to be here to prevent a Linux/Mono crash
|
||||
m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message);
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public void SendHTML404(OSHttpResponse response, string host)
|
||||
public byte[] SendHTML404(OSHttpResponse response, string host)
|
||||
{
|
||||
// I know this statuscode is dumb, but the client doesn't respond to 404s and 500s
|
||||
response.StatusCode = 404;
|
||||
@@ -1652,31 +1532,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
response.ContentLength64 = buffer.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
//response.OutputStream.Close();
|
||||
try
|
||||
{
|
||||
response.Send();
|
||||
//response.FreeContext();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This has to be here to prevent a Linux/Mono crash
|
||||
m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public void SendHTML500(OSHttpResponse response)
|
||||
public byte[] SendHTML500(OSHttpResponse response)
|
||||
{
|
||||
// I know this statuscode is dumb, but the client doesn't respond to 404s and 500s
|
||||
response.StatusCode = (int)OSHttpStatusCode.SuccessOk;
|
||||
@@ -1688,28 +1547,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
response.SendChunked = false;
|
||||
response.ContentLength64 = buffer.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
//response.OutputStream.Close();
|
||||
try
|
||||
{
|
||||
response.Send();
|
||||
//response.FreeContext();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This has to be here to prevent a Linux/Mono crash
|
||||
m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
|
||||
}
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
@@ -1719,6 +1558,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
private void StartHTTP()
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[BASE HTTP SERVER]: Starting {0} server on port {1}", UseSSL ? "HTTPS" : "HTTP", Port);
|
||||
|
||||
try
|
||||
{
|
||||
//m_httpListener = new HttpListener();
|
||||
@@ -1786,7 +1628,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
public void httpServerException(object source, Exception exception)
|
||||
{
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString());
|
||||
m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception);
|
||||
/*
|
||||
if (HTTPDRunning)// && NotSocketErrors > 5)
|
||||
{
|
||||
|
||||
@@ -45,8 +45,16 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
private readonly string m_path;
|
||||
|
||||
protected BaseRequestHandler(string httpMethod, string path)
|
||||
public string Name { get; private set; }
|
||||
|
||||
public string Description { get; private set; }
|
||||
|
||||
protected BaseRequestHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {}
|
||||
|
||||
protected BaseRequestHandler(string httpMethod, string path, string name, string description)
|
||||
{
|
||||
Name = name;
|
||||
Description = description;
|
||||
m_httpMethod = httpMethod;
|
||||
m_path = path;
|
||||
}
|
||||
|
||||
@@ -34,8 +34,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
public abstract byte[] Handle(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path) : base(httpMethod, path)
|
||||
{
|
||||
}
|
||||
protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {}
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path, string name, string description)
|
||||
: base(httpMethod, path, name, description) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,15 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
private BinaryMethod m_method;
|
||||
|
||||
public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod)
|
||||
: this(httpMethod, path, binaryMethod, null, null) {}
|
||||
|
||||
public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod, string name, string description)
|
||||
: base(httpMethod, path, name, description)
|
||||
{
|
||||
m_method = binaryMethod;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
byte[] data = ReadFully(request);
|
||||
@@ -45,12 +54,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
return Encoding.UTF8.GetBytes(responseString);
|
||||
}
|
||||
|
||||
public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod)
|
||||
: base(httpMethod, path)
|
||||
{
|
||||
m_method = binaryMethod;
|
||||
}
|
||||
|
||||
private static byte[] ReadFully(Stream stream)
|
||||
{
|
||||
byte[] buffer = new byte[1024];
|
||||
@@ -70,4 +73,4 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,11 +128,5 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
/// <param name="value">string containing the header field
|
||||
/// value</param>
|
||||
void AddHeader(string key, string value);
|
||||
|
||||
/// <summary>
|
||||
/// Send the response back to the remote client
|
||||
/// </summary>
|
||||
void Send();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,6 +32,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public interface IRequestHandler
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Name for this handler.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Used for diagnostics. The path doesn't always describe what the handler does. Can be null if none
|
||||
/// specified.
|
||||
/// </remarks>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Description for this handler.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Used for diagnostics. The path doesn't always describe what the handler does. Can be null if none
|
||||
/// specified.
|
||||
/// </remarks>
|
||||
string Description { get; }
|
||||
|
||||
// Return response content type
|
||||
string ContentType { get; }
|
||||
|
||||
@@ -58,4 +77,4 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
Hashtable Handle(string path, Hashtable request);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
public bool IsSecured
|
||||
{
|
||||
get { return _context.Secured; }
|
||||
get { return _context.IsSecured; }
|
||||
}
|
||||
|
||||
public bool KeepAlive
|
||||
|
||||
@@ -321,13 +321,12 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
_httpResponse.Body.Flush();
|
||||
_httpResponse.Send();
|
||||
|
||||
}
|
||||
|
||||
public void FreeContext()
|
||||
{
|
||||
if (_httpClientContext != null)
|
||||
_httpClientContext.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,143 +28,252 @@
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
/// <summary>
|
||||
/// HTTP status codes (almost) as defined by W3C in
|
||||
/// http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
||||
/// HTTP status codes (almost) as defined by W3C in http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html and IETF in http://tools.ietf.org/html/rfc6585
|
||||
/// </summary>
|
||||
public enum OSHttpStatusCode: int
|
||||
public enum OSHttpStatusCode : int
|
||||
{
|
||||
// 1xx Informational status codes providing a provisional
|
||||
// response.
|
||||
// 100 Tells client that to keep on going sending its request
|
||||
InfoContinue = 100,
|
||||
// 101 Server understands request, proposes to switch to different
|
||||
// application level protocol
|
||||
InfoSwitchingProtocols = 101,
|
||||
#region 1xx Informational status codes providing a provisional response.
|
||||
|
||||
/// <summary>
|
||||
/// 100 Tells client that to keep on going sending its request
|
||||
/// </summary>
|
||||
InfoContinue = 100,
|
||||
|
||||
// 2xx Success codes
|
||||
// 200 Request successful
|
||||
SuccessOk = 200,
|
||||
// 201 Request successful, new resource created
|
||||
SuccessOkCreated = 201,
|
||||
// 202 Request accepted, processing still on-going
|
||||
SuccessOkAccepted = 202,
|
||||
// 203 Request successful, meta information not authoritative
|
||||
SuccessOkNonAuthoritativeInformation = 203,
|
||||
// 204 Request successful, nothing to return in the body
|
||||
SuccessOkNoContent = 204,
|
||||
// 205 Request successful, reset displayed content
|
||||
SuccessOkResetContent = 205,
|
||||
// 206 Request successful, partial content returned
|
||||
SuccessOkPartialContent = 206,
|
||||
/// <summary>
|
||||
/// 101 Server understands request, proposes to switch to different application level protocol
|
||||
/// </summary>
|
||||
InfoSwitchingProtocols = 101,
|
||||
|
||||
// 3xx Redirect code: user agent needs to go somewhere else
|
||||
// 300 Redirect: different presentation forms available, take
|
||||
// a pick
|
||||
RedirectMultipleChoices = 300,
|
||||
// 301 Redirect: requested resource has moved and now lives
|
||||
// somewhere else
|
||||
RedirectMovedPermanently = 301,
|
||||
// 302 Redirect: Resource temporarily somewhere else, location
|
||||
// might change
|
||||
RedirectFound = 302,
|
||||
// 303 Redirect: See other as result of a POST
|
||||
RedirectSeeOther = 303,
|
||||
// 304 Redirect: Resource still the same as before
|
||||
RedirectNotModified = 304,
|
||||
// 305 Redirect: Resource must be accessed via proxy provided
|
||||
// in location field
|
||||
RedirectUseProxy = 305,
|
||||
// 307 Redirect: Resource temporarily somewhere else, location
|
||||
// might change
|
||||
RedirectMovedTemporarily = 307,
|
||||
#endregion
|
||||
|
||||
// 4xx Client error: the client borked the request
|
||||
// 400 Client error: bad request, server does not grok what
|
||||
// the client wants
|
||||
ClientErrorBadRequest = 400,
|
||||
// 401 Client error: the client is not authorized, response
|
||||
// provides WWW-Authenticate header field with a challenge
|
||||
ClientErrorUnauthorized = 401,
|
||||
// 402 Client error: Payment required (reserved for future use)
|
||||
ClientErrorPaymentRequired = 402,
|
||||
// 403 Client error: Server understood request, will not
|
||||
// deliver, do not try again.
|
||||
ClientErrorForbidden = 403,
|
||||
// 404 Client error: Server cannot find anything matching the
|
||||
// client request.
|
||||
ClientErrorNotFound = 404,
|
||||
// 405 Client error: The method specified by the client in the
|
||||
// request is not allowed for the resource requested
|
||||
ClientErrorMethodNotAllowed = 405,
|
||||
// 406 Client error: Server cannot generate suitable response
|
||||
// for the resource and content characteristics requested by
|
||||
// the client
|
||||
ClientErrorNotAcceptable = 406,
|
||||
// 407 Client error: Similar to 401, Server requests that
|
||||
// client authenticate itself with the proxy first
|
||||
ClientErrorProxyAuthRequired = 407,
|
||||
// 408 Client error: Server got impatient with client and
|
||||
// decided to give up waiting for the client's request to
|
||||
// arrive
|
||||
ClientErrorRequestTimeout = 408,
|
||||
// 409 Client error: Server could not fulfill the request for
|
||||
// a resource as there is a conflict with the current state of
|
||||
// the resource but thinks client can do something about this
|
||||
ClientErrorConflict = 409,
|
||||
// 410 Client error: The resource has moved somewhere else,
|
||||
// but server has no clue where.
|
||||
ClientErrorGone = 410,
|
||||
// 411 Client error: The server is picky again and insists on
|
||||
// having a content-length header field in the request
|
||||
ClientErrorLengthRequired = 411,
|
||||
// 412 Client error: one or more preconditions supplied in the
|
||||
// client's request is false
|
||||
ClientErrorPreconditionFailed = 412,
|
||||
// 413 Client error: For fear of reflux, the server refuses to
|
||||
// swallow that much data.
|
||||
ClientErrorRequestEntityToLarge = 413,
|
||||
// 414 Client error: The server considers the Request-URI to
|
||||
// be indecently long and refuses to even look at it.
|
||||
ClientErrorRequestURITooLong = 414,
|
||||
// 415 Client error: The server has no clue about the media
|
||||
// type requested by the client (contrary to popular belief it
|
||||
// is not a warez server)
|
||||
ClientErrorUnsupportedMediaType = 415,
|
||||
// 416 Client error: The requested range cannot be delivered
|
||||
// by the server.
|
||||
#region 2xx Success codes
|
||||
|
||||
/// <summary>
|
||||
/// 200 Request successful
|
||||
/// </summary>
|
||||
SuccessOk = 200,
|
||||
|
||||
/// <summary>
|
||||
/// 201 Request successful, new resource created
|
||||
/// </summary>
|
||||
SuccessOkCreated = 201,
|
||||
|
||||
/// <summary>
|
||||
/// 202 Request accepted, processing still on-going
|
||||
/// </summary>
|
||||
SuccessOkAccepted = 202,
|
||||
|
||||
/// <summary>
|
||||
/// 203 Request successful, meta information not authoritative
|
||||
/// </summary>
|
||||
SuccessOkNonAuthoritativeInformation = 203,
|
||||
|
||||
/// <summary>
|
||||
/// 204 Request successful, nothing to return in the body
|
||||
/// </summary>
|
||||
SuccessOkNoContent = 204,
|
||||
|
||||
/// <summary>
|
||||
/// 205 Request successful, reset displayed content
|
||||
/// </summary>
|
||||
SuccessOkResetContent = 205,
|
||||
|
||||
/// <summary>
|
||||
/// 206 Request successful, partial content returned
|
||||
/// </summary>
|
||||
SuccessOkPartialContent = 206,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 3xx Redirect code: user agent needs to go somewhere else
|
||||
|
||||
/// <summary>
|
||||
/// 300 Redirect: different presentation forms available, take a pick
|
||||
/// </summary>
|
||||
RedirectMultipleChoices = 300,
|
||||
|
||||
/// <summary>
|
||||
/// 301 Redirect: requested resource has moved and now lives somewhere else
|
||||
/// </summary>
|
||||
RedirectMovedPermanently = 301,
|
||||
|
||||
/// <summary>
|
||||
/// 302 Redirect: Resource temporarily somewhere else, location might change
|
||||
/// </summary>
|
||||
RedirectFound = 302,
|
||||
|
||||
/// <summary>
|
||||
/// 303 Redirect: See other as result of a POST
|
||||
/// </summary>
|
||||
RedirectSeeOther = 303,
|
||||
|
||||
/// <summary>
|
||||
/// 304 Redirect: Resource still the same as before
|
||||
/// </summary>
|
||||
RedirectNotModified = 304,
|
||||
|
||||
/// <summary>
|
||||
/// 305 Redirect: Resource must be accessed via proxy provided in location field
|
||||
/// </summary>
|
||||
RedirectUseProxy = 305,
|
||||
|
||||
/// <summary>
|
||||
/// 307 Redirect: Resource temporarily somewhere else, location might change
|
||||
/// </summary>
|
||||
RedirectMovedTemporarily = 307,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 4xx Client error: the client borked the request
|
||||
|
||||
/// <summary>
|
||||
/// 400 Client error: bad request, server does not grok what the client wants
|
||||
/// </summary>
|
||||
ClientErrorBadRequest = 400,
|
||||
|
||||
/// <summary>
|
||||
/// 401 Client error: the client is not authorized, response provides WWW-Authenticate header field with a challenge
|
||||
/// </summary>
|
||||
ClientErrorUnauthorized = 401,
|
||||
|
||||
/// <summary>
|
||||
/// 402 Client error: Payment required (reserved for future use)
|
||||
/// </summary>
|
||||
ClientErrorPaymentRequired = 402,
|
||||
|
||||
/// <summary>
|
||||
/// 403 Client error: Server understood request, will not deliver, do not try again.
|
||||
ClientErrorForbidden = 403,
|
||||
|
||||
/// <summary>
|
||||
/// 404 Client error: Server cannot find anything matching the client request.
|
||||
/// </summary>
|
||||
ClientErrorNotFound = 404,
|
||||
|
||||
/// <summary>
|
||||
/// 405 Client error: The method specified by the client in the request is not allowed for the resource requested
|
||||
/// </summary>
|
||||
ClientErrorMethodNotAllowed = 405,
|
||||
|
||||
/// <summary>
|
||||
/// 406 Client error: Server cannot generate suitable response for the resource and content characteristics requested by the client
|
||||
/// </summary>
|
||||
ClientErrorNotAcceptable = 406,
|
||||
|
||||
/// <summary>
|
||||
/// 407 Client error: Similar to 401, Server requests that client authenticate itself with the proxy first
|
||||
/// </summary>
|
||||
ClientErrorProxyAuthRequired = 407,
|
||||
|
||||
/// <summary>
|
||||
/// 408 Client error: Server got impatient with client and decided to give up waiting for the client's request to arrive
|
||||
/// </summary>
|
||||
ClientErrorRequestTimeout = 408,
|
||||
|
||||
/// <summary>
|
||||
/// 409 Client error: Server could not fulfill the request for a resource as there is a conflict with the current state of the resource but thinks client can do something about this
|
||||
/// </summary>
|
||||
ClientErrorConflict = 409,
|
||||
|
||||
/// <summary>
|
||||
/// 410 Client error: The resource has moved somewhere else, but server has no clue where.
|
||||
/// </summary>
|
||||
ClientErrorGone = 410,
|
||||
|
||||
/// <summary>
|
||||
/// 411 Client error: The server is picky again and insists on having a content-length header field in the request
|
||||
/// </summary>
|
||||
ClientErrorLengthRequired = 411,
|
||||
|
||||
/// <summary>
|
||||
/// 412 Client error: one or more preconditions supplied in the client's request is false
|
||||
/// </summary>
|
||||
ClientErrorPreconditionFailed = 412,
|
||||
|
||||
/// <summary>
|
||||
/// 413 Client error: For fear of reflux, the server refuses to swallow that much data.
|
||||
/// </summary>
|
||||
ClientErrorRequestEntityToLarge = 413,
|
||||
|
||||
/// <summary>
|
||||
/// 414 Client error: The server considers the Request-URI to be indecently long and refuses to even look at it.
|
||||
/// </summary>
|
||||
ClientErrorRequestURITooLong = 414,
|
||||
|
||||
/// <summary>
|
||||
/// 415 Client error: The server has no clue about the media type requested by the client (contrary to popular belief it is not a warez server)
|
||||
/// </summary>
|
||||
ClientErrorUnsupportedMediaType = 415,
|
||||
|
||||
/// <summary>
|
||||
/// 416 Client error: The requested range cannot be delivered by the server.
|
||||
/// </summary>
|
||||
ClientErrorRequestRangeNotSatisfiable = 416,
|
||||
// 417 Client error: The expectations of the client as
|
||||
// expressed in one or more Expect header fields cannot be met
|
||||
// by the server, the server is awfully sorry about this.
|
||||
ClientErrorExpectationFailed = 417,
|
||||
// 499 Client error: Wildcard error.
|
||||
ClientErrorJoker = 499,
|
||||
|
||||
// 5xx Server errors (rare)
|
||||
// 500 Server error: something really strange and unexpected
|
||||
// happened
|
||||
ServerErrorInternalError = 500,
|
||||
// 501 Server error: The server does not do the functionality
|
||||
// required to carry out the client request. not at
|
||||
// all. certainly not before breakfast. but also not after
|
||||
// breakfast.
|
||||
ServerErrorNotImplemented = 501,
|
||||
// 502 Server error: While acting as a proxy or a gateway, the
|
||||
// server got ditched by the upstream server and as a
|
||||
// consequence regretfully cannot fulfill the client's request
|
||||
ServerErrorBadGateway = 502,
|
||||
// 503 Server error: Due to unforseen circumstances the server
|
||||
// cannot currently deliver the service requested. Retry-After
|
||||
// header might indicate when to try again.
|
||||
ServerErrorServiceUnavailable = 503,
|
||||
// 504 Server error: The server blames the upstream server
|
||||
// for not being able to deliver the service requested and
|
||||
// claims that the upstream server is too slow delivering the
|
||||
// goods.
|
||||
ServerErrorGatewayTimeout = 504,
|
||||
// 505 Server error: The server does not support the HTTP
|
||||
// version conveyed in the client's request.
|
||||
ServerErrorHttpVersionNotSupported = 505,
|
||||
/// <summary>
|
||||
/// 417 Client error: The expectations of the client as expressed in one or more Expect header fields cannot be met by the server, the server is awfully sorry about this.
|
||||
/// </summary>
|
||||
ClientErrorExpectationFailed = 417,
|
||||
|
||||
/// <summary>
|
||||
/// 428 Client error :The 428 status code indicates that the origin server requires the request to be conditional.
|
||||
/// </summary>
|
||||
ClientErrorPreconditionRequired = 428,
|
||||
|
||||
/// <summary>
|
||||
/// 429 Client error: The 429 status code indicates that the user has sent too many requests in a given amount of time ("rate limiting").
|
||||
/// </summary>
|
||||
ClientErrorTooManyRequests = 429,
|
||||
|
||||
/// <summary>
|
||||
/// 431 Client error: The 431 status code indicates that the server is unwilling to process the request because its header fields are too large. The request MAY be resubmitted after reducing the size of the request header fields.
|
||||
/// </summary>
|
||||
ClientErrorRequestHeaderFieldsTooLarge = 431,
|
||||
|
||||
/// <summary>
|
||||
/// 499 Client error: Wildcard error.
|
||||
/// </summary>
|
||||
ClientErrorJoker = 499,
|
||||
|
||||
#endregion
|
||||
|
||||
#region 5xx Server errors (rare)
|
||||
|
||||
/// <summary>
|
||||
/// 500 Server error: something really strange and unexpected happened
|
||||
/// </summary>
|
||||
ServerErrorInternalError = 500,
|
||||
|
||||
/// <summary>
|
||||
/// 501 Server error: The server does not do the functionality required to carry out the client request. not at all. certainly not before breakfast. but also not after breakfast.
|
||||
/// </summary>
|
||||
ServerErrorNotImplemented = 501,
|
||||
|
||||
/// <summary>
|
||||
/// 502 Server error: While acting as a proxy or a gateway, the server got ditched by the upstream server and as a consequence regretfully cannot fulfill the client's request
|
||||
/// </summary>
|
||||
ServerErrorBadGateway = 502,
|
||||
|
||||
/// <summary>
|
||||
/// 503 Server error: Due to unforseen circumstances the server cannot currently deliver the service requested. Retry-After header might indicate when to try again.
|
||||
/// </summary>
|
||||
ServerErrorServiceUnavailable = 503,
|
||||
|
||||
/// <summary>
|
||||
/// 504 Server error: The server blames the upstream server for not being able to deliver the service requested and claims that the upstream server is too slow delivering the goods.
|
||||
/// </summary>
|
||||
ServerErrorGatewayTimeout = 504,
|
||||
|
||||
/// <summary>
|
||||
/// 505 Server error: The server does not support the HTTP version conveyed in the client's request.
|
||||
/// </summary>
|
||||
ServerErrorHttpVersionNotSupported = 505,
|
||||
|
||||
/// <summary>
|
||||
/// 511 Server error: The 511 status code indicates that the client needs to authenticate to gain network access.
|
||||
/// </summary>
|
||||
ServerErrorNetworkAuthenticationRequired = 511,
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public delegate void RequestMethod(UUID requestID, Hashtable request);
|
||||
@@ -44,7 +45,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
public NoEventsMethod NoEvents;
|
||||
public RequestMethod Request;
|
||||
public UUID Id;
|
||||
public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,UUID pId)
|
||||
|
||||
public PollServiceEventArgs(
|
||||
RequestMethod pRequest,
|
||||
HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,
|
||||
UUID pId)
|
||||
{
|
||||
Request = pRequest;
|
||||
HasEvents = pHasEvents;
|
||||
@@ -53,4 +58,4 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
Id = pId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,6 @@ using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
|
||||
public class PollServiceHttpRequest
|
||||
{
|
||||
public readonly PollServiceEventArgs PollServiceArgs;
|
||||
@@ -39,7 +38,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
public readonly IHttpRequest Request;
|
||||
public readonly int RequestTime;
|
||||
public readonly UUID RequestID;
|
||||
public PollServiceHttpRequest(PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest)
|
||||
|
||||
public PollServiceHttpRequest(
|
||||
PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest)
|
||||
{
|
||||
PollServiceArgs = pPollServiceArgs;
|
||||
HttpContext = pHttpContext;
|
||||
@@ -48,4 +49,4 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
RequestID = UUID.Random();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ using System.Reflection;
|
||||
using log4net;
|
||||
using HttpServer;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
@@ -66,6 +67,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
int.MaxValue);
|
||||
}
|
||||
|
||||
@@ -75,6 +77,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
null,
|
||||
1000 * 60 * 10);
|
||||
}
|
||||
|
||||
@@ -138,9 +141,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
foreach (object o in m_requests)
|
||||
{
|
||||
PollServiceHttpRequest req = (PollServiceHttpRequest) o;
|
||||
m_server.DoHTTPGruntWork(
|
||||
req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
|
||||
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
|
||||
PollServiceWorkerThread.DoHTTPGruntWork(
|
||||
m_server, req, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
|
||||
}
|
||||
|
||||
m_requests.Clear();
|
||||
@@ -149,6 +151,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
t.Abort();
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ using HttpServer;
|
||||
using OpenMetaverse;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
@@ -90,15 +91,16 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
|
||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
|
||||
m_server.DoHTTPGruntWork(responsedata,
|
||||
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
|
||||
DoHTTPGruntWork(m_server, req, responsedata);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Environment.TickCount - req.RequestTime) > m_timeout)
|
||||
{
|
||||
m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
|
||||
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
|
||||
DoHTTPGruntWork(
|
||||
m_server,
|
||||
req,
|
||||
req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -119,5 +121,45 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
m_request.Enqueue(pPollServiceHttpRequest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FIXME: This should be part of BaseHttpServer
|
||||
/// </summary>
|
||||
internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata)
|
||||
{
|
||||
OSHttpResponse response
|
||||
= new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext);
|
||||
|
||||
byte[] buffer = server.DoHTTPGruntWork(responsedata, response);
|
||||
|
||||
response.SendChunked = false;
|
||||
response.ContentLength64 = buffer.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex));
|
||||
}
|
||||
finally
|
||||
{
|
||||
//response.OutputStream.Close();
|
||||
try
|
||||
{
|
||||
response.OutputStream.Flush();
|
||||
response.Send();
|
||||
|
||||
//if (!response.KeepAlive && response.ReuseContext)
|
||||
// response.FreeContext();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
private RestDeserialiseMethod<TRequest, TResponse> m_method;
|
||||
|
||||
public RestDeserialiseHandler(string httpMethod, string path, RestDeserialiseMethod<TRequest, TResponse> method)
|
||||
: base(httpMethod, path)
|
||||
: this(httpMethod, path, method, null, null) {}
|
||||
|
||||
public RestDeserialiseHandler(
|
||||
string httpMethod, string path, RestDeserialiseMethod<TRequest, TResponse> method, string name, string description)
|
||||
: base(httpMethod, path, name, description)
|
||||
{
|
||||
m_method = method;
|
||||
}
|
||||
|
||||
@@ -38,19 +38,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
get { return m_dhttpMethod; }
|
||||
}
|
||||
|
||||
public override Hashtable Handle(string path, Hashtable request)
|
||||
{
|
||||
|
||||
string param = GetParam(path);
|
||||
request.Add("param", param);
|
||||
request.Add("path", path);
|
||||
return m_dhttpMethod(request);
|
||||
}
|
||||
|
||||
public RestHTTPHandler(string httpMethod, string path, GenericHTTPMethod dhttpMethod)
|
||||
: base(httpMethod, path)
|
||||
{
|
||||
m_dhttpMethod = dhttpMethod;
|
||||
}
|
||||
|
||||
public RestHTTPHandler(
|
||||
string httpMethod, string path, GenericHTTPMethod dhttpMethod, string name, string description)
|
||||
: base(httpMethod, path, name, description)
|
||||
{
|
||||
m_dhttpMethod = dhttpMethod;
|
||||
}
|
||||
|
||||
public override Hashtable Handle(string path, Hashtable request)
|
||||
{
|
||||
string param = GetParam(path);
|
||||
request.Add("param", param);
|
||||
request.Add("path", path);
|
||||
return m_dhttpMethod(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,15 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
get { return m_restMethod; }
|
||||
}
|
||||
|
||||
public RestStreamHandler(string httpMethod, string path, RestMethod restMethod)
|
||||
: this(httpMethod, path, restMethod, null, null) {}
|
||||
|
||||
public RestStreamHandler(string httpMethod, string path, RestMethod restMethod, string name, string description)
|
||||
: base(httpMethod, path, name, description)
|
||||
{
|
||||
m_restMethod = restMethod;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
Encoding encoding = Encoding.UTF8;
|
||||
@@ -52,10 +61,5 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
return Encoding.UTF8.GetBytes(responseString);
|
||||
}
|
||||
|
||||
public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base(httpMethod, path)
|
||||
{
|
||||
m_restMethod = restMethod;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,57 +25,209 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Net;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Framework.Servers
|
||||
{
|
||||
public class MainServer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static BaseHttpServer instance = null;
|
||||
private static Dictionary<uint, BaseHttpServer> m_Servers =
|
||||
new Dictionary<uint, BaseHttpServer>();
|
||||
private static Dictionary<uint, BaseHttpServer> m_Servers = new Dictionary<uint, BaseHttpServer>();
|
||||
|
||||
/// <summary>
|
||||
/// Control the printing of certain debug messages.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If DebugLevel >= 1, then short warnings are logged when receiving bad input data.
|
||||
/// If DebugLevel >= 2, then long warnings are logged when receiving bad input data.
|
||||
/// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged.
|
||||
/// </remarks>
|
||||
public static int DebugLevel
|
||||
{
|
||||
get { return s_debugLevel; }
|
||||
set
|
||||
{
|
||||
s_debugLevel = value;
|
||||
|
||||
lock (m_Servers)
|
||||
foreach (BaseHttpServer server in m_Servers.Values)
|
||||
server.DebugLevel = s_debugLevel;
|
||||
}
|
||||
}
|
||||
|
||||
private static int s_debugLevel;
|
||||
|
||||
/// <summary>
|
||||
/// Set the main HTTP server instance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This will be used to register all handlers that listen to the default port.
|
||||
/// </remarks>
|
||||
/// <exception cref='Exception'>
|
||||
/// Thrown if the HTTP server has not already been registered via AddHttpServer()
|
||||
/// </exception>
|
||||
public static BaseHttpServer Instance
|
||||
{
|
||||
get { return instance; }
|
||||
set { instance = value; }
|
||||
|
||||
set
|
||||
{
|
||||
lock (m_Servers)
|
||||
if (!m_Servers.ContainsValue(value))
|
||||
throw new Exception("HTTP server must already have been registered to be set as the main instance");
|
||||
|
||||
instance = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static IHttpServer GetHttpServer(uint port)
|
||||
/// <summary>
|
||||
/// Get all the registered servers.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Returns a copy of the dictionary so this can be iterated through without locking.
|
||||
/// </remarks>
|
||||
/// <value></value>
|
||||
public static Dictionary<uint, BaseHttpServer> Servers
|
||||
{
|
||||
return GetHttpServer(port,null);
|
||||
get { return new Dictionary<uint, BaseHttpServer>(m_Servers); }
|
||||
}
|
||||
|
||||
|
||||
public static void RegisterHttpConsoleCommands(ICommandConsole console)
|
||||
{
|
||||
console.Commands.AddCommand(
|
||||
"Debug", false, "debug http", "debug http [<level>]",
|
||||
"Turn on inbound non-poll http request debugging.",
|
||||
"If level <= 0, then no extra logging is done.\n"
|
||||
+ "If level >= 1, then short warnings are logged when receiving bad input data.\n"
|
||||
+ "If level >= 2, then long warnings are logged when receiving bad input data.\n"
|
||||
+ "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n"
|
||||
+ "If no level is specified then the current level is returned.",
|
||||
HandleDebugHttpCommand);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turn on some debugging values for OpenSim.
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
private static void HandleDebugHttpCommand(string module, string[] args)
|
||||
{
|
||||
if (args.Length == 3)
|
||||
{
|
||||
int newDebug;
|
||||
if (int.TryParse(args[2], out newDebug))
|
||||
{
|
||||
MainServer.DebugLevel = newDebug;
|
||||
MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug);
|
||||
}
|
||||
}
|
||||
else if (args.Length == 2)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug http 0..3");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register an already started HTTP server to the collection of known servers.
|
||||
/// </summary>
|
||||
/// <param name='server'></param>
|
||||
public static void AddHttpServer(BaseHttpServer server)
|
||||
{
|
||||
m_Servers.Add(server.Port, server);
|
||||
lock (m_Servers)
|
||||
{
|
||||
if (m_Servers.ContainsKey(server.Port))
|
||||
throw new Exception(string.Format("HTTP server for port {0} already exists.", server.Port));
|
||||
|
||||
m_Servers.Add(server.Port, server);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the http server listening on the given port.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// It is the responsibility of the caller to do clean up.
|
||||
/// </remarks>
|
||||
/// <param name='port'></param>
|
||||
/// <returns></returns>
|
||||
public static bool RemoveHttpServer(uint port)
|
||||
{
|
||||
lock (m_Servers)
|
||||
return m_Servers.Remove(port);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does this collection of servers contain one with the given port?
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Unlike GetHttpServer, this will not instantiate a server if one does not exist on that port.
|
||||
/// </remarks>
|
||||
/// <param name='port'></param>
|
||||
/// <returns>true if a server with the given port is registered, false otherwise.</returns>
|
||||
public static bool ContainsHttpServer(uint port)
|
||||
{
|
||||
lock (m_Servers)
|
||||
return m_Servers.ContainsKey(port);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default http server or an http server for a specific port.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the requested HTTP server doesn't already exist then a new one is instantiated and started.
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
/// <param name='port'>If 0 then the default HTTP server is returned.</param>
|
||||
public static IHttpServer GetHttpServer(uint port)
|
||||
{
|
||||
return GetHttpServer(port, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default http server, an http server for a specific port
|
||||
/// and/or an http server bound to a specific address
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the requested HTTP server doesn't already exist then a new one is instantiated and started.
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
/// <param name='port'>If 0 then the default HTTP server is returned.</param>
|
||||
/// <param name='ipaddr'>A specific IP address to bind to. If null then the default IP address is used.</param>
|
||||
public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr)
|
||||
{
|
||||
if (port == 0)
|
||||
return Instance;
|
||||
|
||||
if (instance != null && port == Instance.Port)
|
||||
return Instance;
|
||||
|
||||
if (m_Servers.ContainsKey(port))
|
||||
lock (m_Servers)
|
||||
{
|
||||
if (m_Servers.ContainsKey(port))
|
||||
return m_Servers[port];
|
||||
|
||||
m_Servers[port] = new BaseHttpServer(port);
|
||||
|
||||
if (ipaddr != null)
|
||||
m_Servers[port].ListenIPAddress = ipaddr;
|
||||
|
||||
m_Servers[port].Start();
|
||||
|
||||
return m_Servers[port];
|
||||
|
||||
m_Servers[port] = new BaseHttpServer(port);
|
||||
|
||||
if (ipaddr != null)
|
||||
m_Servers[port].ListenIPAddress = ipaddr;
|
||||
|
||||
m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port);
|
||||
m_Servers[port].Start();
|
||||
|
||||
return m_Servers[port];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace OpenSim
|
||||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.7.4";
|
||||
private const string VERSION_NUMBER = "0.7.5";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
|
||||
public enum Flavour
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
@@ -35,6 +37,8 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
public class TaskInventoryItem : ICloneable
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// XXX This should really be factored out into some constants class.
|
||||
/// </summary>
|
||||
@@ -69,6 +73,9 @@ namespace OpenSim.Framework
|
||||
|
||||
private bool _ownerChanged = false;
|
||||
|
||||
// This used ONLY during copy. It can't be relied on at other times!
|
||||
private bool _scriptRunning = true;
|
||||
|
||||
public UUID AssetID {
|
||||
get {
|
||||
return _assetID;
|
||||
@@ -331,12 +338,27 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
public bool OwnerChanged {
|
||||
get {
|
||||
public bool OwnerChanged
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ownerChanged;
|
||||
}
|
||||
set {
|
||||
set
|
||||
{
|
||||
_ownerChanged = value;
|
||||
// m_log.DebugFormat(
|
||||
// "[TASK INVENTORY ITEM]: Owner changed set {0} for {1} {2} owned by {3}",
|
||||
// _ownerChanged, Name, ItemID, OwnerID);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ScriptRunning {
|
||||
get {
|
||||
return _scriptRunning;
|
||||
}
|
||||
set {
|
||||
_scriptRunning = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,10 +227,10 @@ namespace OpenSim.Framework.Tests
|
||||
es.AddEstateManager(UUID.Zero);
|
||||
|
||||
es.AddEstateManager(bannedUserId);
|
||||
Assert.IsTrue(es.IsEstateManager(bannedUserId), "bannedUserId should be EstateManager but isn't.");
|
||||
Assert.IsTrue(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserId should be EstateManager but isn't.");
|
||||
|
||||
es.RemoveEstateManager(bannedUserId);
|
||||
Assert.IsFalse(es.IsEstateManager(bannedUserId), "bannedUserID is estateManager but shouldn't be");
|
||||
Assert.IsFalse(es.IsEstateManagerOrOwner(bannedUserId), "bannedUserID is estateManager but shouldn't be");
|
||||
|
||||
Assert.IsFalse(es.HasAccess(bannedUserId), "bannedUserID has access but shouldn't");
|
||||
|
||||
|
||||
@@ -214,16 +214,13 @@ namespace OpenSim.Framework.Tests
|
||||
|
||||
for (int i = 0; i < contenttypes.Length; i++)
|
||||
{
|
||||
if (SLUtil.ContentTypeToSLAssetType(contenttypes[i]) == 18)
|
||||
{
|
||||
Assert.That(contenttypes[i] == "image/tga");
|
||||
}
|
||||
int expected;
|
||||
if (contenttypes[i] == "image/tga")
|
||||
expected = 12; // if we know only the content-type "image/tga", then we assume the asset type is TextureTGA; not ImageTGA
|
||||
else
|
||||
{
|
||||
Assert.That(SLUtil.ContentTypeToSLAssetType(contenttypes[i]) == assettypes[i],
|
||||
"Expecting {0} but got {1}", assettypes[i],
|
||||
SLUtil.ContentTypeToSLAssetType(contenttypes[i]));
|
||||
}
|
||||
expected = assettypes[i];
|
||||
Assert.AreEqual(expected, SLUtil.ContentTypeToSLAssetType(contenttypes[i]),
|
||||
String.Format("Incorrect AssetType mapped from Content-Type {0}", contenttypes[i]));
|
||||
}
|
||||
|
||||
int[] inventorytypes = new int[] {-1,0,1,2,3,6,7,8,9,10,15,17,18,20};
|
||||
@@ -237,7 +234,7 @@ namespace OpenSim.Framework.Tests
|
||||
"application/vnd.ll.primitive",
|
||||
"application/vnd.ll.notecard",
|
||||
"application/vnd.ll.folder",
|
||||
"application/octet-stream",
|
||||
"application/vnd.ll.rootfolder",
|
||||
"application/vnd.ll.lsltext",
|
||||
"image/x-j2c",
|
||||
"application/vnd.ll.primitive",
|
||||
@@ -247,7 +244,8 @@ namespace OpenSim.Framework.Tests
|
||||
|
||||
for (int i=0;i<inventorytypes.Length;i++)
|
||||
{
|
||||
Assert.That(SLUtil.SLInvTypeToContentType(inventorytypes[i]) == invcontenttypes[i], "Expected {0}, Got {1}", invcontenttypes[i], SLUtil.SLInvTypeToContentType(inventorytypes[i]));
|
||||
Assert.AreEqual(invcontenttypes[i], SLUtil.SLInvTypeToContentType(inventorytypes[i]),
|
||||
String.Format("Incorrect Content-Type mapped from InventoryType {0}", inventorytypes[i]));
|
||||
}
|
||||
|
||||
invcontenttypes = new string[]
|
||||
@@ -280,7 +278,8 @@ namespace OpenSim.Framework.Tests
|
||||
|
||||
for (int i = 0; i < invtypes.Length; i++)
|
||||
{
|
||||
Assert.That(SLUtil.ContentTypeToSLInvType(invcontenttypes[i]) == invtypes[i], "Expected {0}, Got {1}", invtypes[i], SLUtil.ContentTypeToSLInvType(invcontenttypes[i]));
|
||||
Assert.AreEqual(invtypes[i], SLUtil.ContentTypeToSLInvType(invcontenttypes[i]),
|
||||
String.Format("Incorrect InventoryType mapped from Content-Type {0}", invcontenttypes[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +148,7 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
public static Encoding UTF8 = Encoding.UTF8;
|
||||
public static Encoding UTF8NoBomEncoding = new UTF8Encoding(false);
|
||||
|
||||
/// <value>
|
||||
/// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards)
|
||||
@@ -849,6 +850,12 @@ namespace OpenSim.Framework
|
||||
return Math.Min(Math.Max(x, min), max);
|
||||
}
|
||||
|
||||
public static Vector3 Clip(Vector3 vec, float min, float max)
|
||||
{
|
||||
return new Vector3(Clip(vec.X, min, max), Clip(vec.Y, min, max),
|
||||
Clip(vec.Z, min, max));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert an UUID to a raw uuid string. Right now this is a string without hyphens.
|
||||
/// </summary>
|
||||
@@ -1236,8 +1243,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public static string Base64ToString(string str)
|
||||
{
|
||||
UTF8Encoding encoder = new UTF8Encoding();
|
||||
Decoder utf8Decode = encoder.GetDecoder();
|
||||
Decoder utf8Decode = Encoding.UTF8.GetDecoder();
|
||||
|
||||
byte[] todecode_byte = Convert.FromBase64String(str);
|
||||
int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
|
||||
|
||||
@@ -53,19 +53,36 @@ namespace OpenSim.Framework
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static int m_requestNumber = 0;
|
||||
/// <summary>
|
||||
/// Request number for diagnostic purposes.
|
||||
/// </summary>
|
||||
public static int RequestNumber = 0;
|
||||
|
||||
// this is the header field used to communicate the local request id
|
||||
// used for performance and debugging
|
||||
/// <summary>
|
||||
/// this is the header field used to communicate the local request id
|
||||
/// used for performance and debugging
|
||||
/// </summary>
|
||||
public const string OSHeaderRequestID = "opensim-request-id";
|
||||
|
||||
// number of milliseconds a call can take before it is considered
|
||||
// a "long" call for warning & debugging purposes
|
||||
public const int LongCallTime = 500;
|
||||
/// <summary>
|
||||
/// Number of milliseconds a call can take before it is considered
|
||||
/// a "long" call for warning & debugging purposes
|
||||
/// </summary>
|
||||
public const int LongCallTime = 3000;
|
||||
|
||||
// dictionary of end points
|
||||
/// <summary>
|
||||
/// The maximum length of any data logged because of a long request time.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is to truncate any really large post data, such as an asset. In theory, the first section should
|
||||
/// give us useful information about the call (which agent it relates to if applicable, etc.).
|
||||
/// </remarks>
|
||||
public const int MaxRequestDiagLength = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of end points
|
||||
/// </summary>
|
||||
private static Dictionary<string,object> m_endpointSerializer = new Dictionary<string,object>();
|
||||
|
||||
|
||||
private static object EndPointLock(string url)
|
||||
{
|
||||
@@ -86,8 +103,7 @@ namespace OpenSim.Framework
|
||||
return eplock;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region JSONRequest
|
||||
|
||||
/// <summary>
|
||||
@@ -129,12 +145,13 @@ namespace OpenSim.Framework
|
||||
|
||||
private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed)
|
||||
{
|
||||
int reqnum = m_requestNumber++;
|
||||
int reqnum = RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
string errorMessage = "unknown error";
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
int tickdata = 0;
|
||||
string strBuffer = null;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -149,7 +166,7 @@ namespace OpenSim.Framework
|
||||
// If there is some input, write it into the request
|
||||
if (data != null)
|
||||
{
|
||||
string strBuffer = OSDParser.SerializeJsonString(data);
|
||||
strBuffer = OSDParser.SerializeJsonString(data);
|
||||
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
|
||||
|
||||
if (compressed)
|
||||
@@ -209,14 +226,23 @@ namespace OpenSim.Framework
|
||||
}
|
||||
finally
|
||||
{
|
||||
// This just dumps a warning for any operation that takes more than 100 ms
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > LongCallTime)
|
||||
m_log.DebugFormat("[WEB UTIL]: osd request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing",
|
||||
reqnum,url,method,tickdiff,tickdata);
|
||||
m_log.InfoFormat(
|
||||
"[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
method,
|
||||
url,
|
||||
tickdiff,
|
||||
tickdata,
|
||||
strBuffer != null
|
||||
? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
|
||||
: "");
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
||||
|
||||
return ErrorResponseMap(errorMessage);
|
||||
}
|
||||
|
||||
@@ -289,17 +315,17 @@ namespace OpenSim.Framework
|
||||
|
||||
private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout)
|
||||
{
|
||||
int reqnum = m_requestNumber++;
|
||||
int reqnum = RequestNumber++;
|
||||
string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
string errorMessage = "unknown error";
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
int tickdata = 0;
|
||||
string queryString = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
|
||||
request.Method = "POST";
|
||||
request.Timeout = timeout;
|
||||
@@ -310,7 +336,7 @@ namespace OpenSim.Framework
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
string queryString = BuildQueryString(data);
|
||||
queryString = BuildQueryString(data);
|
||||
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString);
|
||||
|
||||
request.ContentLength = buffer.Length;
|
||||
@@ -353,11 +379,20 @@ namespace OpenSim.Framework
|
||||
{
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > LongCallTime)
|
||||
m_log.InfoFormat("[WEB UTIL]: form request <{0}> (URI:{1}, METHOD:{2}) took {3}ms overall, {4}ms writing",
|
||||
reqnum,url,method,tickdiff,tickdata);
|
||||
m_log.InfoFormat(
|
||||
"[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
method,
|
||||
url,
|
||||
tickdiff,
|
||||
tickdata,
|
||||
queryString != null
|
||||
? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString
|
||||
: "");
|
||||
}
|
||||
|
||||
m_log.WarnFormat("[WEB UTIL]: <{0}> form request failed: {1}",reqnum,errorMessage);
|
||||
m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage);
|
||||
|
||||
return ErrorResponseMap(errorMessage);
|
||||
}
|
||||
|
||||
@@ -637,8 +672,6 @@ namespace OpenSim.Framework
|
||||
|
||||
return new string[0];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class AsynchronousRestObjectRequester
|
||||
@@ -661,6 +694,12 @@ namespace OpenSim.Framework
|
||||
public static void MakeRequest<TRequest, TResponse>(string verb,
|
||||
string requestUrl, TRequest obj, Action<TResponse> action)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
int tickdata = 0;
|
||||
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
|
||||
|
||||
Type type = typeof(TRequest);
|
||||
@@ -671,12 +710,13 @@ namespace OpenSim.Framework
|
||||
XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
|
||||
|
||||
request.Method = verb;
|
||||
MemoryStream buffer = null;
|
||||
|
||||
if (verb == "POST")
|
||||
{
|
||||
request.ContentType = "text/xml";
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
buffer = new MemoryStream();
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
@@ -698,6 +738,9 @@ namespace OpenSim.Framework
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
requestStream.Close();
|
||||
|
||||
// capture how much time was spent writing
|
||||
tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
|
||||
request.BeginGetResponse(delegate(IAsyncResult ar)
|
||||
{
|
||||
response = request.EndGetResponse(ar);
|
||||
@@ -723,83 +766,108 @@ namespace OpenSim.Framework
|
||||
|
||||
}, null);
|
||||
}, null);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
request.BeginGetResponse(delegate(IAsyncResult res2)
|
||||
else
|
||||
{
|
||||
try
|
||||
request.BeginGetResponse(delegate(IAsyncResult res2)
|
||||
{
|
||||
// If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't
|
||||
// documented in MSDN
|
||||
response = request.EndGetResponse(res2);
|
||||
|
||||
Stream respStream = null;
|
||||
try
|
||||
{
|
||||
respStream = response.GetResponseStream();
|
||||
deserial = (TResponse)deserializer.Deserialize(respStream);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
respStream.Close();
|
||||
response.Close();
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Status == WebExceptionStatus.ProtocolError)
|
||||
{
|
||||
if (e.Response is HttpWebResponse)
|
||||
// If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't
|
||||
// documented in MSDN
|
||||
response = request.EndGetResponse(res2);
|
||||
|
||||
Stream respStream = null;
|
||||
try
|
||||
{
|
||||
HttpWebResponse httpResponse = (HttpWebResponse)e.Response;
|
||||
|
||||
if (httpResponse.StatusCode != HttpStatusCode.NotFound)
|
||||
{
|
||||
// We don't appear to be handling any other status codes, so log these feailures to that
|
||||
// people don't spend unnecessary hours hunting phantom bugs.
|
||||
m_log.DebugFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}",
|
||||
verb, requestUrl, httpResponse.StatusCode);
|
||||
}
|
||||
respStream = response.GetResponseStream();
|
||||
deserial = (TResponse)deserializer.Deserialize(respStream);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
respStream.Close();
|
||||
response.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (WebException e)
|
||||
{
|
||||
m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message);
|
||||
if (e.Status == WebExceptionStatus.ProtocolError)
|
||||
{
|
||||
if (e.Response is HttpWebResponse)
|
||||
{
|
||||
HttpWebResponse httpResponse = (HttpWebResponse)e.Response;
|
||||
|
||||
if (httpResponse.StatusCode != HttpStatusCode.NotFound)
|
||||
{
|
||||
// We don't appear to be handling any other status codes, so log these feailures to that
|
||||
// people don't spend unnecessary hours hunting phantom bugs.
|
||||
m_log.DebugFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}",
|
||||
verb, requestUrl, httpResponse.StatusCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}",
|
||||
verb, requestUrl, e.Status, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}",
|
||||
verb, requestUrl, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
action(deserial);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}{3}",
|
||||
verb, requestUrl, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
}, null);
|
||||
}
|
||||
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > WebUtil.LongCallTime)
|
||||
{
|
||||
string originalRequest = null;
|
||||
|
||||
if (buffer != null)
|
||||
{
|
||||
m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e);
|
||||
originalRequest = Encoding.UTF8.GetString(buffer.ToArray());
|
||||
|
||||
if (originalRequest.Length > WebUtil.MaxRequestDiagLength)
|
||||
originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
action(deserial);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e);
|
||||
}
|
||||
|
||||
}, null);
|
||||
m_log.InfoFormat(
|
||||
"[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
verb,
|
||||
requestUrl,
|
||||
tickdiff,
|
||||
tickdata,
|
||||
originalRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class SynchronousRestFormsRequester
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
@@ -813,6 +881,12 @@ namespace OpenSim.Framework
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
int tickdata = 0;
|
||||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
request.Method = verb;
|
||||
string respstring = String.Empty;
|
||||
@@ -841,12 +915,16 @@ namespace OpenSim.Framework
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
|
||||
m_log.DebugFormat(
|
||||
"[FORMS]: exception occured {0} {1}: {2}{3}", verb, requestUrl, e.Message, e.StackTrace);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (requestStream != null)
|
||||
requestStream.Close();
|
||||
|
||||
// capture how much time was spent writing
|
||||
tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -867,7 +945,9 @@ namespace OpenSim.Framework
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
|
||||
m_log.DebugFormat(
|
||||
"[FORMS]: Exception occured on receiving {0} {1}: {2}{3}",
|
||||
verb, requestUrl, e.Message, e.StackTrace);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -880,9 +960,21 @@ namespace OpenSim.Framework
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// This is what happens when there is invalid XML
|
||||
m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
|
||||
m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving {0} {1}", verb, requestUrl);
|
||||
}
|
||||
}
|
||||
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > WebUtil.LongCallTime)
|
||||
m_log.InfoFormat(
|
||||
"[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
verb,
|
||||
requestUrl,
|
||||
tickdiff,
|
||||
tickdata,
|
||||
obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
|
||||
|
||||
return respstring;
|
||||
}
|
||||
}
|
||||
@@ -905,17 +997,24 @@ namespace OpenSim.Framework
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
int tickdata = 0;
|
||||
|
||||
Type type = typeof(TRequest);
|
||||
TResponse deserial = default(TResponse);
|
||||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
request.Method = verb;
|
||||
MemoryStream buffer = null;
|
||||
|
||||
if ((verb == "POST") || (verb == "PUT"))
|
||||
{
|
||||
request.ContentType = "text/xml";
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
buffer = new MemoryStream();
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
@@ -938,13 +1037,19 @@ namespace OpenSim.Framework
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e);
|
||||
m_log.DebugFormat(
|
||||
"[SynchronousRestObjectRequester]: Exception in making request {0} {1}: {2}{3}",
|
||||
verb, requestUrl, e.Message, e.StackTrace);
|
||||
|
||||
return deserial;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (requestStream != null)
|
||||
requestStream.Close();
|
||||
|
||||
// capture how much time was spent writing
|
||||
tickdata = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -960,7 +1065,11 @@ namespace OpenSim.Framework
|
||||
respStream.Close();
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb);
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}",
|
||||
verb, requestUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
@@ -971,20 +1080,47 @@ namespace OpenSim.Framework
|
||||
return deserial;
|
||||
else
|
||||
m_log.ErrorFormat(
|
||||
"[SynchronousRestObjectRequester]: WebException {0} {1} {2} {3}",
|
||||
requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace);
|
||||
"[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}",
|
||||
verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace);
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// This is what happens when there is invalid XML
|
||||
m_log.DebugFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString());
|
||||
m_log.DebugFormat(
|
||||
"[SynchronousRestObjectRequester]: Invalid XML from {0} {1} {2}",
|
||||
verb, requestUrl, typeof(TResponse).ToString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e);
|
||||
m_log.DebugFormat(
|
||||
"[SynchronousRestObjectRequester]: Exception on response from {0} {1}: {2}{3}",
|
||||
verb, requestUrl, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > WebUtil.LongCallTime)
|
||||
{
|
||||
string originalRequest = null;
|
||||
|
||||
if (buffer != null)
|
||||
{
|
||||
originalRequest = Encoding.UTF8.GetString(buffer.ToArray());
|
||||
|
||||
if (originalRequest.Length > WebUtil.MaxRequestDiagLength)
|
||||
originalRequest = originalRequest.Remove(WebUtil.MaxRequestDiagLength);
|
||||
}
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
verb,
|
||||
requestUrl,
|
||||
tickdiff,
|
||||
tickdata,
|
||||
originalRequest);
|
||||
}
|
||||
|
||||
return deserial;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user