diff options
author | Jeff Ames | 2008-11-25 16:00:55 +0000 |
---|---|---|
committer | Jeff Ames | 2008-11-25 16:00:55 +0000 |
commit | 518a8b9f2ac09a5060e2e59c913dfbe7faf397ef (patch) | |
tree | 8b3e39fbd54452e031873d31ff099e7db064cdee | |
parent | * minor: eliminate mono compiler warnings (diff) | |
download | opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.zip opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.tar.gz opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.tar.bz2 opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.tar.xz |
Update svn properties.
Diffstat (limited to '')
19 files changed, 5506 insertions, 5506 deletions
diff --git a/OpenSim/Framework/Communications/IHyperlink.cs b/OpenSim/Framework/Communications/IHyperlink.cs index 77815f1..02ba2c2 100644 --- a/OpenSim/Framework/Communications/IHyperlink.cs +++ b/OpenSim/Framework/Communications/IHyperlink.cs | |||
@@ -1,42 +1,42 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | 33 | ||
34 | namespace OpenSim.Framework.Communications | 34 | namespace OpenSim.Framework.Communications |
35 | { | 35 | { |
36 | public interface IHyperlink | 36 | public interface IHyperlink |
37 | { | 37 | { |
38 | bool IsHyperlinkRegion(ulong handle); | 38 | bool IsHyperlinkRegion(ulong handle); |
39 | RegionInfo GetHyperlinkRegion(ulong handle); | 39 | RegionInfo GetHyperlinkRegion(ulong handle); |
40 | ulong FindRegionHandle(ulong handle); | 40 | ulong FindRegionHandle(ulong handle); |
41 | } | 41 | } |
42 | } | 42 | } |
diff --git a/OpenSim/Framework/ForeignUserProfileData.cs b/OpenSim/Framework/ForeignUserProfileData.cs index bcb4243..4f734a7 100644 --- a/OpenSim/Framework/ForeignUserProfileData.cs +++ b/OpenSim/Framework/ForeignUserProfileData.cs | |||
@@ -1,80 +1,80 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | 30 | ||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | 32 | ||
33 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework |
34 | { | 34 | { |
35 | public class ForeignUserProfileData : UserProfileData | 35 | public class ForeignUserProfileData : UserProfileData |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// The address of the users home sim, used for foreigners. | 38 | /// The address of the users home sim, used for foreigners. |
39 | /// </summary> | 39 | /// </summary> |
40 | private string _userUserServerURI = String.Empty; | 40 | private string _userUserServerURI = String.Empty; |
41 | 41 | ||
42 | /// <summary> | 42 | /// <summary> |
43 | /// The address of the users home sim, used for foreigners. | 43 | /// The address of the users home sim, used for foreigners. |
44 | /// </summary> | 44 | /// </summary> |
45 | private string _userHomeAddress = String.Empty; | 45 | private string _userHomeAddress = String.Empty; |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
48 | /// The port of the users home sim, used for foreigners. | 48 | /// The port of the users home sim, used for foreigners. |
49 | /// </summary> | 49 | /// </summary> |
50 | private string _userHomePort = String.Empty; | 50 | private string _userHomePort = String.Empty; |
51 | /// <summary> | 51 | /// <summary> |
52 | /// The remoting port of the users home sim, used for foreigners. | 52 | /// The remoting port of the users home sim, used for foreigners. |
53 | /// </summary> | 53 | /// </summary> |
54 | private string _userHomeRemotingPort = String.Empty; | 54 | private string _userHomeRemotingPort = String.Empty; |
55 | 55 | ||
56 | public string UserServerURI | 56 | public string UserServerURI |
57 | { | 57 | { |
58 | get { return _userUserServerURI; } | 58 | get { return _userUserServerURI; } |
59 | set { _userUserServerURI = value; } | 59 | set { _userUserServerURI = value; } |
60 | } | 60 | } |
61 | 61 | ||
62 | public string UserHomeAddress | 62 | public string UserHomeAddress |
63 | { | 63 | { |
64 | get { return _userHomeAddress; } | 64 | get { return _userHomeAddress; } |
65 | set { _userHomeAddress = value; } | 65 | set { _userHomeAddress = value; } |
66 | } | 66 | } |
67 | 67 | ||
68 | public string UserHomePort | 68 | public string UserHomePort |
69 | { | 69 | { |
70 | get { return _userHomePort; } | 70 | get { return _userHomePort; } |
71 | set { _userHomePort = value; } | 71 | set { _userHomePort = value; } |
72 | } | 72 | } |
73 | 73 | ||
74 | public string UserHomeRemotingPort | 74 | public string UserHomeRemotingPort |
75 | { | 75 | { |
76 | get { return _userHomeRemotingPort; } | 76 | get { return _userHomeRemotingPort; } |
77 | set { _userHomeRemotingPort = value; } | 77 | set { _userHomeRemotingPort = value; } |
78 | } | 78 | } |
79 | } | 79 | } |
80 | } | 80 | } |
diff --git a/OpenSim/Framework/HGNetworkServersInfo.cs b/OpenSim/Framework/HGNetworkServersInfo.cs index 5b19801..b9bc07a 100644 --- a/OpenSim/Framework/HGNetworkServersInfo.cs +++ b/OpenSim/Framework/HGNetworkServersInfo.cs | |||
@@ -1,90 +1,90 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | 32 | ||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | 34 | ||
35 | namespace OpenSim.Framework | 35 | namespace OpenSim.Framework |
36 | { | 36 | { |
37 | public class HGNetworkServersInfo | 37 | public class HGNetworkServersInfo |
38 | { | 38 | { |
39 | 39 | ||
40 | public readonly string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI; | 40 | public readonly string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI; |
41 | 41 | ||
42 | private static HGNetworkServersInfo m_singleton; | 42 | private static HGNetworkServersInfo m_singleton; |
43 | public static HGNetworkServersInfo Singleton | 43 | public static HGNetworkServersInfo Singleton |
44 | { | 44 | { |
45 | get { return m_singleton; } | 45 | get { return m_singleton; } |
46 | } | 46 | } |
47 | 47 | ||
48 | public static void Init(string assetserver, string inventoryserver, string userserver) | 48 | public static void Init(string assetserver, string inventoryserver, string userserver) |
49 | { | 49 | { |
50 | m_singleton = new HGNetworkServersInfo(assetserver, inventoryserver, userserver); | 50 | m_singleton = new HGNetworkServersInfo(assetserver, inventoryserver, userserver); |
51 | 51 | ||
52 | } | 52 | } |
53 | 53 | ||
54 | private HGNetworkServersInfo(string a, string i, string u) | 54 | private HGNetworkServersInfo(string a, string i, string u) |
55 | { | 55 | { |
56 | LocalAssetServerURI = ServerURI(a); | 56 | LocalAssetServerURI = ServerURI(a); |
57 | LocalInventoryServerURI = ServerURI(i); | 57 | LocalInventoryServerURI = ServerURI(i); |
58 | LocalUserServerURI = ServerURI(u); | 58 | LocalUserServerURI = ServerURI(u); |
59 | } | 59 | } |
60 | 60 | ||
61 | public bool IsLocalUser(string userserver) | 61 | public bool IsLocalUser(string userserver) |
62 | { | 62 | { |
63 | string userServerURI = ServerURI(userserver); | 63 | string userServerURI = ServerURI(userserver); |
64 | bool ret = (((userServerURI == null) || (userServerURI == "") || (userServerURI == LocalUserServerURI))); | 64 | bool ret = (((userServerURI == null) || (userServerURI == "") || (userServerURI == LocalUserServerURI))); |
65 | //Console.WriteLine("-------------> HGNetworkServersInfo.IsLocalUser? " + ret + "(userServer=" + userServerURI + "; localuserserver=" + LocalUserServerURI + ")"); | 65 | //Console.WriteLine("-------------> HGNetworkServersInfo.IsLocalUser? " + ret + "(userServer=" + userServerURI + "; localuserserver=" + LocalUserServerURI + ")"); |
66 | return ret; | 66 | return ret; |
67 | } | 67 | } |
68 | 68 | ||
69 | public static string ServerURI(string uri) | 69 | public static string ServerURI(string uri) |
70 | { | 70 | { |
71 | IPAddress ipaddr1 = null; | 71 | IPAddress ipaddr1 = null; |
72 | string port1 = ""; | 72 | string port1 = ""; |
73 | try | 73 | try |
74 | { | 74 | { |
75 | ipaddr1 = Util.GetHostFromURL(uri); | 75 | ipaddr1 = Util.GetHostFromURL(uri); |
76 | } | 76 | } |
77 | catch { } | 77 | catch { } |
78 | 78 | ||
79 | try | 79 | try |
80 | { | 80 | { |
81 | port1 = uri.Split(new char[] { ':' })[2]; | 81 | port1 = uri.Split(new char[] { ':' })[2]; |
82 | } | 82 | } |
83 | catch { } | 83 | catch { } |
84 | 84 | ||
85 | // We tried our best to convert the domain names to IP addresses | 85 | // We tried our best to convert the domain names to IP addresses |
86 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; | 86 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; |
87 | } | 87 | } |
88 | 88 | ||
89 | } | 89 | } |
90 | } | 90 | } |
diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs index 8bb93a6..ef23adc 100644 --- a/OpenSim/Region/Application/HGOpenSimNode.cs +++ b/OpenSim/Region/Application/HGOpenSimNode.cs | |||
@@ -1,184 +1,184 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using System.IO; | 4 | using System.IO; |
5 | using System.Net; | 5 | using System.Net; |
6 | using System.Reflection; | 6 | using System.Reflection; |
7 | using log4net; | 7 | using log4net; |
8 | using Nini.Config; | 8 | using Nini.Config; |
9 | using OpenSim.Framework; | 9 | using OpenSim.Framework; |
10 | using OpenSim.Framework.Console; | 10 | using OpenSim.Framework.Console; |
11 | using OpenSim.Framework.Servers; | 11 | using OpenSim.Framework.Servers; |
12 | using OpenSim.Framework.Statistics; | 12 | using OpenSim.Framework.Statistics; |
13 | using OpenSim.Region.ClientStack; | 13 | using OpenSim.Region.ClientStack; |
14 | using OpenSim.Framework.Communications; | 14 | using OpenSim.Framework.Communications; |
15 | using OpenSim.Framework.Communications.Cache; | 15 | using OpenSim.Framework.Communications.Cache; |
16 | using OpenSim.Region.Communications.Local; | 16 | using OpenSim.Region.Communications.Local; |
17 | using OpenSim.Region.Communications.Hypergrid; | 17 | using OpenSim.Region.Communications.Hypergrid; |
18 | using OpenSim.Region.Environment; | 18 | using OpenSim.Region.Environment; |
19 | using OpenSim.Region.Environment.Interfaces; | 19 | using OpenSim.Region.Environment.Interfaces; |
20 | using OpenSim.Region.Environment.Scenes; | 20 | using OpenSim.Region.Environment.Scenes; |
21 | using OpenSim.Region.Environment.Scenes.Hypergrid; | 21 | using OpenSim.Region.Environment.Scenes.Hypergrid; |
22 | 22 | ||
23 | using Timer = System.Timers.Timer; | 23 | using Timer = System.Timers.Timer; |
24 | 24 | ||
25 | namespace OpenSim | 25 | namespace OpenSim |
26 | { | 26 | { |
27 | public class HGOpenSimNode : OpenSim | 27 | public class HGOpenSimNode : OpenSim |
28 | { | 28 | { |
29 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 29 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
30 | private IHyperlink HGServices = null; | 30 | private IHyperlink HGServices = null; |
31 | 31 | ||
32 | public HGOpenSimNode(IConfigSource configSource) : base(configSource) | 32 | public HGOpenSimNode(IConfigSource configSource) : base(configSource) |
33 | { | 33 | { |
34 | } | 34 | } |
35 | 35 | ||
36 | 36 | ||
37 | /// <summary> | 37 | /// <summary> |
38 | /// Performs initialisation of the scene, such as loading configuration from disk. | 38 | /// Performs initialisation of the scene, such as loading configuration from disk. |
39 | /// </summary> | 39 | /// </summary> |
40 | protected override void StartupSpecific() | 40 | protected override void StartupSpecific() |
41 | { | 41 | { |
42 | m_log.Info("===================================================================="); | 42 | m_log.Info("===================================================================="); |
43 | m_log.Info("=================== STARTING HYPERGRID NODE ========================"); | 43 | m_log.Info("=================== STARTING HYPERGRID NODE ========================"); |
44 | m_log.Info("===================================================================="); | 44 | m_log.Info("===================================================================="); |
45 | 45 | ||
46 | base.StartupSpecific(); | 46 | base.StartupSpecific(); |
47 | } | 47 | } |
48 | 48 | ||
49 | 49 | ||
50 | protected override void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder) | 50 | protected override void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder) |
51 | { | 51 | { |
52 | // Standalone mode | 52 | // Standalone mode |
53 | 53 | ||
54 | HGInventoryService inventoryService = new HGInventoryService(m_networkServersInfo.InventoryURL, null, false); | 54 | HGInventoryService inventoryService = new HGInventoryService(m_networkServersInfo.InventoryURL, null, false); |
55 | inventoryService.AddPlugin(m_configSettings.StandaloneInventoryPlugin, m_configSettings.StandaloneInventorySource); | 55 | inventoryService.AddPlugin(m_configSettings.StandaloneInventoryPlugin, m_configSettings.StandaloneInventorySource); |
56 | 56 | ||
57 | LocalUserServices userService = | 57 | LocalUserServices userService = |
58 | new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, | 58 | new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, |
59 | m_networkServersInfo.DefaultHomeLocY, inventoryService); | 59 | m_networkServersInfo.DefaultHomeLocY, inventoryService); |
60 | userService.AddPlugin(m_configSettings.StandaloneUserPlugin, m_configSettings.StandaloneUserSource); | 60 | userService.AddPlugin(m_configSettings.StandaloneUserPlugin, m_configSettings.StandaloneUserSource); |
61 | 61 | ||
62 | //LocalBackEndServices backendService = new LocalBackEndServices(); | 62 | //LocalBackEndServices backendService = new LocalBackEndServices(); |
63 | HGGridServicesStandalone gridService = new HGGridServicesStandalone(m_networkServersInfo, m_httpServer, m_assetCache, m_sceneManager); | 63 | HGGridServicesStandalone gridService = new HGGridServicesStandalone(m_networkServersInfo, m_httpServer, m_assetCache, m_sceneManager); |
64 | 64 | ||
65 | LocalLoginService loginService = | 65 | LocalLoginService loginService = |
66 | new LocalLoginService( | 66 | new LocalLoginService( |
67 | userService, m_configSettings.StandaloneWelcomeMessage, inventoryService, gridService.LocalBackend, m_networkServersInfo, | 67 | userService, m_configSettings.StandaloneWelcomeMessage, inventoryService, gridService.LocalBackend, m_networkServersInfo, |
68 | m_configSettings.StandaloneAuthenticate, libraryRootFolder); | 68 | m_configSettings.StandaloneAuthenticate, libraryRootFolder); |
69 | 69 | ||
70 | 70 | ||
71 | m_commsManager = new HGCommunicationsStandalone(m_networkServersInfo, m_httpServer, m_assetCache, | 71 | m_commsManager = new HGCommunicationsStandalone(m_networkServersInfo, m_httpServer, m_assetCache, |
72 | userService, userService, inventoryService, gridService, gridService, userService, libraryRootFolder, m_configSettings.DumpAssetsToFile); | 72 | userService, userService, inventoryService, gridService, gridService, userService, libraryRootFolder, m_configSettings.DumpAssetsToFile); |
73 | 73 | ||
74 | inventoryService.UserProfileCache = m_commsManager.UserProfileCacheService; | 74 | inventoryService.UserProfileCache = m_commsManager.UserProfileCacheService; |
75 | HGServices = gridService; | 75 | HGServices = gridService; |
76 | 76 | ||
77 | // set up XMLRPC handler for client's initial login request message | 77 | // set up XMLRPC handler for client's initial login request message |
78 | m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); | 78 | m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); |
79 | 79 | ||
80 | // provides the web form login | 80 | // provides the web form login |
81 | m_httpServer.AddHTTPHandler("login", loginService.ProcessHTMLLogin); | 81 | m_httpServer.AddHTTPHandler("login", loginService.ProcessHTMLLogin); |
82 | 82 | ||
83 | // Provides the LLSD login | 83 | // Provides the LLSD login |
84 | m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod); | 84 | m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod); |
85 | 85 | ||
86 | // provide grid info | 86 | // provide grid info |
87 | // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini"))); | 87 | // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini"))); |
88 | m_gridInfoService = new GridInfoService(m_config.Source); | 88 | m_gridInfoService = new GridInfoService(m_config.Source); |
89 | m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); | 89 | m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); |
90 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); | 90 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); |
91 | } | 91 | } |
92 | 92 | ||
93 | protected override void InitialiseGridServices(LibraryRootFolder libraryRootFolder) | 93 | protected override void InitialiseGridServices(LibraryRootFolder libraryRootFolder) |
94 | { | 94 | { |
95 | m_commsManager = new HGCommunicationsGridMode(m_networkServersInfo, m_httpServer, m_assetCache, m_sceneManager, libraryRootFolder); | 95 | m_commsManager = new HGCommunicationsGridMode(m_networkServersInfo, m_httpServer, m_assetCache, m_sceneManager, libraryRootFolder); |
96 | 96 | ||
97 | HGServices = ((HGCommunicationsGridMode)m_commsManager).HGServices; | 97 | HGServices = ((HGCommunicationsGridMode)m_commsManager).HGServices; |
98 | 98 | ||
99 | m_httpServer.AddStreamHandler(new SimStatusHandler()); | 99 | m_httpServer.AddStreamHandler(new SimStatusHandler()); |
100 | } | 100 | } |
101 | 101 | ||
102 | protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, | 102 | protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, |
103 | AgentCircuitManager circuitManager) | 103 | AgentCircuitManager circuitManager) |
104 | { | 104 | { |
105 | HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices); | 105 | HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices); |
106 | return | 106 | return |
107 | new HGScene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, | 107 | new HGScene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, |
108 | storageManager, m_httpServer, | 108 | storageManager, m_httpServer, |
109 | m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source, | 109 | m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source, |
110 | m_version); | 110 | m_version); |
111 | } | 111 | } |
112 | 112 | ||
113 | public override void RunCmd(string command, string[] cmdparams) | 113 | public override void RunCmd(string command, string[] cmdparams) |
114 | { | 114 | { |
115 | if (command.Equals("link-region")) | 115 | if (command.Equals("link-region")) |
116 | { | 116 | { |
117 | // link-region <Xloc> <Yloc> <HostName> <HttpPort> <LocalName> | 117 | // link-region <Xloc> <Yloc> <HostName> <HttpPort> <LocalName> |
118 | if (cmdparams.Length < 4) | 118 | if (cmdparams.Length < 4) |
119 | { | 119 | { |
120 | LinkRegionCmdUsage(); | 120 | LinkRegionCmdUsage(); |
121 | return; | 121 | return; |
122 | } | 122 | } |
123 | 123 | ||
124 | RegionInfo regInfo = new RegionInfo(); | 124 | RegionInfo regInfo = new RegionInfo(); |
125 | uint xloc, yloc; | 125 | uint xloc, yloc; |
126 | uint externalPort; | 126 | uint externalPort; |
127 | try | 127 | try |
128 | { | 128 | { |
129 | xloc = Convert.ToUInt32(cmdparams[0]); | 129 | xloc = Convert.ToUInt32(cmdparams[0]); |
130 | yloc = Convert.ToUInt32(cmdparams[1]); | 130 | yloc = Convert.ToUInt32(cmdparams[1]); |
131 | externalPort = Convert.ToUInt32(cmdparams[3]); | 131 | externalPort = Convert.ToUInt32(cmdparams[3]); |
132 | //internalPort = Convert.ToUInt32(cmdparams[4]); | 132 | //internalPort = Convert.ToUInt32(cmdparams[4]); |
133 | //remotingPort = Convert.ToUInt32(cmdparams[5]); | 133 | //remotingPort = Convert.ToUInt32(cmdparams[5]); |
134 | } | 134 | } |
135 | catch (Exception e) | 135 | catch (Exception e) |
136 | { | 136 | { |
137 | m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message); | 137 | m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message); |
138 | LinkRegionCmdUsage(); | 138 | LinkRegionCmdUsage(); |
139 | return; | 139 | return; |
140 | } | 140 | } |
141 | regInfo.RegionLocX = xloc; | 141 | regInfo.RegionLocX = xloc; |
142 | regInfo.RegionLocY = yloc; | 142 | regInfo.RegionLocY = yloc; |
143 | regInfo.ExternalHostName = cmdparams[2]; | 143 | regInfo.ExternalHostName = cmdparams[2]; |
144 | regInfo.HttpPort = externalPort; | 144 | regInfo.HttpPort = externalPort; |
145 | //regInfo.RemotingPort = remotingPort; | 145 | //regInfo.RemotingPort = remotingPort; |
146 | try | 146 | try |
147 | { | 147 | { |
148 | regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); | 148 | regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); |
149 | } | 149 | } |
150 | catch (Exception e) | 150 | catch (Exception e) |
151 | { | 151 | { |
152 | m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message); | 152 | m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message); |
153 | LinkRegionCmdUsage(); | 153 | LinkRegionCmdUsage(); |
154 | return; | 154 | return; |
155 | } | 155 | } |
156 | regInfo.RemotingAddress = regInfo.ExternalEndPoint.Address.ToString(); | 156 | regInfo.RemotingAddress = regInfo.ExternalEndPoint.Address.ToString(); |
157 | 157 | ||
158 | // Finally, link it | 158 | // Finally, link it |
159 | try | 159 | try |
160 | { | 160 | { |
161 | m_sceneManager.CurrentOrFirstScene.CommsManager.GridService.RegisterRegion(regInfo); | 161 | m_sceneManager.CurrentOrFirstScene.CommsManager.GridService.RegisterRegion(regInfo); |
162 | } | 162 | } |
163 | catch (Exception e) | 163 | catch (Exception e) |
164 | { | 164 | { |
165 | m_log.Warn("[HGrid] Unable to link region: " + e.StackTrace); | 165 | m_log.Warn("[HGrid] Unable to link region: " + e.StackTrace); |
166 | } | 166 | } |
167 | if (cmdparams.Length >= 5) | 167 | if (cmdparams.Length >= 5) |
168 | { | 168 | { |
169 | regInfo.RegionName = ""; | 169 | regInfo.RegionName = ""; |
170 | for (int i = 4; i < cmdparams.Length; i++) | 170 | for (int i = 4; i < cmdparams.Length; i++) |
171 | regInfo.RegionName += cmdparams[i] + " "; | 171 | regInfo.RegionName += cmdparams[i] + " "; |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | base.RunCmd(command, cmdparams); | 175 | base.RunCmd(command, cmdparams); |
176 | 176 | ||
177 | } | 177 | } |
178 | 178 | ||
179 | private void LinkRegionCmdUsage() | 179 | private void LinkRegionCmdUsage() |
180 | { | 180 | { |
181 | Console.WriteLine("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]"); | 181 | Console.WriteLine("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]"); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | } | 184 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs index 9672df3..eaaa7d2 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs | |||
@@ -1,82 +1,82 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | 29 | ||
30 | using log4net; | 30 | using log4net; |
31 | 31 | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications; | 33 | using OpenSim.Framework.Communications; |
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Region.Communications.OGS1; | 35 | using OpenSim.Region.Communications.OGS1; |
36 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
38 | 38 | ||
39 | namespace OpenSim.Region.Communications.Hypergrid | 39 | namespace OpenSim.Region.Communications.Hypergrid |
40 | { | 40 | { |
41 | public class HGCommunicationsGridMode : CommunicationsManager // CommunicationsOGS1 | 41 | public class HGCommunicationsGridMode : CommunicationsManager // CommunicationsOGS1 |
42 | { | 42 | { |
43 | private static readonly ILog m_log | 43 | private static readonly ILog m_log |
44 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | IHyperlink m_osw = null; | 46 | IHyperlink m_osw = null; |
47 | public IHyperlink HGServices | 47 | public IHyperlink HGServices |
48 | { | 48 | { |
49 | get { return m_osw; } | 49 | get { return m_osw; } |
50 | } | 50 | } |
51 | 51 | ||
52 | public HGCommunicationsGridMode( | 52 | public HGCommunicationsGridMode( |
53 | NetworkServersInfo serversInfo, BaseHttpServer httpServer, | 53 | NetworkServersInfo serversInfo, BaseHttpServer httpServer, |
54 | AssetCache assetCache, SceneManager sman, LibraryRootFolder libraryRootFolder) | 54 | AssetCache assetCache, SceneManager sman, LibraryRootFolder libraryRootFolder) |
55 | : base(serversInfo, httpServer, assetCache, false, libraryRootFolder) | 55 | : base(serversInfo, httpServer, assetCache, false, libraryRootFolder) |
56 | { | 56 | { |
57 | 57 | ||
58 | // From constructor at CommunicationsOGS1 | 58 | // From constructor at CommunicationsOGS1 |
59 | HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, httpServer, assetCache, sman, m_userProfileCacheService); | 59 | HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, httpServer, assetCache, sman, m_userProfileCacheService); |
60 | m_gridService = gridInterComms; | 60 | m_gridService = gridInterComms; |
61 | m_interRegion = gridInterComms; | 61 | m_interRegion = gridInterComms; |
62 | m_osw = gridInterComms; | 62 | m_osw = gridInterComms; |
63 | 63 | ||
64 | // The HG InventoryService always uses secure handlers | 64 | // The HG InventoryService always uses secure handlers |
65 | HGInventoryService invService = new HGInventoryService(serversInfo.InventoryURL, this.m_userProfileCacheService, true); | 65 | HGInventoryService invService = new HGInventoryService(serversInfo.InventoryURL, this.m_userProfileCacheService, true); |
66 | AddSecureInventoryService(invService); | 66 | AddSecureInventoryService(invService); |
67 | m_defaultInventoryHost = invService.Host; | 67 | m_defaultInventoryHost = invService.Host; |
68 | if (SecureInventoryService != null) | 68 | if (SecureInventoryService != null) |
69 | m_log.Info("[HG] SecureInventoryService."); | 69 | m_log.Info("[HG] SecureInventoryService."); |
70 | else | 70 | else |
71 | m_log.Info("[HG] Non-secureInventoryService."); | 71 | m_log.Info("[HG] Non-secureInventoryService."); |
72 | 72 | ||
73 | 73 | ||
74 | HGUserServices userServices = new HGUserServices(this); | 74 | HGUserServices userServices = new HGUserServices(this); |
75 | m_userService = userServices; | 75 | m_userService = userServices; |
76 | m_messageService = userServices; | 76 | m_messageService = userServices; |
77 | m_avatarService = (IAvatarService)m_userService; | 77 | m_avatarService = (IAvatarService)m_userService; |
78 | 78 | ||
79 | } | 79 | } |
80 | 80 | ||
81 | } | 81 | } |
82 | } | 82 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs index 2868b77..3bf714e 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs | |||
@@ -1,59 +1,59 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Communications; | 31 | using OpenSim.Framework.Communications; |
32 | using OpenSim.Framework.Communications.Cache; | 32 | using OpenSim.Framework.Communications.Cache; |
33 | using OpenSim.Region.Communications.Local; | 33 | using OpenSim.Region.Communications.Local; |
34 | using OpenSim.Framework.Servers; | 34 | using OpenSim.Framework.Servers; |
35 | 35 | ||
36 | namespace OpenSim.Region.Communications.Hypergrid | 36 | namespace OpenSim.Region.Communications.Hypergrid |
37 | { | 37 | { |
38 | public class HGCommunicationsStandalone : CommunicationsLocal | 38 | public class HGCommunicationsStandalone : CommunicationsLocal |
39 | { | 39 | { |
40 | public HGCommunicationsStandalone( | 40 | public HGCommunicationsStandalone( |
41 | NetworkServersInfo serversInfo, | 41 | NetworkServersInfo serversInfo, |
42 | BaseHttpServer httpServer, | 42 | BaseHttpServer httpServer, |
43 | AssetCache assetCache, | 43 | AssetCache assetCache, |
44 | IUserService userService, | 44 | IUserService userService, |
45 | IUserServiceAdmin userServiceAdmin, | 45 | IUserServiceAdmin userServiceAdmin, |
46 | LocalInventoryService inventoryService, | 46 | LocalInventoryService inventoryService, |
47 | IInterRegionCommunications interRegionService, | 47 | IInterRegionCommunications interRegionService, |
48 | HGGridServices gridService, IMessagingService messageService, LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile) | 48 | HGGridServices gridService, IMessagingService messageService, LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile) |
49 | : base(serversInfo, httpServer, assetCache, userService, userServiceAdmin, inventoryService, interRegionService, gridService, messageService, libraryRootFolder, dumpAssetsToFile) | 49 | : base(serversInfo, httpServer, assetCache, userService, userServiceAdmin, inventoryService, interRegionService, gridService, messageService, libraryRootFolder, dumpAssetsToFile) |
50 | { | 50 | { |
51 | gridService.UserProfileCache = m_userProfileCacheService; | 51 | gridService.UserProfileCache = m_userProfileCacheService; |
52 | m_assetCache = assetCache; | 52 | m_assetCache = assetCache; |
53 | // Let's swap to always be secure access to inventory | 53 | // Let's swap to always be secure access to inventory |
54 | AddSecureInventoryService((ISecureInventoryService)inventoryService); | 54 | AddSecureInventoryService((ISecureInventoryService)inventoryService); |
55 | m_inventoryServices = null; | 55 | m_inventoryServices = null; |
56 | } | 56 | } |
57 | 57 | ||
58 | } | 58 | } |
59 | } | 59 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs index d05a1d1..56a8912 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs | |||
@@ -1,1294 +1,1294 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | using System; | 30 | using System; |
31 | using System.Collections; | 31 | using System.Collections; |
32 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
33 | using System.Drawing; | 33 | using System.Drawing; |
34 | using System.Drawing.Drawing2D; | 34 | using System.Drawing.Drawing2D; |
35 | using System.Drawing.Imaging; | 35 | using System.Drawing.Imaging; |
36 | using System.IO; | 36 | using System.IO; |
37 | using System.Net; | 37 | using System.Net; |
38 | using System.Net.Sockets; | 38 | using System.Net.Sockets; |
39 | using System.Reflection; | 39 | using System.Reflection; |
40 | using System.Runtime.Remoting; | 40 | using System.Runtime.Remoting; |
41 | using System.Runtime.Remoting.Channels; | 41 | using System.Runtime.Remoting.Channels; |
42 | using System.Runtime.Remoting.Channels.Tcp; | 42 | using System.Runtime.Remoting.Channels.Tcp; |
43 | using System.Security.Authentication; | 43 | using System.Security.Authentication; |
44 | using System.Threading; | 44 | using System.Threading; |
45 | using OpenMetaverse; | 45 | using OpenMetaverse; |
46 | using OpenMetaverse.Imaging; | 46 | using OpenMetaverse.Imaging; |
47 | using log4net; | 47 | using log4net; |
48 | using Nwc.XmlRpc; | 48 | using Nwc.XmlRpc; |
49 | using OpenSim.Framework; | 49 | using OpenSim.Framework; |
50 | using OpenSim.Framework.Communications; | 50 | using OpenSim.Framework.Communications; |
51 | using OpenSim.Framework.Communications.Cache; | 51 | using OpenSim.Framework.Communications.Cache; |
52 | using OpenSim.Framework.Servers; | 52 | using OpenSim.Framework.Servers; |
53 | using OpenSim.Region.Communications.Local; | 53 | using OpenSim.Region.Communications.Local; |
54 | using OpenSim.Region.Communications.OGS1; | 54 | using OpenSim.Region.Communications.OGS1; |
55 | using OpenSim.Region.Environment.Modules.Framework; | 55 | using OpenSim.Region.Environment.Modules.Framework; |
56 | using OpenSim.Region.Environment.Scenes; | 56 | using OpenSim.Region.Environment.Scenes; |
57 | using OpenSim.Region.Interfaces; | 57 | using OpenSim.Region.Interfaces; |
58 | 58 | ||
59 | namespace OpenSim.Region.Communications.Hypergrid | 59 | namespace OpenSim.Region.Communications.Hypergrid |
60 | { | 60 | { |
61 | /// <summary> | 61 | /// <summary> |
62 | /// This class encapsulates the main hypergrid functions related to creating and managing | 62 | /// This class encapsulates the main hypergrid functions related to creating and managing |
63 | /// hyperlinks, as well as processing all the inter-region comms between a region and | 63 | /// hyperlinks, as well as processing all the inter-region comms between a region and |
64 | /// an hyperlinked region. | 64 | /// an hyperlinked region. |
65 | /// </summary> | 65 | /// </summary> |
66 | public class HGGridServices : IGridServices, IInterRegionCommunications, IHyperlink | 66 | public class HGGridServices : IGridServices, IInterRegionCommunications, IHyperlink |
67 | { | 67 | { |
68 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 68 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
69 | 69 | ||
70 | 70 | ||
71 | public BaseHttpServer httpListener; | 71 | public BaseHttpServer httpListener; |
72 | public NetworkServersInfo serversInfo; | 72 | public NetworkServersInfo serversInfo; |
73 | public BaseHttpServer httpServer; | 73 | public BaseHttpServer httpServer; |
74 | 74 | ||
75 | protected List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>(); | 75 | protected List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>(); |
76 | 76 | ||
77 | // Hyperlink regions are hyperlinks on the map | 77 | // Hyperlink regions are hyperlinks on the map |
78 | protected List<RegionInfo> m_hyperlinkRegions = new List<RegionInfo>(); | 78 | protected List<RegionInfo> m_hyperlinkRegions = new List<RegionInfo>(); |
79 | 79 | ||
80 | // Known regions are home regions of visiting foreign users. | 80 | // Known regions are home regions of visiting foreign users. |
81 | // They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when | 81 | // They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when |
82 | // the visitor goes away. They are mapped to X=0 on the map. | 82 | // the visitor goes away. They are mapped to X=0 on the map. |
83 | // This is key-ed on agent ID | 83 | // This is key-ed on agent ID |
84 | protected Dictionary<UUID, RegionInfo> m_knownRegions = new Dictionary<UUID, RegionInfo>(); | 84 | protected Dictionary<UUID, RegionInfo> m_knownRegions = new Dictionary<UUID, RegionInfo>(); |
85 | 85 | ||
86 | protected AssetCache m_assetcache; | 86 | protected AssetCache m_assetcache; |
87 | protected UserProfileCacheService m_userProfileCache; | 87 | protected UserProfileCacheService m_userProfileCache; |
88 | protected SceneManager m_sceneman; | 88 | protected SceneManager m_sceneman; |
89 | 89 | ||
90 | private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>(); | 90 | private Dictionary<string, string> m_queuedGridSettings = new Dictionary<string, string>(); |
91 | 91 | ||
92 | public virtual string gdebugRegionName | 92 | public virtual string gdebugRegionName |
93 | { | 93 | { |
94 | get { return "Override me"; } | 94 | get { return "Override me"; } |
95 | set { ; } | 95 | set { ; } |
96 | } | 96 | } |
97 | 97 | ||
98 | public string rdebugRegionName | 98 | public string rdebugRegionName |
99 | { | 99 | { |
100 | get { return _rdebugRegionName; } | 100 | get { return _rdebugRegionName; } |
101 | set { _rdebugRegionName = value; } | 101 | set { _rdebugRegionName = value; } |
102 | } | 102 | } |
103 | private string _rdebugRegionName = String.Empty; | 103 | private string _rdebugRegionName = String.Empty; |
104 | 104 | ||
105 | public virtual bool RegionLoginsEnabled | 105 | public virtual bool RegionLoginsEnabled |
106 | { | 106 | { |
107 | get { return true; } | 107 | get { return true; } |
108 | set { ; } | 108 | set { ; } |
109 | } | 109 | } |
110 | 110 | ||
111 | public UserProfileCacheService UserProfileCache | 111 | public UserProfileCacheService UserProfileCache |
112 | { | 112 | { |
113 | set { m_userProfileCache = value; } | 113 | set { m_userProfileCache = value; } |
114 | } | 114 | } |
115 | 115 | ||
116 | /// <summary> | 116 | /// <summary> |
117 | /// Contructor. Adds "expect_hg_user" and "check" xmlrpc method handlers | 117 | /// Contructor. Adds "expect_hg_user" and "check" xmlrpc method handlers |
118 | /// </summary> | 118 | /// </summary> |
119 | /// <param name="servers_info"></param> | 119 | /// <param name="servers_info"></param> |
120 | /// <param name="httpServe"></param> | 120 | /// <param name="httpServe"></param> |
121 | public HGGridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe, AssetCache asscache, SceneManager sman) | 121 | public HGGridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe, AssetCache asscache, SceneManager sman) |
122 | { | 122 | { |
123 | serversInfo = servers_info; | 123 | serversInfo = servers_info; |
124 | httpServer = httpServe; | 124 | httpServer = httpServe; |
125 | m_assetcache = asscache; | 125 | m_assetcache = asscache; |
126 | m_sceneman = sman; | 126 | m_sceneman = sman; |
127 | 127 | ||
128 | httpServer.AddXmlRPCHandler("link_region", LinkRegionRequest); | 128 | httpServer.AddXmlRPCHandler("link_region", LinkRegionRequest); |
129 | httpServer.AddXmlRPCHandler("expect_hg_user", ExpectHGUser); | 129 | httpServer.AddXmlRPCHandler("expect_hg_user", ExpectHGUser); |
130 | 130 | ||
131 | HGNetworkServersInfo.Init(servers_info.AssetURL, servers_info.InventoryURL, servers_info.UserURL); | 131 | HGNetworkServersInfo.Init(servers_info.AssetURL, servers_info.InventoryURL, servers_info.UserURL); |
132 | } | 132 | } |
133 | 133 | ||
134 | // see IGridServices | 134 | // see IGridServices |
135 | public virtual RegionCommsListener RegisterRegion(RegionInfo regionInfo) | 135 | public virtual RegionCommsListener RegisterRegion(RegionInfo regionInfo) |
136 | { | 136 | { |
137 | // Region doesn't exist here. Trying to link remote region | 137 | // Region doesn't exist here. Trying to link remote region |
138 | 138 | ||
139 | m_log.Info("[HGrid]: Linking remote region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort ); | 139 | m_log.Info("[HGrid]: Linking remote region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort ); |
140 | regionInfo.RegionID = LinkRegion(regionInfo); // UUID.Random(); | 140 | regionInfo.RegionID = LinkRegion(regionInfo); // UUID.Random(); |
141 | if (!regionInfo.RegionID.Equals(UUID.Zero)) | 141 | if (!regionInfo.RegionID.Equals(UUID.Zero)) |
142 | { | 142 | { |
143 | m_hyperlinkRegions.Add(regionInfo); | 143 | m_hyperlinkRegions.Add(regionInfo); |
144 | m_log.Info("[HGrid]: Successfully linked to region_uuid " + regionInfo.RegionID); | 144 | m_log.Info("[HGrid]: Successfully linked to region_uuid " + regionInfo.RegionID); |
145 | 145 | ||
146 | //Try get the map image | 146 | //Try get the map image |
147 | GetMapImage(regionInfo); | 147 | GetMapImage(regionInfo); |
148 | } | 148 | } |
149 | else | 149 | else |
150 | { | 150 | { |
151 | m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")"); | 151 | m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")"); |
152 | } | 152 | } |
153 | // Note that these remote regions aren't registered in localBackend, so return null, no local listeners | 153 | // Note that these remote regions aren't registered in localBackend, so return null, no local listeners |
154 | return null; | 154 | return null; |
155 | } | 155 | } |
156 | 156 | ||
157 | // see IGridServices | 157 | // see IGridServices |
158 | public virtual bool DeregisterRegion(RegionInfo regionInfo) | 158 | public virtual bool DeregisterRegion(RegionInfo regionInfo) |
159 | { | 159 | { |
160 | if (m_hyperlinkRegions.Contains(regionInfo)) | 160 | if (m_hyperlinkRegions.Contains(regionInfo)) |
161 | { | 161 | { |
162 | m_hyperlinkRegions.Remove(regionInfo); | 162 | m_hyperlinkRegions.Remove(regionInfo); |
163 | return true; | 163 | return true; |
164 | } | 164 | } |
165 | foreach (KeyValuePair<UUID, RegionInfo> kvp in m_knownRegions) | 165 | foreach (KeyValuePair<UUID, RegionInfo> kvp in m_knownRegions) |
166 | { | 166 | { |
167 | if (kvp.Value == regionInfo) | 167 | if (kvp.Value == regionInfo) |
168 | { | 168 | { |
169 | m_knownRegions.Remove(kvp.Key); | 169 | m_knownRegions.Remove(kvp.Key); |
170 | return true; | 170 | return true; |
171 | } | 171 | } |
172 | } | 172 | } |
173 | return false; | 173 | return false; |
174 | } | 174 | } |
175 | 175 | ||
176 | public virtual Dictionary<string, string> GetGridSettings() | 176 | public virtual Dictionary<string, string> GetGridSettings() |
177 | { | 177 | { |
178 | Dictionary<string, string> returnGridSettings = new Dictionary<string, string>(); | 178 | Dictionary<string, string> returnGridSettings = new Dictionary<string, string>(); |
179 | lock (m_queuedGridSettings) | 179 | lock (m_queuedGridSettings) |
180 | { | 180 | { |
181 | foreach (string Dictkey in m_queuedGridSettings.Keys) | 181 | foreach (string Dictkey in m_queuedGridSettings.Keys) |
182 | { | 182 | { |
183 | returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); | 183 | returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); |
184 | } | 184 | } |
185 | 185 | ||
186 | m_queuedGridSettings.Clear(); | 186 | m_queuedGridSettings.Clear(); |
187 | } | 187 | } |
188 | 188 | ||
189 | return returnGridSettings; | 189 | return returnGridSettings; |
190 | } | 190 | } |
191 | 191 | ||
192 | // see IGridServices | 192 | // see IGridServices |
193 | public virtual List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) | 193 | public virtual List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) |
194 | { | 194 | { |
195 | List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); | 195 | List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); |
196 | foreach (RegionInfo reg in m_hyperlinkRegions) | 196 | foreach (RegionInfo reg in m_hyperlinkRegions) |
197 | { | 197 | { |
198 | if (reg.RegionLocX != x || reg.RegionLocY != y) | 198 | if (reg.RegionLocX != x || reg.RegionLocY != y) |
199 | { | 199 | { |
200 | //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); | 200 | //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); |
201 | if ((reg.RegionLocX > (x - 2)) && (reg.RegionLocX < (x + 2))) | 201 | if ((reg.RegionLocX > (x - 2)) && (reg.RegionLocX < (x + 2))) |
202 | { | 202 | { |
203 | if ((reg.RegionLocY > (y - 2)) && (reg.RegionLocY < (y + 2))) | 203 | if ((reg.RegionLocY > (y - 2)) && (reg.RegionLocY < (y + 2))) |
204 | { | 204 | { |
205 | neighbours.Add(reg); | 205 | neighbours.Add(reg); |
206 | } | 206 | } |
207 | } | 207 | } |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | return neighbours; | 211 | return neighbours; |
212 | } | 212 | } |
213 | 213 | ||
214 | /// <summary> | 214 | /// <summary> |
215 | /// Request information about a region. | 215 | /// Request information about a region. |
216 | /// </summary> | 216 | /// </summary> |
217 | /// <param name="regionHandle"></param> | 217 | /// <param name="regionHandle"></param> |
218 | /// <returns> | 218 | /// <returns> |
219 | /// null on a failure to contact or get a response from the grid server | 219 | /// null on a failure to contact or get a response from the grid server |
220 | /// FIXME: Might be nicer to return a proper exception here since we could inform the client more about the | 220 | /// FIXME: Might be nicer to return a proper exception here since we could inform the client more about the |
221 | /// nature of the faiulre. | 221 | /// nature of the faiulre. |
222 | /// </returns> | 222 | /// </returns> |
223 | public virtual RegionInfo RequestNeighbourInfo(UUID Region_UUID) | 223 | public virtual RegionInfo RequestNeighbourInfo(UUID Region_UUID) |
224 | { | 224 | { |
225 | foreach (RegionInfo info in m_hyperlinkRegions) | 225 | foreach (RegionInfo info in m_hyperlinkRegions) |
226 | { | 226 | { |
227 | if (info.RegionID == Region_UUID) return info; | 227 | if (info.RegionID == Region_UUID) return info; |
228 | } | 228 | } |
229 | 229 | ||
230 | // I don't trust region uuids to be unique... | 230 | // I don't trust region uuids to be unique... |
231 | //foreach (RegionInfo info in m_knownRegions.Values) | 231 | //foreach (RegionInfo info in m_knownRegions.Values) |
232 | //{ | 232 | //{ |
233 | // if (info.RegionID == Region_UUID) return info; | 233 | // if (info.RegionID == Region_UUID) return info; |
234 | //} | 234 | //} |
235 | 235 | ||
236 | return null; | 236 | return null; |
237 | } | 237 | } |
238 | 238 | ||
239 | /// <summary> | 239 | /// <summary> |
240 | /// Request information about a region. | 240 | /// Request information about a region. |
241 | /// </summary> | 241 | /// </summary> |
242 | /// <param name="regionHandle"></param> | 242 | /// <param name="regionHandle"></param> |
243 | /// <returns></returns> | 243 | /// <returns></returns> |
244 | public virtual RegionInfo RequestNeighbourInfo(ulong regionHandle) | 244 | public virtual RegionInfo RequestNeighbourInfo(ulong regionHandle) |
245 | { | 245 | { |
246 | //Console.WriteLine("RequestNeighbourInfo for " + regionHandle); | 246 | //Console.WriteLine("RequestNeighbourInfo for " + regionHandle); |
247 | foreach (RegionInfo info in m_hyperlinkRegions) | 247 | foreach (RegionInfo info in m_hyperlinkRegions) |
248 | { | 248 | { |
249 | //Console.WriteLine(" .. " + info.RegionHandle); | 249 | //Console.WriteLine(" .. " + info.RegionHandle); |
250 | if (info.RegionHandle == regionHandle) return info; | 250 | if (info.RegionHandle == regionHandle) return info; |
251 | } | 251 | } |
252 | 252 | ||
253 | foreach (RegionInfo info in m_knownRegions.Values) | 253 | foreach (RegionInfo info in m_knownRegions.Values) |
254 | { | 254 | { |
255 | if (info.RegionHandle == regionHandle) | 255 | if (info.RegionHandle == regionHandle) |
256 | { | 256 | { |
257 | //Console.WriteLine("XXX------ Found known region " + info.RegionHandle); | 257 | //Console.WriteLine("XXX------ Found known region " + info.RegionHandle); |
258 | return info; | 258 | return info; |
259 | } | 259 | } |
260 | } | 260 | } |
261 | 261 | ||
262 | return null; | 262 | return null; |
263 | } | 263 | } |
264 | 264 | ||
265 | public virtual RegionInfo RequestClosestRegion(string regionName) | 265 | public virtual RegionInfo RequestClosestRegion(string regionName) |
266 | { | 266 | { |
267 | foreach (RegionInfo info in m_hyperlinkRegions) | 267 | foreach (RegionInfo info in m_hyperlinkRegions) |
268 | { | 268 | { |
269 | if (info.RegionName == regionName) return info; | 269 | if (info.RegionName == regionName) return info; |
270 | } | 270 | } |
271 | 271 | ||
272 | return null; | 272 | return null; |
273 | } | 273 | } |
274 | 274 | ||
275 | /// <summary> | 275 | /// <summary> |
276 | /// | 276 | /// |
277 | /// </summary> | 277 | /// </summary> |
278 | /// <param name="minX"></param> | 278 | /// <param name="minX"></param> |
279 | /// <param name="minY"></param> | 279 | /// <param name="minY"></param> |
280 | /// <param name="maxX"></param> | 280 | /// <param name="maxX"></param> |
281 | /// <param name="maxY"></param> | 281 | /// <param name="maxY"></param> |
282 | /// <returns></returns> | 282 | /// <returns></returns> |
283 | public virtual List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) | 283 | public virtual List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) |
284 | { | 284 | { |
285 | List<MapBlockData> neighbours = new List<MapBlockData>(); | 285 | List<MapBlockData> neighbours = new List<MapBlockData>(); |
286 | 286 | ||
287 | foreach (RegionInfo regInfo in m_hyperlinkRegions) | 287 | foreach (RegionInfo regInfo in m_hyperlinkRegions) |
288 | { | 288 | { |
289 | if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && | 289 | if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && |
290 | ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) | 290 | ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) |
291 | { | 291 | { |
292 | MapBlockData map = new MapBlockData(); | 292 | MapBlockData map = new MapBlockData(); |
293 | map.Name = regInfo.RegionName; | 293 | map.Name = regInfo.RegionName; |
294 | map.X = (ushort)regInfo.RegionLocX; | 294 | map.X = (ushort)regInfo.RegionLocX; |
295 | map.Y = (ushort)regInfo.RegionLocY; | 295 | map.Y = (ushort)regInfo.RegionLocY; |
296 | map.WaterHeight = (byte)regInfo.RegionSettings.WaterHeight; | 296 | map.WaterHeight = (byte)regInfo.RegionSettings.WaterHeight; |
297 | map.MapImageId = regInfo.RegionSettings.TerrainImageID; | 297 | map.MapImageId = regInfo.RegionSettings.TerrainImageID; |
298 | // Console.WriteLine("ImgID: " + map.MapImageId); | 298 | // Console.WriteLine("ImgID: " + map.MapImageId); |
299 | map.Agents = 1; | 299 | map.Agents = 1; |
300 | map.RegionFlags = 72458694; | 300 | map.RegionFlags = 72458694; |
301 | map.Access = 13; | 301 | map.Access = 13; |
302 | neighbours.Add(map); | 302 | neighbours.Add(map); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | return neighbours; | 306 | return neighbours; |
307 | } | 307 | } |
308 | 308 | ||
309 | 309 | ||
310 | protected virtual void GetMapImage(RegionInfo info) | 310 | protected virtual void GetMapImage(RegionInfo info) |
311 | { | 311 | { |
312 | try | 312 | try |
313 | { | 313 | { |
314 | string regionimage = "regionImage" + info.RegionID.ToString(); | 314 | string regionimage = "regionImage" + info.RegionID.ToString(); |
315 | regionimage = regionimage.Replace("-", ""); | 315 | regionimage = regionimage.Replace("-", ""); |
316 | 316 | ||
317 | WebClient c = new WebClient(); | 317 | WebClient c = new WebClient(); |
318 | string uri = "http://" + info.ExternalHostName + ":" + info.HttpPort + "/index.php?method=" + regionimage; | 318 | string uri = "http://" + info.ExternalHostName + ":" + info.HttpPort + "/index.php?method=" + regionimage; |
319 | //Console.WriteLine("JPEG: " + uri); | 319 | //Console.WriteLine("JPEG: " + uri); |
320 | c.DownloadFile(uri, info.RegionID.ToString() + ".jpg"); | 320 | c.DownloadFile(uri, info.RegionID.ToString() + ".jpg"); |
321 | Bitmap m = new Bitmap(info.RegionID.ToString() + ".jpg"); | 321 | Bitmap m = new Bitmap(info.RegionID.ToString() + ".jpg"); |
322 | //Console.WriteLine("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); | 322 | //Console.WriteLine("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); |
323 | byte[] imageData = OpenJPEG.EncodeFromImage(m, true); | 323 | byte[] imageData = OpenJPEG.EncodeFromImage(m, true); |
324 | AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString()); | 324 | AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString()); |
325 | info.RegionSettings.TerrainImageID = ass.FullID; | 325 | info.RegionSettings.TerrainImageID = ass.FullID; |
326 | ass.Type = (int)AssetType.Texture; | 326 | ass.Type = (int)AssetType.Texture; |
327 | ass.Temporary = false; | 327 | ass.Temporary = false; |
328 | //imageData.CopyTo(ass.Data, 0); | 328 | //imageData.CopyTo(ass.Data, 0); |
329 | ass.Data = imageData; | 329 | ass.Data = imageData; |
330 | m_assetcache.AddAsset(ass); | 330 | m_assetcache.AddAsset(ass); |
331 | 331 | ||
332 | } | 332 | } |
333 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke | 333 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke |
334 | { | 334 | { |
335 | Console.WriteLine("Failed getting/storing map image: " + e); | 335 | Console.WriteLine("Failed getting/storing map image: " + e); |
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | // A little ugly, since this code is exactly the same as OSG1's, and we're already | 339 | // A little ugly, since this code is exactly the same as OSG1's, and we're already |
340 | // calling that for when the region in in grid mode... (for the grid regions) | 340 | // calling that for when the region in in grid mode... (for the grid regions) |
341 | // | 341 | // |
342 | public virtual LandData RequestLandData (ulong regionHandle, uint x, uint y) | 342 | public virtual LandData RequestLandData (ulong regionHandle, uint x, uint y) |
343 | { | 343 | { |
344 | m_log.DebugFormat("[HGrid]: requests land data in {0}, at {1}, {2}", | 344 | m_log.DebugFormat("[HGrid]: requests land data in {0}, at {1}, {2}", |
345 | regionHandle, x, y); | 345 | regionHandle, x, y); |
346 | 346 | ||
347 | // Remote region | 347 | // Remote region |
348 | 348 | ||
349 | Hashtable hash = new Hashtable(); | 349 | Hashtable hash = new Hashtable(); |
350 | hash["region_handle"] = regionHandle.ToString(); | 350 | hash["region_handle"] = regionHandle.ToString(); |
351 | hash["x"] = x.ToString(); | 351 | hash["x"] = x.ToString(); |
352 | hash["y"] = y.ToString(); | 352 | hash["y"] = y.ToString(); |
353 | 353 | ||
354 | IList paramList = new ArrayList(); | 354 | IList paramList = new ArrayList(); |
355 | paramList.Add(hash); | 355 | paramList.Add(hash); |
356 | LandData landData = null; | 356 | LandData landData = null; |
357 | 357 | ||
358 | try | 358 | try |
359 | { | 359 | { |
360 | RegionInfo info = RequestNeighbourInfo(regionHandle); | 360 | RegionInfo info = RequestNeighbourInfo(regionHandle); |
361 | if (info != null) // just to be sure | 361 | if (info != null) // just to be sure |
362 | { | 362 | { |
363 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); | 363 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); |
364 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; | 364 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; |
365 | XmlRpcResponse response = request.Send(uri, 10000); | 365 | XmlRpcResponse response = request.Send(uri, 10000); |
366 | if (response.IsFault) | 366 | if (response.IsFault) |
367 | { | 367 | { |
368 | m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); | 368 | m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); |
369 | } | 369 | } |
370 | else | 370 | else |
371 | { | 371 | { |
372 | hash = (Hashtable)response.Value; | 372 | hash = (Hashtable)response.Value; |
373 | try | 373 | try |
374 | { | 374 | { |
375 | landData = new LandData(); | 375 | landData = new LandData(); |
376 | landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]); | 376 | landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]); |
377 | landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]); | 377 | landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]); |
378 | landData.Area = Convert.ToInt32(hash["Area"]); | 378 | landData.Area = Convert.ToInt32(hash["Area"]); |
379 | landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]); | 379 | landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]); |
380 | landData.Description = (string)hash["Description"]; | 380 | landData.Description = (string)hash["Description"]; |
381 | landData.Flags = Convert.ToUInt32(hash["Flags"]); | 381 | landData.Flags = Convert.ToUInt32(hash["Flags"]); |
382 | landData.GlobalID = new UUID((string)hash["GlobalID"]); | 382 | landData.GlobalID = new UUID((string)hash["GlobalID"]); |
383 | landData.Name = (string)hash["Name"]; | 383 | landData.Name = (string)hash["Name"]; |
384 | landData.OwnerID = new UUID((string)hash["OwnerID"]); | 384 | landData.OwnerID = new UUID((string)hash["OwnerID"]); |
385 | landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); | 385 | landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); |
386 | landData.SnapshotID = new UUID((string)hash["SnapshotID"]); | 386 | landData.SnapshotID = new UUID((string)hash["SnapshotID"]); |
387 | landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); | 387 | landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); |
388 | m_log.DebugFormat("[HGrid]: Got land data for parcel {0}", landData.Name); | 388 | m_log.DebugFormat("[HGrid]: Got land data for parcel {0}", landData.Name); |
389 | } | 389 | } |
390 | catch (Exception e) | 390 | catch (Exception e) |
391 | { | 391 | { |
392 | m_log.Error("[HGrid]: Got exception while parsing land-data:", e); | 392 | m_log.Error("[HGrid]: Got exception while parsing land-data:", e); |
393 | } | 393 | } |
394 | } | 394 | } |
395 | } | 395 | } |
396 | else m_log.WarnFormat("[HGrid]: Couldn't find region with handle {0}", regionHandle); | 396 | else m_log.WarnFormat("[HGrid]: Couldn't find region with handle {0}", regionHandle); |
397 | } | 397 | } |
398 | catch (Exception e) | 398 | catch (Exception e) |
399 | { | 399 | { |
400 | m_log.ErrorFormat("[HGrid]: Couldn't contact region {0}: {1}", regionHandle, e); | 400 | m_log.ErrorFormat("[HGrid]: Couldn't contact region {0}: {1}", regionHandle, e); |
401 | } | 401 | } |
402 | 402 | ||
403 | return landData; | 403 | return landData; |
404 | } | 404 | } |
405 | 405 | ||
406 | // Grid Request Processing | 406 | // Grid Request Processing |
407 | public virtual List<RegionInfo> RequestNamedRegions (string name, int maxNumber) | 407 | public virtual List<RegionInfo> RequestNamedRegions (string name, int maxNumber) |
408 | { | 408 | { |
409 | List<RegionInfo> infos = new List<RegionInfo>(); | 409 | List<RegionInfo> infos = new List<RegionInfo>(); |
410 | foreach (RegionInfo info in m_hyperlinkRegions) | 410 | foreach (RegionInfo info in m_hyperlinkRegions) |
411 | { | 411 | { |
412 | if (info.RegionName.ToLower().Contains(name)) | 412 | if (info.RegionName.ToLower().Contains(name)) |
413 | { | 413 | { |
414 | infos.Add(info); | 414 | infos.Add(info); |
415 | } | 415 | } |
416 | } | 416 | } |
417 | return infos; | 417 | return infos; |
418 | } | 418 | } |
419 | 419 | ||
420 | 420 | ||
421 | private UUID LinkRegion(RegionInfo info) | 421 | private UUID LinkRegion(RegionInfo info) |
422 | { | 422 | { |
423 | UUID uuid = UUID.Zero; | 423 | UUID uuid = UUID.Zero; |
424 | 424 | ||
425 | Hashtable hash = new Hashtable(); | 425 | Hashtable hash = new Hashtable(); |
426 | hash["region_name"] = info.RegionName; | 426 | hash["region_name"] = info.RegionName; |
427 | 427 | ||
428 | IList paramList = new ArrayList(); | 428 | IList paramList = new ArrayList(); |
429 | paramList.Add(hash); | 429 | paramList.Add(hash); |
430 | 430 | ||
431 | XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); | 431 | XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); |
432 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; | 432 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; |
433 | m_log.Debug("[HGrid]: Linking to " + uri); | 433 | m_log.Debug("[HGrid]: Linking to " + uri); |
434 | XmlRpcResponse response = request.Send(uri, 10000); | 434 | XmlRpcResponse response = request.Send(uri, 10000); |
435 | if (response.IsFault) | 435 | if (response.IsFault) |
436 | { | 436 | { |
437 | m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); | 437 | m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); |
438 | } | 438 | } |
439 | else | 439 | else |
440 | { | 440 | { |
441 | hash = (Hashtable)response.Value; | 441 | hash = (Hashtable)response.Value; |
442 | //foreach (Object o in hash) | 442 | //foreach (Object o in hash) |
443 | // Console.WriteLine(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | 443 | // Console.WriteLine(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); |
444 | try | 444 | try |
445 | { | 445 | { |
446 | UUID.TryParse((string)hash["uuid"], out uuid); | 446 | UUID.TryParse((string)hash["uuid"], out uuid); |
447 | info.RegionID = uuid; | 447 | info.RegionID = uuid; |
448 | if ((string)hash["handle"] != null) | 448 | if ((string)hash["handle"] != null) |
449 | { | 449 | { |
450 | info.regionSecret = (string)hash["handle"]; | 450 | info.regionSecret = (string)hash["handle"]; |
451 | //Console.WriteLine(">> HERE: " + info.regionSecret); | 451 | //Console.WriteLine(">> HERE: " + info.regionSecret); |
452 | } | 452 | } |
453 | if (hash["region_image"] != null) | 453 | if (hash["region_image"] != null) |
454 | { | 454 | { |
455 | UUID img = UUID.Zero; | 455 | UUID img = UUID.Zero; |
456 | UUID.TryParse((string)hash["region_image"], out img); | 456 | UUID.TryParse((string)hash["region_image"], out img); |
457 | info.RegionSettings.TerrainImageID = img; | 457 | info.RegionSettings.TerrainImageID = img; |
458 | } | 458 | } |
459 | if (hash["region_name"] != null) | 459 | if (hash["region_name"] != null) |
460 | { | 460 | { |
461 | info.RegionName = (string)hash["region_name"]; | 461 | info.RegionName = (string)hash["region_name"]; |
462 | } | 462 | } |
463 | if (hash["internal_port"] != null) | 463 | if (hash["internal_port"] != null) |
464 | { | 464 | { |
465 | int port = Convert.ToInt32((string)hash["internal_port"]); | 465 | int port = Convert.ToInt32((string)hash["internal_port"]); |
466 | info.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); | 466 | info.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); |
467 | //Console.WriteLine(">> " + info.InternalEndPoint.ToString()); | 467 | //Console.WriteLine(">> " + info.InternalEndPoint.ToString()); |
468 | } | 468 | } |
469 | if (hash["remoting_port"] != null) | 469 | if (hash["remoting_port"] != null) |
470 | { | 470 | { |
471 | info.RemotingPort = Convert.ToUInt32(hash["remoting_port"]); | 471 | info.RemotingPort = Convert.ToUInt32(hash["remoting_port"]); |
472 | //Console.WriteLine(">> " + info.RemotingPort); | 472 | //Console.WriteLine(">> " + info.RemotingPort); |
473 | } | 473 | } |
474 | 474 | ||
475 | } | 475 | } |
476 | catch (Exception e) | 476 | catch (Exception e) |
477 | { | 477 | { |
478 | m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace); | 478 | m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace); |
479 | } | 479 | } |
480 | } | 480 | } |
481 | return uuid; | 481 | return uuid; |
482 | } | 482 | } |
483 | 483 | ||
484 | /// <summary> | 484 | /// <summary> |
485 | /// Someone wants to link to us | 485 | /// Someone wants to link to us |
486 | /// </summary> | 486 | /// </summary> |
487 | /// <param name="request"></param> | 487 | /// <param name="request"></param> |
488 | /// <returns></returns> | 488 | /// <returns></returns> |
489 | public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request) | 489 | public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request) |
490 | { | 490 | { |
491 | Hashtable requestData = (Hashtable)request.Params[0]; | 491 | Hashtable requestData = (Hashtable)request.Params[0]; |
492 | //string host = (string)requestData["host"]; | 492 | //string host = (string)requestData["host"]; |
493 | //string portstr = (string)requestData["port"]; | 493 | //string portstr = (string)requestData["port"]; |
494 | string name = (string)requestData["region_name"]; | 494 | string name = (string)requestData["region_name"]; |
495 | 495 | ||
496 | m_log.DebugFormat("[HGrid]: Hyperlink request"); | 496 | m_log.DebugFormat("[HGrid]: Hyperlink request"); |
497 | 497 | ||
498 | 498 | ||
499 | RegionInfo regInfo = null; | 499 | RegionInfo regInfo = null; |
500 | foreach (RegionInfo r in m_regionsOnInstance) | 500 | foreach (RegionInfo r in m_regionsOnInstance) |
501 | { | 501 | { |
502 | if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower())) | 502 | if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower())) |
503 | { | 503 | { |
504 | regInfo = r; | 504 | regInfo = r; |
505 | break; | 505 | break; |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | if (regInfo == null) | 509 | if (regInfo == null) |
510 | regInfo = m_regionsOnInstance[0]; // Send out the first region | 510 | regInfo = m_regionsOnInstance[0]; // Send out the first region |
511 | 511 | ||
512 | Hashtable hash = new Hashtable(); | 512 | Hashtable hash = new Hashtable(); |
513 | hash["uuid"] = regInfo.RegionID.ToString(); | 513 | hash["uuid"] = regInfo.RegionID.ToString(); |
514 | hash["handle"] = regInfo.RegionHandle.ToString(); | 514 | hash["handle"] = regInfo.RegionHandle.ToString(); |
515 | //Console.WriteLine(">> Here " + regInfo.RegionHandle); | 515 | //Console.WriteLine(">> Here " + regInfo.RegionHandle); |
516 | hash["region_image"] = regInfo.RegionSettings.TerrainImageID.ToString(); | 516 | hash["region_image"] = regInfo.RegionSettings.TerrainImageID.ToString(); |
517 | hash["region_name"] = regInfo.RegionName; | 517 | hash["region_name"] = regInfo.RegionName; |
518 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | 518 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); |
519 | hash["remoting_port"] = NetworkServersInfo.RemotingListenerPort.ToString(); | 519 | hash["remoting_port"] = NetworkServersInfo.RemotingListenerPort.ToString(); |
520 | //Console.WriteLine(">> Here: " + regInfo.InternalEndPoint.Port); | 520 | //Console.WriteLine(">> Here: " + regInfo.InternalEndPoint.Port); |
521 | 521 | ||
522 | 522 | ||
523 | XmlRpcResponse response = new XmlRpcResponse(); | 523 | XmlRpcResponse response = new XmlRpcResponse(); |
524 | response.Value = hash; | 524 | response.Value = hash; |
525 | return response; | 525 | return response; |
526 | } | 526 | } |
527 | 527 | ||
528 | public bool InformRegionOfUser(RegionInfo regInfo, AgentCircuitData agentData) | 528 | public bool InformRegionOfUser(RegionInfo regInfo, AgentCircuitData agentData) |
529 | { | 529 | { |
530 | //ulong regionHandle = regInfo.RegionHandle; | 530 | //ulong regionHandle = regInfo.RegionHandle; |
531 | try | 531 | try |
532 | { | 532 | { |
533 | //regionHandle = Convert.ToUInt64(regInfo.regionSecret); | 533 | //regionHandle = Convert.ToUInt64(regInfo.regionSecret); |
534 | m_log.Info("[HGrid]: InformRegionOfUser: Remote hyperlinked region " + regInfo.regionSecret); | 534 | m_log.Info("[HGrid]: InformRegionOfUser: Remote hyperlinked region " + regInfo.regionSecret); |
535 | } | 535 | } |
536 | catch | 536 | catch |
537 | { | 537 | { |
538 | m_log.Info("[HGrid]: InformRegionOfUser: Local grid region " + regInfo.regionSecret); | 538 | m_log.Info("[HGrid]: InformRegionOfUser: Local grid region " + regInfo.regionSecret); |
539 | } | 539 | } |
540 | 540 | ||
541 | string capsPath = agentData.CapsPath; | 541 | string capsPath = agentData.CapsPath; |
542 | Hashtable loginParams = new Hashtable(); | 542 | Hashtable loginParams = new Hashtable(); |
543 | loginParams["session_id"] = agentData.SessionID.ToString(); | 543 | loginParams["session_id"] = agentData.SessionID.ToString(); |
544 | loginParams["secure_session_id"] = agentData.SecureSessionID.ToString(); | 544 | loginParams["secure_session_id"] = agentData.SecureSessionID.ToString(); |
545 | 545 | ||
546 | loginParams["firstname"] = agentData.firstname; | 546 | loginParams["firstname"] = agentData.firstname; |
547 | loginParams["lastname"] = agentData.lastname; | 547 | loginParams["lastname"] = agentData.lastname; |
548 | 548 | ||
549 | loginParams["agent_id"] = agentData.AgentID.ToString(); | 549 | loginParams["agent_id"] = agentData.AgentID.ToString(); |
550 | loginParams["circuit_code"] = agentData.circuitcode.ToString(); | 550 | loginParams["circuit_code"] = agentData.circuitcode.ToString(); |
551 | loginParams["startpos_x"] = agentData.startpos.X.ToString(); | 551 | loginParams["startpos_x"] = agentData.startpos.X.ToString(); |
552 | loginParams["startpos_y"] = agentData.startpos.Y.ToString(); | 552 | loginParams["startpos_y"] = agentData.startpos.Y.ToString(); |
553 | loginParams["startpos_z"] = agentData.startpos.Z.ToString(); | 553 | loginParams["startpos_z"] = agentData.startpos.Z.ToString(); |
554 | loginParams["caps_path"] = capsPath; | 554 | loginParams["caps_path"] = capsPath; |
555 | 555 | ||
556 | CachedUserInfo u = m_userProfileCache.GetUserDetails(agentData.AgentID); | 556 | CachedUserInfo u = m_userProfileCache.GetUserDetails(agentData.AgentID); |
557 | if (u != null && u.UserProfile != null) | 557 | if (u != null && u.UserProfile != null) |
558 | { | 558 | { |
559 | loginParams["region_uuid"] = u.UserProfile.HomeRegionID.ToString(); // This seems to be always Zero | 559 | loginParams["region_uuid"] = u.UserProfile.HomeRegionID.ToString(); // This seems to be always Zero |
560 | //Console.WriteLine(" --------- Home Region UUID -------"); | 560 | //Console.WriteLine(" --------- Home Region UUID -------"); |
561 | //Console.WriteLine(" >> " + loginParams["region_uuid"] + " <<"); | 561 | //Console.WriteLine(" >> " + loginParams["region_uuid"] + " <<"); |
562 | //Console.WriteLine(" --------- ---------------- -------"); | 562 | //Console.WriteLine(" --------- ---------------- -------"); |
563 | 563 | ||
564 | string serverURI = ""; | 564 | string serverURI = ""; |
565 | if (u.UserProfile is ForeignUserProfileData) | 565 | if (u.UserProfile is ForeignUserProfileData) |
566 | serverURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)u.UserProfile).UserServerURI); | 566 | serverURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)u.UserProfile).UserServerURI); |
567 | loginParams["userserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalUserServerURI : serverURI; | 567 | loginParams["userserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalUserServerURI : serverURI; |
568 | 568 | ||
569 | serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserAssetURI); | 569 | serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserAssetURI); |
570 | loginParams["assetserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalAssetServerURI : serverURI; | 570 | loginParams["assetserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalAssetServerURI : serverURI; |
571 | 571 | ||
572 | serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserInventoryURI); | 572 | serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserInventoryURI); |
573 | loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI; | 573 | loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI; |
574 | 574 | ||
575 | loginParams["root_folder_id"] = u.UserProfile.RootInventoryFolderID; | 575 | loginParams["root_folder_id"] = u.UserProfile.RootInventoryFolderID; |
576 | 576 | ||
577 | RegionInfo rinfo = RequestNeighbourInfo(u.UserProfile.HomeRegion); | 577 | RegionInfo rinfo = RequestNeighbourInfo(u.UserProfile.HomeRegion); |
578 | if (rinfo != null) | 578 | if (rinfo != null) |
579 | { | 579 | { |
580 | loginParams["internal_port"] = rinfo.InternalEndPoint.Port.ToString(); | 580 | loginParams["internal_port"] = rinfo.InternalEndPoint.Port.ToString(); |
581 | if (!IsLocalUser(u)) | 581 | if (!IsLocalUser(u)) |
582 | { | 582 | { |
583 | loginParams["regionhandle"] = rinfo.regionSecret; // user.CurrentAgent.Handle.ToString(); | 583 | loginParams["regionhandle"] = rinfo.regionSecret; // user.CurrentAgent.Handle.ToString(); |
584 | //Console.WriteLine("XXX--- informregionofuser (foreign user) here handle: " + rinfo.regionSecret); | 584 | //Console.WriteLine("XXX--- informregionofuser (foreign user) here handle: " + rinfo.regionSecret); |
585 | 585 | ||
586 | loginParams["home_address"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeAddress; | 586 | loginParams["home_address"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeAddress; |
587 | loginParams["home_port"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomePort; | 587 | loginParams["home_port"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomePort; |
588 | loginParams["home_remoting"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeRemotingPort; | 588 | loginParams["home_remoting"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeRemotingPort; |
589 | } | 589 | } |
590 | else | 590 | else |
591 | { | 591 | { |
592 | //Console.WriteLine("XXX--- informregionofuser (local user) here handle: " + rinfo.regionSecret); | 592 | //Console.WriteLine("XXX--- informregionofuser (local user) here handle: " + rinfo.regionSecret); |
593 | 593 | ||
594 | //// local user about to jump out, let's process the name | 594 | //// local user about to jump out, let's process the name |
595 | // On second thoughts, let's not do this for the *user*; let's only do it for the *agent* | 595 | // On second thoughts, let's not do this for the *user*; let's only do it for the *agent* |
596 | //loginParams["firstname"] = agentData.firstname + "." + agentData.lastname; | 596 | //loginParams["firstname"] = agentData.firstname + "." + agentData.lastname; |
597 | //loginParams["lastname"] = serversInfo.UserURL; | 597 | //loginParams["lastname"] = serversInfo.UserURL; |
598 | 598 | ||
599 | // local user, first time out. let's ask the grid about this user's home region | 599 | // local user, first time out. let's ask the grid about this user's home region |
600 | loginParams["regionhandle"] = u.UserProfile.HomeRegion.ToString(); // user.CurrentAgent.Handle.ToString(); | 600 | loginParams["regionhandle"] = u.UserProfile.HomeRegion.ToString(); // user.CurrentAgent.Handle.ToString(); |
601 | 601 | ||
602 | loginParams["home_address"] = rinfo.ExternalHostName; | 602 | loginParams["home_address"] = rinfo.ExternalHostName; |
603 | Console.WriteLine(" --------- Home Address -------"); | 603 | Console.WriteLine(" --------- Home Address -------"); |
604 | Console.WriteLine(" >> " + loginParams["home_address"] + " <<"); | 604 | Console.WriteLine(" >> " + loginParams["home_address"] + " <<"); |
605 | Console.WriteLine(" --------- ------------ -------"); | 605 | Console.WriteLine(" --------- ------------ -------"); |
606 | loginParams["home_port"] = rinfo.HttpPort.ToString(); | 606 | loginParams["home_port"] = rinfo.HttpPort.ToString(); |
607 | loginParams["home_remoting"] = NetworkServersInfo.RemotingListenerPort.ToString(); ; | 607 | loginParams["home_remoting"] = NetworkServersInfo.RemotingListenerPort.ToString(); ; |
608 | } | 608 | } |
609 | } | 609 | } |
610 | else | 610 | else |
611 | { | 611 | { |
612 | m_log.Warn("[HGrid]: User's home region info not found: " + u.UserProfile.HomeRegionX + ", " + u.UserProfile.HomeRegionY); | 612 | m_log.Warn("[HGrid]: User's home region info not found: " + u.UserProfile.HomeRegionX + ", " + u.UserProfile.HomeRegionY); |
613 | } | 613 | } |
614 | } | 614 | } |
615 | 615 | ||
616 | ArrayList SendParams = new ArrayList(); | 616 | ArrayList SendParams = new ArrayList(); |
617 | SendParams.Add(loginParams); | 617 | SendParams.Add(loginParams); |
618 | 618 | ||
619 | // Send | 619 | // Send |
620 | string uri = "http://" + regInfo.ExternalHostName + ":" + regInfo.HttpPort + "/"; | 620 | string uri = "http://" + regInfo.ExternalHostName + ":" + regInfo.HttpPort + "/"; |
621 | //Console.WriteLine("XXX uri: " + uri); | 621 | //Console.WriteLine("XXX uri: " + uri); |
622 | XmlRpcRequest request = new XmlRpcRequest("expect_hg_user", SendParams); | 622 | XmlRpcRequest request = new XmlRpcRequest("expect_hg_user", SendParams); |
623 | XmlRpcResponse reply = request.Send(uri, 6000); | 623 | XmlRpcResponse reply = request.Send(uri, 6000); |
624 | 624 | ||
625 | if (!reply.IsFault) | 625 | if (!reply.IsFault) |
626 | { | 626 | { |
627 | bool responseSuccess = true; | 627 | bool responseSuccess = true; |
628 | if (reply.Value != null) | 628 | if (reply.Value != null) |
629 | { | 629 | { |
630 | Hashtable resp = (Hashtable)reply.Value; | 630 | Hashtable resp = (Hashtable)reply.Value; |
631 | if (resp.ContainsKey("success")) | 631 | if (resp.ContainsKey("success")) |
632 | { | 632 | { |
633 | if ((string)resp["success"] == "FALSE") | 633 | if ((string)resp["success"] == "FALSE") |
634 | { | 634 | { |
635 | responseSuccess = false; | 635 | responseSuccess = false; |
636 | } | 636 | } |
637 | } | 637 | } |
638 | } | 638 | } |
639 | if (responseSuccess) | 639 | if (responseSuccess) |
640 | { | 640 | { |
641 | m_log.Info("[HGrid]: Successfully informed remote region about user " + agentData.AgentID); | 641 | m_log.Info("[HGrid]: Successfully informed remote region about user " + agentData.AgentID); |
642 | return true; | 642 | return true; |
643 | } | 643 | } |
644 | else | 644 | else |
645 | { | 645 | { |
646 | m_log.ErrorFormat("[HGrid]: Region responded that it is not available to receive clients"); | 646 | m_log.ErrorFormat("[HGrid]: Region responded that it is not available to receive clients"); |
647 | return false; | 647 | return false; |
648 | } | 648 | } |
649 | } | 649 | } |
650 | else | 650 | else |
651 | { | 651 | { |
652 | m_log.ErrorFormat("[HGrid]: XmlRpc request to region failed with message {0}, code {1} ", reply.FaultString, reply.FaultCode); | 652 | m_log.ErrorFormat("[HGrid]: XmlRpc request to region failed with message {0}, code {1} ", reply.FaultString, reply.FaultCode); |
653 | return false; | 653 | return false; |
654 | } | 654 | } |
655 | } | 655 | } |
656 | 656 | ||
657 | 657 | ||
658 | /// <summary> | 658 | /// <summary> |
659 | /// Received from other HGrid nodes when a user wants to teleport here. This call allows | 659 | /// Received from other HGrid nodes when a user wants to teleport here. This call allows |
660 | /// the region to prepare for direct communication from the client. Sends back an empty | 660 | /// the region to prepare for direct communication from the client. Sends back an empty |
661 | /// xmlrpc response on completion. | 661 | /// xmlrpc response on completion. |
662 | /// This is somewhat similar to OGS1's ExpectUser, but with the additional task of | 662 | /// This is somewhat similar to OGS1's ExpectUser, but with the additional task of |
663 | /// registering the user in the local user cache. | 663 | /// registering the user in the local user cache. |
664 | /// </summary> | 664 | /// </summary> |
665 | /// <param name="request"></param> | 665 | /// <param name="request"></param> |
666 | /// <returns></returns> | 666 | /// <returns></returns> |
667 | public XmlRpcResponse ExpectHGUser(XmlRpcRequest request) | 667 | public XmlRpcResponse ExpectHGUser(XmlRpcRequest request) |
668 | { | 668 | { |
669 | Hashtable requestData = (Hashtable)request.Params[0]; | 669 | Hashtable requestData = (Hashtable)request.Params[0]; |
670 | ForeignUserProfileData userData = new ForeignUserProfileData(); | 670 | ForeignUserProfileData userData = new ForeignUserProfileData(); |
671 | 671 | ||
672 | userData.FirstName = (string)requestData["firstname"]; | 672 | userData.FirstName = (string)requestData["firstname"]; |
673 | userData.SurName = (string)requestData["lastname"]; | 673 | userData.SurName = (string)requestData["lastname"]; |
674 | userData.ID = new UUID((string)requestData["agent_id"]); | 674 | userData.ID = new UUID((string)requestData["agent_id"]); |
675 | userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), | 675 | userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), |
676 | (float)Convert.ToDecimal((string)requestData["startpos_y"]), | 676 | (float)Convert.ToDecimal((string)requestData["startpos_y"]), |
677 | (float)Convert.ToDecimal((string)requestData["startpos_z"])); | 677 | (float)Convert.ToDecimal((string)requestData["startpos_z"])); |
678 | 678 | ||
679 | userData.UserServerURI = (string)requestData["userserver_id"]; | 679 | userData.UserServerURI = (string)requestData["userserver_id"]; |
680 | userData.UserAssetURI = (string)requestData["assetserver_id"]; | 680 | userData.UserAssetURI = (string)requestData["assetserver_id"]; |
681 | userData.UserInventoryURI = (string)requestData["inventoryserver_id"]; | 681 | userData.UserInventoryURI = (string)requestData["inventoryserver_id"]; |
682 | 682 | ||
683 | UUID rootID = UUID.Zero; | 683 | UUID rootID = UUID.Zero; |
684 | UUID.TryParse((string)requestData["root_folder_id"], out rootID); | 684 | UUID.TryParse((string)requestData["root_folder_id"], out rootID); |
685 | userData.RootInventoryFolderID = rootID; | 685 | userData.RootInventoryFolderID = rootID; |
686 | 686 | ||
687 | UUID uuid = UUID.Zero; | 687 | UUID uuid = UUID.Zero; |
688 | UUID.TryParse((string)requestData["region_uuid"], out uuid); | 688 | UUID.TryParse((string)requestData["region_uuid"], out uuid); |
689 | userData.HomeRegionID = uuid; // not quite comfortable about this... | 689 | userData.HomeRegionID = uuid; // not quite comfortable about this... |
690 | ulong userRegionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | 690 | ulong userRegionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); |
691 | //userData.HomeRegion = userRegionHandle; | 691 | //userData.HomeRegion = userRegionHandle; |
692 | userData.UserHomeAddress = (string)requestData["home_address"]; | 692 | userData.UserHomeAddress = (string)requestData["home_address"]; |
693 | userData.UserHomePort = (string)requestData["home_port"]; | 693 | userData.UserHomePort = (string)requestData["home_port"]; |
694 | int userhomeinternalport = Convert.ToInt32((string)requestData["internal_port"]); | 694 | int userhomeinternalport = Convert.ToInt32((string)requestData["internal_port"]); |
695 | userData.UserHomeRemotingPort = (string)requestData["home_remoting"]; | 695 | userData.UserHomeRemotingPort = (string)requestData["home_remoting"]; |
696 | 696 | ||
697 | 697 | ||
698 | m_log.DebugFormat("[HGrid]: Told by user service to prepare for a connection from {0} {1} {2}", | 698 | m_log.DebugFormat("[HGrid]: Told by user service to prepare for a connection from {0} {1} {2}", |
699 | userData.FirstName, userData.SurName, userData.ID); | 699 | userData.FirstName, userData.SurName, userData.ID); |
700 | m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress + | 700 | m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress + |
701 | "; home_port: " + userData.UserHomePort + "; remoting: " + userData.UserHomeRemotingPort); | 701 | "; home_port: " + userData.UserHomePort + "; remoting: " + userData.UserHomeRemotingPort); |
702 | 702 | ||
703 | 703 | ||
704 | XmlRpcResponse resp = new XmlRpcResponse(); | 704 | XmlRpcResponse resp = new XmlRpcResponse(); |
705 | 705 | ||
706 | if (!RegionLoginsEnabled) | 706 | if (!RegionLoginsEnabled) |
707 | { | 707 | { |
708 | m_log.InfoFormat( | 708 | m_log.InfoFormat( |
709 | "[HGrid]: Denying access for user {0} {1} because region login is currently disabled", | 709 | "[HGrid]: Denying access for user {0} {1} because region login is currently disabled", |
710 | userData.FirstName, userData.SurName); | 710 | userData.FirstName, userData.SurName); |
711 | 711 | ||
712 | Hashtable respdata = new Hashtable(); | 712 | Hashtable respdata = new Hashtable(); |
713 | respdata["success"] = "FALSE"; | 713 | respdata["success"] = "FALSE"; |
714 | respdata["reason"] = "region login currently disabled"; | 714 | respdata["reason"] = "region login currently disabled"; |
715 | resp.Value = respdata; | 715 | resp.Value = respdata; |
716 | } | 716 | } |
717 | else | 717 | else |
718 | { | 718 | { |
719 | RegionInfo[] regions = m_regionsOnInstance.ToArray(); | 719 | RegionInfo[] regions = m_regionsOnInstance.ToArray(); |
720 | //bool banned = false; | 720 | //bool banned = false; |
721 | // Just check one region. We assume they all belong to the same estate. | 721 | // Just check one region. We assume they all belong to the same estate. |
722 | if ((regions.Length > 0) && (regions[0].EstateSettings.IsBanned(userData.ID))) | 722 | if ((regions.Length > 0) && (regions[0].EstateSettings.IsBanned(userData.ID))) |
723 | { | 723 | { |
724 | m_log.InfoFormat( | 724 | m_log.InfoFormat( |
725 | "[HGrid]: Denying access for user {0} {1} because user is banned", | 725 | "[HGrid]: Denying access for user {0} {1} because user is banned", |
726 | userData.FirstName, userData.SurName); | 726 | userData.FirstName, userData.SurName); |
727 | 727 | ||
728 | Hashtable respdata = new Hashtable(); | 728 | Hashtable respdata = new Hashtable(); |
729 | respdata["success"] = "FALSE"; | 729 | respdata["success"] = "FALSE"; |
730 | respdata["reason"] = "banned"; | 730 | respdata["reason"] = "banned"; |
731 | resp.Value = respdata; | 731 | resp.Value = respdata; |
732 | } | 732 | } |
733 | else | 733 | else |
734 | { | 734 | { |
735 | // Finally, everything looks ok | 735 | // Finally, everything looks ok |
736 | //Console.WriteLine("XXX---- EVERYTHING OK ---XXX"); | 736 | //Console.WriteLine("XXX---- EVERYTHING OK ---XXX"); |
737 | 737 | ||
738 | // Nope, let's do it only for the *agent* | 738 | // Nope, let's do it only for the *agent* |
739 | //// 0 - Switch name if necessary | 739 | //// 0 - Switch name if necessary |
740 | //if (IsComingHome(userData)) | 740 | //if (IsComingHome(userData)) |
741 | //{ | 741 | //{ |
742 | // string[] parts = userData.FirstName.Split( new char[] {'.'}); | 742 | // string[] parts = userData.FirstName.Split( new char[] {'.'}); |
743 | // if (parts.Length >= 1) | 743 | // if (parts.Length >= 1) |
744 | // userData.FirstName = parts[0]; | 744 | // userData.FirstName = parts[0]; |
745 | // if (parts.Length == 2) | 745 | // if (parts.Length == 2) |
746 | // userData.SurName = parts[1]; | 746 | // userData.SurName = parts[1]; |
747 | // else | 747 | // else |
748 | // m_log.Warn("[HGrid]: Something fishy with user " + userData.FirstName + userData.SurName); | 748 | // m_log.Warn("[HGrid]: Something fishy with user " + userData.FirstName + userData.SurName); |
749 | 749 | ||
750 | // m_log.Info("[HGrid]: Welcome home, " + userData.FirstName + " " + userData.SurName); | 750 | // m_log.Info("[HGrid]: Welcome home, " + userData.FirstName + " " + userData.SurName); |
751 | //} | 751 | //} |
752 | 752 | ||
753 | // 1 - Preload the user data | 753 | // 1 - Preload the user data |
754 | m_userProfileCache.PreloadUserCache(userData.ID, userData); | 754 | m_userProfileCache.PreloadUserCache(userData.ID, userData); |
755 | 755 | ||
756 | // 2 - Load the region info into list of known regions | 756 | // 2 - Load the region info into list of known regions |
757 | RegionInfo rinfo = new RegionInfo(); | 757 | RegionInfo rinfo = new RegionInfo(); |
758 | rinfo.RegionID = userData.HomeRegionID; | 758 | rinfo.RegionID = userData.HomeRegionID; |
759 | rinfo.ExternalHostName = userData.UserHomeAddress; | 759 | rinfo.ExternalHostName = userData.UserHomeAddress; |
760 | rinfo.HttpPort = Convert.ToUInt32(userData.UserHomePort); | 760 | rinfo.HttpPort = Convert.ToUInt32(userData.UserHomePort); |
761 | rinfo.RemotingPort = Convert.ToUInt32(userData.UserHomeRemotingPort); | 761 | rinfo.RemotingPort = Convert.ToUInt32(userData.UserHomeRemotingPort); |
762 | rinfo.RegionID = userData.HomeRegionID; | 762 | rinfo.RegionID = userData.HomeRegionID; |
763 | // X=0 on the map | 763 | // X=0 on the map |
764 | rinfo.RegionLocX = 0; | 764 | rinfo.RegionLocX = 0; |
765 | rinfo.RegionLocY = (uint)m_knownRegions.Count; | 765 | rinfo.RegionLocY = (uint)m_knownRegions.Count; |
766 | rinfo.regionSecret = userRegionHandle.ToString(); | 766 | rinfo.regionSecret = userRegionHandle.ToString(); |
767 | //Console.WriteLine("XXX--- Here: handle = " + rinfo.regionSecret); | 767 | //Console.WriteLine("XXX--- Here: handle = " + rinfo.regionSecret); |
768 | try | 768 | try |
769 | { | 769 | { |
770 | rinfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)userhomeinternalport); | 770 | rinfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)userhomeinternalport); |
771 | } | 771 | } |
772 | catch (Exception e) | 772 | catch (Exception e) |
773 | { | 773 | { |
774 | m_log.Warn("[HGrid]: Exception while constructing internal endpoint: " + e); | 774 | m_log.Warn("[HGrid]: Exception while constructing internal endpoint: " + e); |
775 | } | 775 | } |
776 | rinfo.RemotingAddress = rinfo.ExternalEndPoint.Address.ToString(); //userData.UserHomeAddress; | 776 | rinfo.RemotingAddress = rinfo.ExternalEndPoint.Address.ToString(); //userData.UserHomeAddress; |
777 | 777 | ||
778 | if (!IsComingHome(userData)) | 778 | if (!IsComingHome(userData)) |
779 | { | 779 | { |
780 | // Change the user's home region here!!! | 780 | // Change the user's home region here!!! |
781 | userData.HomeRegion = rinfo.RegionHandle; | 781 | userData.HomeRegion = rinfo.RegionHandle; |
782 | } | 782 | } |
783 | 783 | ||
784 | if (!m_knownRegions.ContainsKey(userData.ID)) | 784 | if (!m_knownRegions.ContainsKey(userData.ID)) |
785 | m_knownRegions.Add(userData.ID, rinfo); | 785 | m_knownRegions.Add(userData.ID, rinfo); |
786 | else | 786 | else |
787 | // just update it. The previous one was left there when the user departed | 787 | // just update it. The previous one was left there when the user departed |
788 | m_knownRegions[userData.ID] = rinfo; | 788 | m_knownRegions[userData.ID] = rinfo; |
789 | 789 | ||
790 | // 3 - Send the reply | 790 | // 3 - Send the reply |
791 | Hashtable respdata = new Hashtable(); | 791 | Hashtable respdata = new Hashtable(); |
792 | respdata["success"] = "TRUE"; | 792 | respdata["success"] = "TRUE"; |
793 | resp.Value = respdata; | 793 | resp.Value = respdata; |
794 | 794 | ||
795 | DumpUserData(userData); | 795 | DumpUserData(userData); |
796 | DumpRegionData(rinfo); | 796 | DumpRegionData(rinfo); |
797 | } | 797 | } |
798 | } | 798 | } |
799 | 799 | ||
800 | return resp; | 800 | return resp; |
801 | } | 801 | } |
802 | 802 | ||
803 | #region IInterRegionCommunications interface | 803 | #region IInterRegionCommunications interface |
804 | 804 | ||
805 | public virtual bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) { return false; } | 805 | public virtual bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) { return false; } |
806 | public virtual bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID) { return false; } | 806 | public virtual bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID) { return false; } |
807 | public virtual bool CheckRegion(string address, uint port) { return false; } | 807 | public virtual bool CheckRegion(string address, uint port) { return false; } |
808 | public virtual bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) { return false; } | 808 | public virtual bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) { return false; } |
809 | 809 | ||
810 | public virtual bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) { | 810 | public virtual bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) { |
811 | // Remote region | 811 | // Remote region |
812 | RegionInfo regInfo = null; | 812 | RegionInfo regInfo = null; |
813 | ulong remoteHandle = 0; | 813 | ulong remoteHandle = 0; |
814 | try | 814 | try |
815 | { | 815 | { |
816 | regInfo = RequestNeighbourInfo(regionHandle); | 816 | regInfo = RequestNeighbourInfo(regionHandle); |
817 | if (regInfo != null) | 817 | if (regInfo != null) |
818 | { | 818 | { |
819 | try | 819 | try |
820 | { | 820 | { |
821 | remoteHandle = Convert.ToUInt64(regInfo.regionSecret); | 821 | remoteHandle = Convert.ToUInt64(regInfo.regionSecret); |
822 | } | 822 | } |
823 | catch | 823 | catch |
824 | { | 824 | { |
825 | m_log.Warn("[HGrid]: Invalid remote region with handle " + regInfo.regionSecret); | 825 | m_log.Warn("[HGrid]: Invalid remote region with handle " + regInfo.regionSecret); |
826 | return false; | 826 | return false; |
827 | } | 827 | } |
828 | //Console.WriteLine("XXX---- Sending Expectavatarcrossing into : " + remoteHandle); | 828 | //Console.WriteLine("XXX---- Sending Expectavatarcrossing into : " + remoteHandle); |
829 | 829 | ||
830 | bool retValue = false; | 830 | bool retValue = false; |
831 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 831 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
832 | typeof(OGS1InterRegionRemoting), | 832 | typeof(OGS1InterRegionRemoting), |
833 | "tcp://" + regInfo.RemotingAddress + | 833 | "tcp://" + regInfo.RemotingAddress + |
834 | ":" + regInfo.RemotingPort + | 834 | ":" + regInfo.RemotingPort + |
835 | "/InterRegions"); | 835 | "/InterRegions"); |
836 | 836 | ||
837 | if (remObject != null) | 837 | if (remObject != null) |
838 | { | 838 | { |
839 | retValue = | 839 | retValue = |
840 | remObject.ExpectAvatarCrossing(remoteHandle, agentID.Guid, new sLLVector3(position), | 840 | remObject.ExpectAvatarCrossing(remoteHandle, agentID.Guid, new sLLVector3(position), |
841 | isFlying); | 841 | isFlying); |
842 | } | 842 | } |
843 | else | 843 | else |
844 | { | 844 | { |
845 | m_log.Warn("[HGrid]: Remoting object not found"); | 845 | m_log.Warn("[HGrid]: Remoting object not found"); |
846 | } | 846 | } |
847 | remObject = null; | 847 | remObject = null; |
848 | 848 | ||
849 | return retValue; | 849 | return retValue; |
850 | } | 850 | } |
851 | //TODO need to see if we know about where this region is and use .net remoting | 851 | //TODO need to see if we know about where this region is and use .net remoting |
852 | // to inform it. | 852 | // to inform it. |
853 | //NoteDeadRegion(regionHandle); | 853 | //NoteDeadRegion(regionHandle); |
854 | return false; | 854 | return false; |
855 | } | 855 | } |
856 | catch (RemotingException e) | 856 | catch (RemotingException e) |
857 | { | 857 | { |
858 | // NoteDeadRegion(regionHandle); | 858 | // NoteDeadRegion(regionHandle); |
859 | 859 | ||
860 | m_log.WarnFormat( | 860 | m_log.WarnFormat( |
861 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | 861 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", |
862 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 862 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
863 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 863 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
864 | 864 | ||
865 | return false; | 865 | return false; |
866 | } | 866 | } |
867 | catch | 867 | catch |
868 | { | 868 | { |
869 | // NoteDeadRegion(regionHandle); | 869 | // NoteDeadRegion(regionHandle); |
870 | return false; | 870 | return false; |
871 | } | 871 | } |
872 | 872 | ||
873 | } | 873 | } |
874 | 874 | ||
875 | public virtual bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying) { return false; } | 875 | public virtual bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying) { return false; } |
876 | 876 | ||
877 | public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | 877 | public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) |
878 | { | 878 | { |
879 | // If we're here, it's because regionHandle is a remote, non-grided region | 879 | // If we're here, it's because regionHandle is a remote, non-grided region |
880 | m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle); | 880 | m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle); |
881 | 881 | ||
882 | RegionInfo regInfo = GetHyperlinkRegion(regionHandle); | 882 | RegionInfo regInfo = GetHyperlinkRegion(regionHandle); |
883 | if (regInfo == null) | 883 | if (regInfo == null) |
884 | return false; | 884 | return false; |
885 | 885 | ||
886 | //ulong realHandle = regionHandle; | 886 | //ulong realHandle = regionHandle; |
887 | 887 | ||
888 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); | 888 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); |
889 | if ((uinfo == null) || !IsGoingHome(uinfo, regInfo)) | 889 | if ((uinfo == null) || !IsGoingHome(uinfo, regInfo)) |
890 | { | 890 | { |
891 | m_log.Info("[HGrid]: User seems to be going to foreign region " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); | 891 | m_log.Info("[HGrid]: User seems to be going to foreign region " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); |
892 | if (!InformRegionOfUser(regInfo, agentData)) | 892 | if (!InformRegionOfUser(regInfo, agentData)) |
893 | { | 893 | { |
894 | m_log.Warn("[HGrid]: Could not inform remote region of transferring user."); | 894 | m_log.Warn("[HGrid]: Could not inform remote region of transferring user."); |
895 | return false; | 895 | return false; |
896 | } | 896 | } |
897 | } | 897 | } |
898 | else | 898 | else |
899 | m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); | 899 | m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); |
900 | 900 | ||
901 | try | 901 | try |
902 | { | 902 | { |
903 | // ... and then | 903 | // ... and then |
904 | 904 | ||
905 | m_log.Debug("[HGrid]: Region is hyperlink."); | 905 | m_log.Debug("[HGrid]: Region is hyperlink."); |
906 | bool retValue = false; | 906 | bool retValue = false; |
907 | try | 907 | try |
908 | { | 908 | { |
909 | regionHandle = Convert.ToUInt64(regInfo.regionSecret); | 909 | regionHandle = Convert.ToUInt64(regInfo.regionSecret); |
910 | } | 910 | } |
911 | catch (Exception) | 911 | catch (Exception) |
912 | { | 912 | { |
913 | m_log.Warn("[HGrid]: Invalid hyperlink region."); | 913 | m_log.Warn("[HGrid]: Invalid hyperlink region."); |
914 | return false; | 914 | return false; |
915 | } | 915 | } |
916 | 916 | ||
917 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 917 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
918 | typeof(OGS1InterRegionRemoting), | 918 | typeof(OGS1InterRegionRemoting), |
919 | "tcp://" + regInfo.RemotingAddress + | 919 | "tcp://" + regInfo.RemotingAddress + |
920 | ":" + regInfo.RemotingPort + | 920 | ":" + regInfo.RemotingPort + |
921 | "/InterRegions"); | 921 | "/InterRegions"); |
922 | 922 | ||
923 | if (remObject != null) | 923 | if (remObject != null) |
924 | { | 924 | { |
925 | sAgentCircuitData sag = new sAgentCircuitData(agentData); | 925 | sAgentCircuitData sag = new sAgentCircuitData(agentData); |
926 | // May need to change agent's name | 926 | // May need to change agent's name |
927 | if (IsLocalUser(uinfo)) | 927 | if (IsLocalUser(uinfo)) |
928 | { | 928 | { |
929 | sag.firstname = agentData.firstname + "." + agentData.lastname; | 929 | sag.firstname = agentData.firstname + "." + agentData.lastname; |
930 | sag.lastname = serversInfo.UserURL; //HGNetworkServersInfo.Singleton.LocalUserServerURI; | 930 | sag.lastname = serversInfo.UserURL; //HGNetworkServersInfo.Singleton.LocalUserServerURI; |
931 | } | 931 | } |
932 | retValue = remObject.InformRegionOfChildAgent(regionHandle, sag); | 932 | retValue = remObject.InformRegionOfChildAgent(regionHandle, sag); |
933 | } | 933 | } |
934 | else | 934 | else |
935 | { | 935 | { |
936 | m_log.Warn("[HGrid]: remoting object not found"); | 936 | m_log.Warn("[HGrid]: remoting object not found"); |
937 | } | 937 | } |
938 | remObject = null; | 938 | remObject = null; |
939 | m_log.Info("[HGrid]: tried to InformRegionOfChildAgent for " + | 939 | m_log.Info("[HGrid]: tried to InformRegionOfChildAgent for " + |
940 | agentData.firstname + " " + agentData.lastname + " and got " + | 940 | agentData.firstname + " " + agentData.lastname + " and got " + |
941 | retValue.ToString()); | 941 | retValue.ToString()); |
942 | 942 | ||
943 | // Remove the info from this region | 943 | // Remove the info from this region |
944 | if (m_knownRegions.ContainsKey(uinfo.UserProfile.ID)) | 944 | if (m_knownRegions.ContainsKey(uinfo.UserProfile.ID)) |
945 | m_knownRegions.Remove(uinfo.UserProfile.ID); | 945 | m_knownRegions.Remove(uinfo.UserProfile.ID); |
946 | 946 | ||
947 | return retValue; | 947 | return retValue; |
948 | } | 948 | } |
949 | catch (RemotingException e) | 949 | catch (RemotingException e) |
950 | { | 950 | { |
951 | //NoteDeadRegion(regionHandle); | 951 | //NoteDeadRegion(regionHandle); |
952 | 952 | ||
953 | m_log.WarnFormat( | 953 | m_log.WarnFormat( |
954 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | 954 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", |
955 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 955 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
956 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 956 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
957 | 957 | ||
958 | return false; | 958 | return false; |
959 | } | 959 | } |
960 | catch (SocketException e) | 960 | catch (SocketException e) |
961 | { | 961 | { |
962 | //NoteDeadRegion(regionHandle); | 962 | //NoteDeadRegion(regionHandle); |
963 | 963 | ||
964 | m_log.WarnFormat( | 964 | m_log.WarnFormat( |
965 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | 965 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", |
966 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 966 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
967 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 967 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
968 | 968 | ||
969 | return false; | 969 | return false; |
970 | } | 970 | } |
971 | catch (InvalidCredentialException e) | 971 | catch (InvalidCredentialException e) |
972 | { | 972 | { |
973 | //NoteDeadRegion(regionHandle); | 973 | //NoteDeadRegion(regionHandle); |
974 | 974 | ||
975 | m_log.WarnFormat( | 975 | m_log.WarnFormat( |
976 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | 976 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", |
977 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 977 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
978 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 978 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
979 | 979 | ||
980 | return false; | 980 | return false; |
981 | } | 981 | } |
982 | catch (AuthenticationException e) | 982 | catch (AuthenticationException e) |
983 | { | 983 | { |
984 | //NoteDeadRegion(regionHandle); | 984 | //NoteDeadRegion(regionHandle); |
985 | 985 | ||
986 | m_log.WarnFormat( | 986 | m_log.WarnFormat( |
987 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | 987 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", |
988 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 988 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
989 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 989 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
990 | 990 | ||
991 | return false; | 991 | return false; |
992 | } | 992 | } |
993 | catch (Exception e) | 993 | catch (Exception e) |
994 | { | 994 | { |
995 | //NoteDeadRegion(regionHandle); | 995 | //NoteDeadRegion(regionHandle); |
996 | 996 | ||
997 | if (regInfo != null) | 997 | if (regInfo != null) |
998 | { | 998 | { |
999 | m_log.WarnFormat( | 999 | m_log.WarnFormat( |
1000 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | 1000 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", |
1001 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 1001 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
1002 | } | 1002 | } |
1003 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 1003 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
1004 | 1004 | ||
1005 | return false; | 1005 | return false; |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | 1008 | ||
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | public virtual bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) { return false; } | 1011 | public virtual bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) { return false; } |
1012 | 1012 | ||
1013 | public virtual bool RegionUp(SerializableRegionInfo region, ulong regionhandle) { | 1013 | public virtual bool RegionUp(SerializableRegionInfo region, ulong regionhandle) { |
1014 | 1014 | ||
1015 | ulong realHandle = FindRegionHandle(regionhandle); | 1015 | ulong realHandle = FindRegionHandle(regionhandle); |
1016 | 1016 | ||
1017 | if (realHandle == regionhandle) // something wrong, not remote region | 1017 | if (realHandle == regionhandle) // something wrong, not remote region |
1018 | return false; | 1018 | return false; |
1019 | 1019 | ||
1020 | SerializableRegionInfo regInfo = null; | 1020 | SerializableRegionInfo regInfo = null; |
1021 | try | 1021 | try |
1022 | { | 1022 | { |
1023 | // You may ask why this is in here... | 1023 | // You may ask why this is in here... |
1024 | // The region asking the grid services about itself.. | 1024 | // The region asking the grid services about itself.. |
1025 | // And, surprisingly, the reason is.. it doesn't know | 1025 | // And, surprisingly, the reason is.. it doesn't know |
1026 | // it's own remoting port! How special. | 1026 | // it's own remoting port! How special. |
1027 | RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); | 1027 | RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); |
1028 | 1028 | ||
1029 | region = new SerializableRegionInfo(RequestNeighbourInfo(realHandle)); | 1029 | region = new SerializableRegionInfo(RequestNeighbourInfo(realHandle)); |
1030 | region.RemotingAddress = region.ExternalHostName; | 1030 | region.RemotingAddress = region.ExternalHostName; |
1031 | region.RemotingPort = NetworkServersInfo.RemotingListenerPort; | 1031 | region.RemotingPort = NetworkServersInfo.RemotingListenerPort; |
1032 | region.HttpPort = serversInfo.HttpListenerPort; | 1032 | region.HttpPort = serversInfo.HttpListenerPort; |
1033 | 1033 | ||
1034 | regInfo = new SerializableRegionInfo(RequestNeighbourInfo(regionhandle)); | 1034 | regInfo = new SerializableRegionInfo(RequestNeighbourInfo(regionhandle)); |
1035 | if (regInfo != null) | 1035 | if (regInfo != null) |
1036 | { | 1036 | { |
1037 | // If we're not trying to remote to ourselves. | 1037 | // If we're not trying to remote to ourselves. |
1038 | if (regInfo.RemotingAddress != region.RemotingAddress && region.RemotingAddress != null) | 1038 | if (regInfo.RemotingAddress != region.RemotingAddress && region.RemotingAddress != null) |
1039 | { | 1039 | { |
1040 | //don't want to be creating a new link to the remote instance every time like we are here | 1040 | //don't want to be creating a new link to the remote instance every time like we are here |
1041 | bool retValue = false; | 1041 | bool retValue = false; |
1042 | 1042 | ||
1043 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 1043 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
1044 | typeof(OGS1InterRegionRemoting), | 1044 | typeof(OGS1InterRegionRemoting), |
1045 | "tcp://" + | 1045 | "tcp://" + |
1046 | regInfo.RemotingAddress + | 1046 | regInfo.RemotingAddress + |
1047 | ":" + regInfo.RemotingPort + | 1047 | ":" + regInfo.RemotingPort + |
1048 | "/InterRegions"); | 1048 | "/InterRegions"); |
1049 | 1049 | ||
1050 | if (remObject != null) | 1050 | if (remObject != null) |
1051 | { | 1051 | { |
1052 | retValue = remObject.RegionUp(regiondata, realHandle); | 1052 | retValue = remObject.RegionUp(regiondata, realHandle); |
1053 | } | 1053 | } |
1054 | else | 1054 | else |
1055 | { | 1055 | { |
1056 | m_log.Warn("[HGrid]: remoting object not found"); | 1056 | m_log.Warn("[HGrid]: remoting object not found"); |
1057 | } | 1057 | } |
1058 | remObject = null; | 1058 | remObject = null; |
1059 | 1059 | ||
1060 | m_log.Info( | 1060 | m_log.Info( |
1061 | "[HGrid]: tried to inform region I'm up"); | 1061 | "[HGrid]: tried to inform region I'm up"); |
1062 | 1062 | ||
1063 | return retValue; | 1063 | return retValue; |
1064 | } | 1064 | } |
1065 | else | 1065 | else |
1066 | { | 1066 | { |
1067 | // We're trying to inform ourselves via remoting. | 1067 | // We're trying to inform ourselves via remoting. |
1068 | // This is here because we're looping over the listeners before we get here. | 1068 | // This is here because we're looping over the listeners before we get here. |
1069 | // Odd but it should work. | 1069 | // Odd but it should work. |
1070 | return true; | 1070 | return true; |
1071 | } | 1071 | } |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | return false; | 1074 | return false; |
1075 | } | 1075 | } |
1076 | catch (RemotingException e) | 1076 | catch (RemotingException e) |
1077 | { | 1077 | { |
1078 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region using tcp://" + | 1078 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region using tcp://" + |
1079 | regInfo.RemotingAddress + | 1079 | regInfo.RemotingAddress + |
1080 | ":" + regInfo.RemotingPort + | 1080 | ":" + regInfo.RemotingPort + |
1081 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + | 1081 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + |
1082 | " - Is this neighbor up?"); | 1082 | " - Is this neighbor up?"); |
1083 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 1083 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
1084 | return false; | 1084 | return false; |
1085 | } | 1085 | } |
1086 | catch (SocketException e) | 1086 | catch (SocketException e) |
1087 | { | 1087 | { |
1088 | m_log.Warn("[HGrid]: Socket Error: Unable to connect to adjacent region using tcp://" + | 1088 | m_log.Warn("[HGrid]: Socket Error: Unable to connect to adjacent region using tcp://" + |
1089 | regInfo.RemotingAddress + | 1089 | regInfo.RemotingAddress + |
1090 | ":" + regInfo.RemotingPort + | 1090 | ":" + regInfo.RemotingPort + |
1091 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + | 1091 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + |
1092 | " - Is this neighbor up?"); | 1092 | " - Is this neighbor up?"); |
1093 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 1093 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
1094 | return false; | 1094 | return false; |
1095 | } | 1095 | } |
1096 | catch (InvalidCredentialException e) | 1096 | catch (InvalidCredentialException e) |
1097 | { | 1097 | { |
1098 | m_log.Warn("[HGrid]: Invalid Credentials: Unable to connect to adjacent region using tcp://" + | 1098 | m_log.Warn("[HGrid]: Invalid Credentials: Unable to connect to adjacent region using tcp://" + |
1099 | regInfo.RemotingAddress + | 1099 | regInfo.RemotingAddress + |
1100 | ":" + regInfo.RemotingPort + | 1100 | ":" + regInfo.RemotingPort + |
1101 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 1101 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
1102 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 1102 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
1103 | return false; | 1103 | return false; |
1104 | } | 1104 | } |
1105 | catch (AuthenticationException e) | 1105 | catch (AuthenticationException e) |
1106 | { | 1106 | { |
1107 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region using tcp://" + | 1107 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region using tcp://" + |
1108 | regInfo.RemotingAddress + | 1108 | regInfo.RemotingAddress + |
1109 | ":" + regInfo.RemotingPort + | 1109 | ":" + regInfo.RemotingPort + |
1110 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 1110 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
1111 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 1111 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
1112 | return false; | 1112 | return false; |
1113 | } | 1113 | } |
1114 | catch (Exception e) | 1114 | catch (Exception e) |
1115 | { | 1115 | { |
1116 | m_log.Debug(e.ToString()); | 1116 | m_log.Debug(e.ToString()); |
1117 | return false; | 1117 | return false; |
1118 | } | 1118 | } |
1119 | 1119 | ||
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | public virtual bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) { return false; } | 1122 | public virtual bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) { return false; } |
1123 | 1123 | ||
1124 | public virtual List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online) | 1124 | public virtual List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online) |
1125 | { | 1125 | { |
1126 | return new List<UUID>(); | 1126 | return new List<UUID>(); |
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | public virtual bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID) | 1129 | public virtual bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID) |
1130 | { | 1130 | { |
1131 | return true; | 1131 | return true; |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | 1134 | ||
1135 | #endregion | 1135 | #endregion |
1136 | 1136 | ||
1137 | #region Methods triggered by calls from external instances | 1137 | #region Methods triggered by calls from external instances |
1138 | 1138 | ||
1139 | /// <summary> | 1139 | /// <summary> |
1140 | /// | 1140 | /// |
1141 | /// </summary> | 1141 | /// </summary> |
1142 | /// <param name="regionHandle"></param> | 1142 | /// <param name="regionHandle"></param> |
1143 | /// <param name="agentData"></param> | 1143 | /// <param name="agentData"></param> |
1144 | /// <returns></returns> | 1144 | /// <returns></returns> |
1145 | protected bool HGIncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) | 1145 | protected bool HGIncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) |
1146 | { | 1146 | { |
1147 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); | 1147 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); |
1148 | if ((uinfo != null) && (uinfo.UserProfile != null) && | 1148 | if ((uinfo != null) && (uinfo.UserProfile != null) && |
1149 | (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData))) | 1149 | (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData))) |
1150 | { | 1150 | { |
1151 | //Console.WriteLine("---------------> Local User!"); | 1151 | //Console.WriteLine("---------------> Local User!"); |
1152 | string[] parts = agentData.firstname.Split(new char[] { '.' }); | 1152 | string[] parts = agentData.firstname.Split(new char[] { '.' }); |
1153 | if (parts.Length == 2) | 1153 | if (parts.Length == 2) |
1154 | { | 1154 | { |
1155 | agentData.firstname = parts[0]; | 1155 | agentData.firstname = parts[0]; |
1156 | agentData.lastname = parts[1]; | 1156 | agentData.lastname = parts[1]; |
1157 | } | 1157 | } |
1158 | } | 1158 | } |
1159 | //else | 1159 | //else |
1160 | // Console.WriteLine("---------------> Foreign User!"); | 1160 | // Console.WriteLine("---------------> Foreign User!"); |
1161 | return true; | 1161 | return true; |
1162 | } | 1162 | } |
1163 | #endregion | 1163 | #endregion |
1164 | 1164 | ||
1165 | 1165 | ||
1166 | #region IHyperGrid interface | 1166 | #region IHyperGrid interface |
1167 | 1167 | ||
1168 | public virtual bool IsHyperlinkRegion(ulong ihandle) | 1168 | public virtual bool IsHyperlinkRegion(ulong ihandle) |
1169 | { | 1169 | { |
1170 | if (GetHyperlinkRegion(ihandle) == null) | 1170 | if (GetHyperlinkRegion(ihandle) == null) |
1171 | return false; | 1171 | return false; |
1172 | else | 1172 | else |
1173 | return true; | 1173 | return true; |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | public virtual RegionInfo GetHyperlinkRegion(ulong ihandle) | 1176 | public virtual RegionInfo GetHyperlinkRegion(ulong ihandle) |
1177 | { | 1177 | { |
1178 | foreach (RegionInfo info in m_hyperlinkRegions) | 1178 | foreach (RegionInfo info in m_hyperlinkRegions) |
1179 | { | 1179 | { |
1180 | if (info.RegionHandle == ihandle) | 1180 | if (info.RegionHandle == ihandle) |
1181 | return info; | 1181 | return info; |
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | foreach (RegionInfo info in m_knownRegions.Values) | 1184 | foreach (RegionInfo info in m_knownRegions.Values) |
1185 | { | 1185 | { |
1186 | if (info.RegionHandle == ihandle) | 1186 | if (info.RegionHandle == ihandle) |
1187 | return info; | 1187 | return info; |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | return null; | 1190 | return null; |
1191 | } | 1191 | } |
1192 | 1192 | ||
1193 | public virtual ulong FindRegionHandle(ulong ihandle) | 1193 | public virtual ulong FindRegionHandle(ulong ihandle) |
1194 | { | 1194 | { |
1195 | long ohandle = -1; | 1195 | long ohandle = -1; |
1196 | List<RegionInfo> rlist = new List<RegionInfo>(m_hyperlinkRegions); | 1196 | List<RegionInfo> rlist = new List<RegionInfo>(m_hyperlinkRegions); |
1197 | rlist.AddRange(m_knownRegions.Values); | 1197 | rlist.AddRange(m_knownRegions.Values); |
1198 | foreach (RegionInfo info in rlist) | 1198 | foreach (RegionInfo info in rlist) |
1199 | { | 1199 | { |
1200 | if (info.RegionHandle == ihandle) | 1200 | if (info.RegionHandle == ihandle) |
1201 | { | 1201 | { |
1202 | try | 1202 | try |
1203 | { | 1203 | { |
1204 | ohandle = Convert.ToInt64(info.regionSecret); | 1204 | ohandle = Convert.ToInt64(info.regionSecret); |
1205 | m_log.Info("[HGrid] remote region " + ohandle); | 1205 | m_log.Info("[HGrid] remote region " + ohandle); |
1206 | } | 1206 | } |
1207 | catch | 1207 | catch |
1208 | { | 1208 | { |
1209 | m_log.Error("[HGrid] Could not convert secret for " + ihandle + " (" + info.regionSecret + ")"); | 1209 | m_log.Error("[HGrid] Could not convert secret for " + ihandle + " (" + info.regionSecret + ")"); |
1210 | } | 1210 | } |
1211 | break; | 1211 | break; |
1212 | } | 1212 | } |
1213 | } | 1213 | } |
1214 | return ohandle < 0 ? ihandle : (ulong)ohandle; | 1214 | return ohandle < 0 ? ihandle : (ulong)ohandle; |
1215 | } | 1215 | } |
1216 | #endregion | 1216 | #endregion |
1217 | 1217 | ||
1218 | #region Misc | 1218 | #region Misc |
1219 | 1219 | ||
1220 | protected bool IsComingHome(ForeignUserProfileData userData) | 1220 | protected bool IsComingHome(ForeignUserProfileData userData) |
1221 | { | 1221 | { |
1222 | return (userData.UserServerURI == HGNetworkServersInfo.Singleton.LocalUserServerURI); | 1222 | return (userData.UserServerURI == HGNetworkServersInfo.Singleton.LocalUserServerURI); |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | protected bool IsGoingHome(CachedUserInfo uinfo, RegionInfo rinfo) | 1225 | protected bool IsGoingHome(CachedUserInfo uinfo, RegionInfo rinfo) |
1226 | { | 1226 | { |
1227 | if (uinfo.UserProfile == null) | 1227 | if (uinfo.UserProfile == null) |
1228 | return false; | 1228 | return false; |
1229 | 1229 | ||
1230 | string userUserServerURI = String.Empty; | 1230 | string userUserServerURI = String.Empty; |
1231 | if (uinfo.UserProfile is ForeignUserProfileData) | 1231 | if (uinfo.UserProfile is ForeignUserProfileData) |
1232 | { | 1232 | { |
1233 | userUserServerURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI); | 1233 | userUserServerURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI); |
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | return ((uinfo.UserProfile.HomeRegionID == rinfo.RegionID) && | 1236 | return ((uinfo.UserProfile.HomeRegionID == rinfo.RegionID) && |
1237 | (userUserServerURI != HGNetworkServersInfo.Singleton.LocalUserServerURI)); | 1237 | (userUserServerURI != HGNetworkServersInfo.Singleton.LocalUserServerURI)); |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | protected bool IsLocalUser(CachedUserInfo uinfo) | 1240 | protected bool IsLocalUser(CachedUserInfo uinfo) |
1241 | { | 1241 | { |
1242 | if (uinfo == null) | 1242 | if (uinfo == null) |
1243 | return true; | 1243 | return true; |
1244 | 1244 | ||
1245 | if (uinfo.UserProfile is ForeignUserProfileData) | 1245 | if (uinfo.UserProfile is ForeignUserProfileData) |
1246 | return HGNetworkServersInfo.Singleton.IsLocalUser(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI); | 1246 | return HGNetworkServersInfo.Singleton.IsLocalUser(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI); |
1247 | else | 1247 | else |
1248 | return true; | 1248 | return true; |
1249 | 1249 | ||
1250 | } | 1250 | } |
1251 | 1251 | ||
1252 | protected bool IsLocalRegion(ulong handle) | 1252 | protected bool IsLocalRegion(ulong handle) |
1253 | { | 1253 | { |
1254 | foreach (RegionInfo reg in m_regionsOnInstance) | 1254 | foreach (RegionInfo reg in m_regionsOnInstance) |
1255 | if (reg.RegionHandle == handle) | 1255 | if (reg.RegionHandle == handle) |
1256 | return true; | 1256 | return true; |
1257 | return false; | 1257 | return false; |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | private void DumpUserData(ForeignUserProfileData userData) | 1260 | private void DumpUserData(ForeignUserProfileData userData) |
1261 | { | 1261 | { |
1262 | Console.WriteLine(" ------------ User Data Dump ----------"); | 1262 | Console.WriteLine(" ------------ User Data Dump ----------"); |
1263 | Console.WriteLine(" >> Name: " + userData.FirstName + " " + userData.SurName); | 1263 | Console.WriteLine(" >> Name: " + userData.FirstName + " " + userData.SurName); |
1264 | Console.WriteLine(" >> HomeID: " + userData.HomeRegionID); | 1264 | Console.WriteLine(" >> HomeID: " + userData.HomeRegionID); |
1265 | Console.WriteLine(" >> HomeHandle: " + userData.HomeRegion); | 1265 | Console.WriteLine(" >> HomeHandle: " + userData.HomeRegion); |
1266 | Console.WriteLine(" >> HomeX: " + userData.HomeRegionX); | 1266 | Console.WriteLine(" >> HomeX: " + userData.HomeRegionX); |
1267 | Console.WriteLine(" >> HomeY: " + userData.HomeRegionY); | 1267 | Console.WriteLine(" >> HomeY: " + userData.HomeRegionY); |
1268 | Console.WriteLine(" >> UserServer: " + userData.UserServerURI); | 1268 | Console.WriteLine(" >> UserServer: " + userData.UserServerURI); |
1269 | Console.WriteLine(" >> InvServer: " + userData.UserInventoryURI); | 1269 | Console.WriteLine(" >> InvServer: " + userData.UserInventoryURI); |
1270 | Console.WriteLine(" >> AssetServer: " + userData.UserAssetURI); | 1270 | Console.WriteLine(" >> AssetServer: " + userData.UserAssetURI); |
1271 | Console.WriteLine(" ------------ -------------- ----------"); | 1271 | Console.WriteLine(" ------------ -------------- ----------"); |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | private void DumpRegionData(RegionInfo rinfo) | 1274 | private void DumpRegionData(RegionInfo rinfo) |
1275 | { | 1275 | { |
1276 | Console.WriteLine(" ------------ Region Data Dump ----------"); | 1276 | Console.WriteLine(" ------------ Region Data Dump ----------"); |
1277 | Console.WriteLine(" >> handle: " + rinfo.RegionHandle); | 1277 | Console.WriteLine(" >> handle: " + rinfo.RegionHandle); |
1278 | Console.WriteLine(" >> coords: " + rinfo.RegionLocX + ", " + rinfo.RegionLocY); | 1278 | Console.WriteLine(" >> coords: " + rinfo.RegionLocX + ", " + rinfo.RegionLocY); |
1279 | Console.WriteLine(" >> secret: " + rinfo.regionSecret); | 1279 | Console.WriteLine(" >> secret: " + rinfo.regionSecret); |
1280 | Console.WriteLine(" >> remoting address: " + rinfo.RemotingAddress); | 1280 | Console.WriteLine(" >> remoting address: " + rinfo.RemotingAddress); |
1281 | Console.WriteLine(" >> remoting port: " + rinfo.RemotingPort); | 1281 | Console.WriteLine(" >> remoting port: " + rinfo.RemotingPort); |
1282 | Console.WriteLine(" >> external host name: " + rinfo.ExternalHostName); | 1282 | Console.WriteLine(" >> external host name: " + rinfo.ExternalHostName); |
1283 | Console.WriteLine(" >> http port: " + rinfo.HttpPort); | 1283 | Console.WriteLine(" >> http port: " + rinfo.HttpPort); |
1284 | Console.WriteLine(" >> external EP address: " + rinfo.ExternalEndPoint.Address); | 1284 | Console.WriteLine(" >> external EP address: " + rinfo.ExternalEndPoint.Address); |
1285 | Console.WriteLine(" >> external EP port: " + rinfo.ExternalEndPoint.Port); | 1285 | Console.WriteLine(" >> external EP port: " + rinfo.ExternalEndPoint.Port); |
1286 | Console.WriteLine(" ------------ -------------- ----------"); | 1286 | Console.WriteLine(" ------------ -------------- ----------"); |
1287 | } | 1287 | } |
1288 | 1288 | ||
1289 | 1289 | ||
1290 | #endregion | 1290 | #endregion |
1291 | 1291 | ||
1292 | 1292 | ||
1293 | } | 1293 | } |
1294 | } | 1294 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs index 23258df..a29edb4 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs | |||
@@ -1,285 +1,285 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | 32 | ||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Region.Communications.OGS1; | 37 | using OpenSim.Region.Communications.OGS1; |
38 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
39 | 39 | ||
40 | using OpenMetaverse; | 40 | using OpenMetaverse; |
41 | 41 | ||
42 | using log4net; | 42 | using log4net; |
43 | 43 | ||
44 | namespace OpenSim.Region.Communications.Hypergrid | 44 | namespace OpenSim.Region.Communications.Hypergrid |
45 | { | 45 | { |
46 | public class HGGridServicesGridMode : HGGridServices | 46 | public class HGGridServicesGridMode : HGGridServices |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Encapsulate remote backend services for manipulation of grid regions | 51 | /// Encapsulate remote backend services for manipulation of grid regions |
52 | /// </summary> | 52 | /// </summary> |
53 | private OGS1GridServices m_remoteBackend = null; | 53 | private OGS1GridServices m_remoteBackend = null; |
54 | 54 | ||
55 | public OGS1GridServices RemoteBackend | 55 | public OGS1GridServices RemoteBackend |
56 | { | 56 | { |
57 | get { return m_remoteBackend; } | 57 | get { return m_remoteBackend; } |
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | public override string gdebugRegionName | 61 | public override string gdebugRegionName |
62 | { | 62 | { |
63 | get { return m_remoteBackend.gdebugRegionName; } | 63 | get { return m_remoteBackend.gdebugRegionName; } |
64 | set { m_remoteBackend.gdebugRegionName = value; } | 64 | set { m_remoteBackend.gdebugRegionName = value; } |
65 | } | 65 | } |
66 | 66 | ||
67 | public override bool RegionLoginsEnabled | 67 | public override bool RegionLoginsEnabled |
68 | { | 68 | { |
69 | get { return m_remoteBackend.RegionLoginsEnabled; } | 69 | get { return m_remoteBackend.RegionLoginsEnabled; } |
70 | set { m_remoteBackend.RegionLoginsEnabled = value; } | 70 | set { m_remoteBackend.RegionLoginsEnabled = value; } |
71 | } | 71 | } |
72 | 72 | ||
73 | public HGGridServicesGridMode(NetworkServersInfo servers_info, BaseHttpServer httpServe, | 73 | public HGGridServicesGridMode(NetworkServersInfo servers_info, BaseHttpServer httpServe, |
74 | AssetCache asscache, SceneManager sman, UserProfileCacheService userv) | 74 | AssetCache asscache, SceneManager sman, UserProfileCacheService userv) |
75 | : base(servers_info, httpServe, asscache, sman) | 75 | : base(servers_info, httpServe, asscache, sman) |
76 | { | 76 | { |
77 | m_remoteBackend = new OGS1GridServices(servers_info, httpServe); | 77 | m_remoteBackend = new OGS1GridServices(servers_info, httpServe); |
78 | // Let's deregister this, so we can handle it here first | 78 | // Let's deregister this, so we can handle it here first |
79 | InterRegionSingleton.Instance.OnChildAgent -= m_remoteBackend.IncomingChildAgent; | 79 | InterRegionSingleton.Instance.OnChildAgent -= m_remoteBackend.IncomingChildAgent; |
80 | InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; | 80 | InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; |
81 | m_userProfileCache = userv; | 81 | m_userProfileCache = userv; |
82 | } | 82 | } |
83 | 83 | ||
84 | #region IGridServices interface | 84 | #region IGridServices interface |
85 | 85 | ||
86 | public override RegionCommsListener RegisterRegion(RegionInfo regionInfo) | 86 | public override RegionCommsListener RegisterRegion(RegionInfo regionInfo) |
87 | { | 87 | { |
88 | if (!regionInfo.RegionID.Equals(UUID.Zero)) | 88 | if (!regionInfo.RegionID.Equals(UUID.Zero)) |
89 | { | 89 | { |
90 | m_regionsOnInstance.Add(regionInfo); | 90 | m_regionsOnInstance.Add(regionInfo); |
91 | return m_remoteBackend.RegisterRegion(regionInfo); | 91 | return m_remoteBackend.RegisterRegion(regionInfo); |
92 | } | 92 | } |
93 | else | 93 | else |
94 | return base.RegisterRegion(regionInfo); | 94 | return base.RegisterRegion(regionInfo); |
95 | } | 95 | } |
96 | 96 | ||
97 | public override bool DeregisterRegion(RegionInfo regionInfo) | 97 | public override bool DeregisterRegion(RegionInfo regionInfo) |
98 | { | 98 | { |
99 | bool success = m_remoteBackend.DeregisterRegion(regionInfo); | 99 | bool success = m_remoteBackend.DeregisterRegion(regionInfo); |
100 | if (!success) | 100 | if (!success) |
101 | success = base.DeregisterRegion(regionInfo); | 101 | success = base.DeregisterRegion(regionInfo); |
102 | return success; | 102 | return success; |
103 | } | 103 | } |
104 | 104 | ||
105 | public override List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) | 105 | public override List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) |
106 | { | 106 | { |
107 | List<SimpleRegionInfo> neighbours = m_remoteBackend.RequestNeighbours(x, y); | 107 | List<SimpleRegionInfo> neighbours = m_remoteBackend.RequestNeighbours(x, y); |
108 | List<SimpleRegionInfo> remotes = base.RequestNeighbours(x, y); | 108 | List<SimpleRegionInfo> remotes = base.RequestNeighbours(x, y); |
109 | neighbours.AddRange(remotes); | 109 | neighbours.AddRange(remotes); |
110 | 110 | ||
111 | return neighbours; | 111 | return neighbours; |
112 | } | 112 | } |
113 | 113 | ||
114 | public override RegionInfo RequestNeighbourInfo(UUID Region_UUID) | 114 | public override RegionInfo RequestNeighbourInfo(UUID Region_UUID) |
115 | { | 115 | { |
116 | RegionInfo info = m_remoteBackend.RequestNeighbourInfo(Region_UUID); | 116 | RegionInfo info = m_remoteBackend.RequestNeighbourInfo(Region_UUID); |
117 | if (info == null) | 117 | if (info == null) |
118 | info = base.RequestNeighbourInfo(Region_UUID); | 118 | info = base.RequestNeighbourInfo(Region_UUID); |
119 | return info; | 119 | return info; |
120 | } | 120 | } |
121 | 121 | ||
122 | public override RegionInfo RequestNeighbourInfo(ulong regionHandle) | 122 | public override RegionInfo RequestNeighbourInfo(ulong regionHandle) |
123 | { | 123 | { |
124 | RegionInfo info = m_remoteBackend.RequestNeighbourInfo(regionHandle); | 124 | RegionInfo info = m_remoteBackend.RequestNeighbourInfo(regionHandle); |
125 | if (info == null) | 125 | if (info == null) |
126 | info = base.RequestNeighbourInfo(regionHandle); | 126 | info = base.RequestNeighbourInfo(regionHandle); |
127 | return info; | 127 | return info; |
128 | } | 128 | } |
129 | 129 | ||
130 | public override RegionInfo RequestClosestRegion(string regionName) | 130 | public override RegionInfo RequestClosestRegion(string regionName) |
131 | { | 131 | { |
132 | RegionInfo info = m_remoteBackend.RequestClosestRegion(regionName); | 132 | RegionInfo info = m_remoteBackend.RequestClosestRegion(regionName); |
133 | if (info == null) | 133 | if (info == null) |
134 | info = base.RequestClosestRegion(regionName); | 134 | info = base.RequestClosestRegion(regionName); |
135 | return info; | 135 | return info; |
136 | } | 136 | } |
137 | 137 | ||
138 | public override List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) | 138 | public override List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) |
139 | { | 139 | { |
140 | List<MapBlockData> neighbours = m_remoteBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | 140 | List<MapBlockData> neighbours = m_remoteBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); |
141 | List<MapBlockData> remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | 141 | List<MapBlockData> remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); |
142 | neighbours.AddRange(remotes); | 142 | neighbours.AddRange(remotes); |
143 | 143 | ||
144 | return neighbours; | 144 | return neighbours; |
145 | } | 145 | } |
146 | 146 | ||
147 | public override LandData RequestLandData(ulong regionHandle, uint x, uint y) | 147 | public override LandData RequestLandData(ulong regionHandle, uint x, uint y) |
148 | { | 148 | { |
149 | LandData land = m_remoteBackend.RequestLandData(regionHandle, x, y); | 149 | LandData land = m_remoteBackend.RequestLandData(regionHandle, x, y); |
150 | if (land == null) | 150 | if (land == null) |
151 | land = base.RequestLandData(regionHandle, x, y); | 151 | land = base.RequestLandData(regionHandle, x, y); |
152 | return land; | 152 | return land; |
153 | } | 153 | } |
154 | 154 | ||
155 | public override List<RegionInfo> RequestNamedRegions(string name, int maxNumber) | 155 | public override List<RegionInfo> RequestNamedRegions(string name, int maxNumber) |
156 | { | 156 | { |
157 | List<RegionInfo> infos = m_remoteBackend.RequestNamedRegions(name, maxNumber); | 157 | List<RegionInfo> infos = m_remoteBackend.RequestNamedRegions(name, maxNumber); |
158 | List<RegionInfo> remotes = base.RequestNamedRegions(name, maxNumber); | 158 | List<RegionInfo> remotes = base.RequestNamedRegions(name, maxNumber); |
159 | infos.AddRange(remotes); | 159 | infos.AddRange(remotes); |
160 | return infos; | 160 | return infos; |
161 | } | 161 | } |
162 | 162 | ||
163 | #endregion | 163 | #endregion |
164 | 164 | ||
165 | #region IInterRegionCommunications interface | 165 | #region IInterRegionCommunications interface |
166 | 166 | ||
167 | public override bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) | 167 | public override bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) |
168 | { | 168 | { |
169 | return m_remoteBackend.AcknowledgeAgentCrossed(regionHandle, agentId); | 169 | return m_remoteBackend.AcknowledgeAgentCrossed(regionHandle, agentId); |
170 | } | 170 | } |
171 | 171 | ||
172 | public override bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID) | 172 | public override bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID) |
173 | { | 173 | { |
174 | return m_remoteBackend.AcknowledgePrimCrossed(regionHandle, primID); | 174 | return m_remoteBackend.AcknowledgePrimCrossed(regionHandle, primID); |
175 | } | 175 | } |
176 | 176 | ||
177 | public override bool CheckRegion(string address, uint port) | 177 | public override bool CheckRegion(string address, uint port) |
178 | { | 178 | { |
179 | return m_remoteBackend.CheckRegion(address, port); | 179 | return m_remoteBackend.CheckRegion(address, port); |
180 | } | 180 | } |
181 | 181 | ||
182 | public override bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | 182 | public override bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) |
183 | { | 183 | { |
184 | return m_remoteBackend.ChildAgentUpdate(regionHandle, cAgentData); | 184 | return m_remoteBackend.ChildAgentUpdate(regionHandle, cAgentData); |
185 | } | 185 | } |
186 | 186 | ||
187 | public override bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | 187 | public override bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) |
188 | { | 188 | { |
189 | if (base.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying)) | 189 | if (base.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying)) |
190 | return true; | 190 | return true; |
191 | return m_remoteBackend.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | 191 | return m_remoteBackend.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
192 | } | 192 | } |
193 | 193 | ||
194 | public override bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying) | 194 | public override bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying) |
195 | { | 195 | { |
196 | return m_remoteBackend.ExpectPrimCrossing(regionHandle, primID, position, isFlying); | 196 | return m_remoteBackend.ExpectPrimCrossing(regionHandle, primID, position, isFlying); |
197 | } | 197 | } |
198 | 198 | ||
199 | public override bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | 199 | public override bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) |
200 | { | 200 | { |
201 | CachedUserInfo user = m_userProfileCache.GetUserDetails(agentData.AgentID); | 201 | CachedUserInfo user = m_userProfileCache.GetUserDetails(agentData.AgentID); |
202 | 202 | ||
203 | if (IsLocalUser(user)) | 203 | if (IsLocalUser(user)) |
204 | { | 204 | { |
205 | Console.WriteLine("XXX Home User XXX"); | 205 | Console.WriteLine("XXX Home User XXX"); |
206 | if (IsHyperlinkRegion(regionHandle)) | 206 | if (IsHyperlinkRegion(regionHandle)) |
207 | { | 207 | { |
208 | Console.WriteLine("XXX Going Hyperlink XXX"); | 208 | Console.WriteLine("XXX Going Hyperlink XXX"); |
209 | return base.InformRegionOfChildAgent(regionHandle, agentData); | 209 | return base.InformRegionOfChildAgent(regionHandle, agentData); |
210 | } | 210 | } |
211 | else | 211 | else |
212 | { | 212 | { |
213 | // non-hypergrid case | 213 | // non-hypergrid case |
214 | Console.WriteLine("XXX Going local-grid region XXX"); | 214 | Console.WriteLine("XXX Going local-grid region XXX"); |
215 | return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); | 215 | return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | // Foregin users | 219 | // Foregin users |
220 | Console.WriteLine("XXX Foreign User XXX"); | 220 | Console.WriteLine("XXX Foreign User XXX"); |
221 | if (IsLocalRegion(regionHandle)) // regions on the same instance | 221 | if (IsLocalRegion(regionHandle)) // regions on the same instance |
222 | { | 222 | { |
223 | Console.WriteLine("XXX Going onInstance region XXX"); | 223 | Console.WriteLine("XXX Going onInstance region XXX"); |
224 | return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); | 224 | return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); |
225 | } | 225 | } |
226 | 226 | ||
227 | if (IsHyperlinkRegion(regionHandle)) // hyperlinked regions | 227 | if (IsHyperlinkRegion(regionHandle)) // hyperlinked regions |
228 | { | 228 | { |
229 | Console.WriteLine("XXX Going Hyperlink XXX"); | 229 | Console.WriteLine("XXX Going Hyperlink XXX"); |
230 | return base.InformRegionOfChildAgent(regionHandle, agentData); | 230 | return base.InformRegionOfChildAgent(regionHandle, agentData); |
231 | } | 231 | } |
232 | else | 232 | else |
233 | { | 233 | { |
234 | // foreign user going to a non-local region on the same grid | 234 | // foreign user going to a non-local region on the same grid |
235 | // We need to inform that region about this user before | 235 | // We need to inform that region about this user before |
236 | // proceeding to the normal backend process. | 236 | // proceeding to the normal backend process. |
237 | Console.WriteLine("XXX Going local-grid region XXX"); | 237 | Console.WriteLine("XXX Going local-grid region XXX"); |
238 | RegionInfo regInfo = RequestNeighbourInfo(regionHandle); | 238 | RegionInfo regInfo = RequestNeighbourInfo(regionHandle); |
239 | if (regInfo != null) | 239 | if (regInfo != null) |
240 | InformRegionOfUser(regInfo, agentData); | 240 | InformRegionOfUser(regInfo, agentData); |
241 | return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); | 241 | return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); |
242 | } | 242 | } |
243 | 243 | ||
244 | } | 244 | } |
245 | 245 | ||
246 | public override bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) | 246 | public override bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) |
247 | { | 247 | { |
248 | return m_remoteBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod); | 248 | return m_remoteBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod); |
249 | } | 249 | } |
250 | 250 | ||
251 | public override bool RegionUp(SerializableRegionInfo region, ulong regionhandle) | 251 | public override bool RegionUp(SerializableRegionInfo region, ulong regionhandle) |
252 | { | 252 | { |
253 | if (m_remoteBackend.RegionUp(region, regionhandle)) | 253 | if (m_remoteBackend.RegionUp(region, regionhandle)) |
254 | return true; | 254 | return true; |
255 | return base.RegionUp(region, regionhandle); | 255 | return base.RegionUp(region, regionhandle); |
256 | } | 256 | } |
257 | 257 | ||
258 | public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | 258 | public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) |
259 | { | 259 | { |
260 | return m_remoteBackend.TellRegionToCloseChildConnection(regionHandle, agentID); | 260 | return m_remoteBackend.TellRegionToCloseChildConnection(regionHandle, agentID); |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | #endregion | 264 | #endregion |
265 | 265 | ||
266 | #region Methods triggered by calls from external instances | 266 | #region Methods triggered by calls from external instances |
267 | 267 | ||
268 | /// <summary> | 268 | /// <summary> |
269 | /// | 269 | /// |
270 | /// </summary> | 270 | /// </summary> |
271 | /// <param name="regionHandle"></param> | 271 | /// <param name="regionHandle"></param> |
272 | /// <param name="agentData"></param> | 272 | /// <param name="agentData"></param> |
273 | /// <returns></returns> | 273 | /// <returns></returns> |
274 | public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) | 274 | public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) |
275 | { | 275 | { |
276 | HGIncomingChildAgent(regionHandle, agentData); | 276 | HGIncomingChildAgent(regionHandle, agentData); |
277 | 277 | ||
278 | m_log.Info("[HGrid]: Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname); | 278 | m_log.Info("[HGrid]: Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname); |
279 | 279 | ||
280 | return m_remoteBackend.IncomingChildAgent(regionHandle, agentData); | 280 | return m_remoteBackend.IncomingChildAgent(regionHandle, agentData); |
281 | } | 281 | } |
282 | #endregion | 282 | #endregion |
283 | 283 | ||
284 | } | 284 | } |
285 | } | 285 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs index 4dc26e0..5fb9615 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs | |||
@@ -1,928 +1,928 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Net.Sockets; | 32 | using System.Net.Sockets; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Runtime.Remoting; | 34 | using System.Runtime.Remoting; |
35 | using System.Runtime.Remoting.Channels; | 35 | using System.Runtime.Remoting.Channels; |
36 | using System.Runtime.Remoting.Channels.Tcp; | 36 | using System.Runtime.Remoting.Channels.Tcp; |
37 | using System.Security.Authentication; | 37 | using System.Security.Authentication; |
38 | 38 | ||
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Framework.Communications.Cache; | 41 | using OpenSim.Framework.Communications.Cache; |
42 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
43 | using OpenSim.Region.Communications.Local; | 43 | using OpenSim.Region.Communications.Local; |
44 | using OpenSim.Region.Communications.OGS1; | 44 | using OpenSim.Region.Communications.OGS1; |
45 | using OpenSim.Region.Environment.Scenes; | 45 | using OpenSim.Region.Environment.Scenes; |
46 | 46 | ||
47 | using OpenMetaverse; | 47 | using OpenMetaverse; |
48 | using Nwc.XmlRpc; | 48 | using Nwc.XmlRpc; |
49 | using log4net; | 49 | using log4net; |
50 | 50 | ||
51 | namespace OpenSim.Region.Communications.Hypergrid | 51 | namespace OpenSim.Region.Communications.Hypergrid |
52 | { | 52 | { |
53 | public class HGGridServicesStandalone : HGGridServices | 53 | public class HGGridServicesStandalone : HGGridServices |
54 | { | 54 | { |
55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
56 | 56 | ||
57 | /// <summary> | 57 | /// <summary> |
58 | /// Encapsulate local backend services for manipulation of local regions | 58 | /// Encapsulate local backend services for manipulation of local regions |
59 | /// </summary> | 59 | /// </summary> |
60 | protected LocalBackEndServices m_localBackend = new LocalBackEndServices(); | 60 | protected LocalBackEndServices m_localBackend = new LocalBackEndServices(); |
61 | 61 | ||
62 | private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>(); | 62 | private Dictionary<ulong, int> m_deadRegionCache = new Dictionary<ulong, int>(); |
63 | 63 | ||
64 | public LocalBackEndServices LocalBackend | 64 | public LocalBackEndServices LocalBackend |
65 | { | 65 | { |
66 | get { return m_localBackend; } | 66 | get { return m_localBackend; } |
67 | } | 67 | } |
68 | 68 | ||
69 | public override string gdebugRegionName | 69 | public override string gdebugRegionName |
70 | { | 70 | { |
71 | get { return m_localBackend.gdebugRegionName; } | 71 | get { return m_localBackend.gdebugRegionName; } |
72 | set { m_localBackend.gdebugRegionName = value; } | 72 | set { m_localBackend.gdebugRegionName = value; } |
73 | } | 73 | } |
74 | 74 | ||
75 | public override bool RegionLoginsEnabled | 75 | public override bool RegionLoginsEnabled |
76 | { | 76 | { |
77 | get { return m_localBackend.RegionLoginsEnabled; } | 77 | get { return m_localBackend.RegionLoginsEnabled; } |
78 | set { m_localBackend.RegionLoginsEnabled = value; } | 78 | set { m_localBackend.RegionLoginsEnabled = value; } |
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | public HGGridServicesStandalone(NetworkServersInfo servers_info, BaseHttpServer httpServe, AssetCache asscache, SceneManager sman) | 82 | public HGGridServicesStandalone(NetworkServersInfo servers_info, BaseHttpServer httpServe, AssetCache asscache, SceneManager sman) |
83 | : base(servers_info, httpServe, asscache, sman) | 83 | : base(servers_info, httpServe, asscache, sman) |
84 | { | 84 | { |
85 | //Respond to Grid Services requests | 85 | //Respond to Grid Services requests |
86 | httpServer.AddXmlRPCHandler("logoff_user", LogOffUser); | 86 | httpServer.AddXmlRPCHandler("logoff_user", LogOffUser); |
87 | httpServer.AddXmlRPCHandler("check", PingCheckReply); | 87 | httpServer.AddXmlRPCHandler("check", PingCheckReply); |
88 | httpServer.AddXmlRPCHandler("land_data", LandData); | 88 | httpServer.AddXmlRPCHandler("land_data", LandData); |
89 | 89 | ||
90 | StartRemoting(); | 90 | StartRemoting(); |
91 | } | 91 | } |
92 | 92 | ||
93 | #region IGridServices interface | 93 | #region IGridServices interface |
94 | 94 | ||
95 | public override RegionCommsListener RegisterRegion(RegionInfo regionInfo) | 95 | public override RegionCommsListener RegisterRegion(RegionInfo regionInfo) |
96 | { | 96 | { |
97 | if (!regionInfo.RegionID.Equals(UUID.Zero)) | 97 | if (!regionInfo.RegionID.Equals(UUID.Zero)) |
98 | { | 98 | { |
99 | m_regionsOnInstance.Add(regionInfo); | 99 | m_regionsOnInstance.Add(regionInfo); |
100 | return m_localBackend.RegisterRegion(regionInfo); | 100 | return m_localBackend.RegisterRegion(regionInfo); |
101 | } | 101 | } |
102 | else | 102 | else |
103 | return base.RegisterRegion(regionInfo); | 103 | return base.RegisterRegion(regionInfo); |
104 | 104 | ||
105 | } | 105 | } |
106 | 106 | ||
107 | public override bool DeregisterRegion(RegionInfo regionInfo) | 107 | public override bool DeregisterRegion(RegionInfo regionInfo) |
108 | { | 108 | { |
109 | bool success = m_localBackend.DeregisterRegion(regionInfo); | 109 | bool success = m_localBackend.DeregisterRegion(regionInfo); |
110 | if (!success) | 110 | if (!success) |
111 | success = base.DeregisterRegion(regionInfo); | 111 | success = base.DeregisterRegion(regionInfo); |
112 | return success; | 112 | return success; |
113 | } | 113 | } |
114 | 114 | ||
115 | public override List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) | 115 | public override List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) |
116 | { | 116 | { |
117 | List<SimpleRegionInfo> neighbours = m_localBackend.RequestNeighbours(x, y); | 117 | List<SimpleRegionInfo> neighbours = m_localBackend.RequestNeighbours(x, y); |
118 | List<SimpleRegionInfo> remotes = base.RequestNeighbours(x, y); | 118 | List<SimpleRegionInfo> remotes = base.RequestNeighbours(x, y); |
119 | neighbours.AddRange(remotes); | 119 | neighbours.AddRange(remotes); |
120 | 120 | ||
121 | return neighbours; | 121 | return neighbours; |
122 | } | 122 | } |
123 | 123 | ||
124 | public override RegionInfo RequestNeighbourInfo(UUID Region_UUID) | 124 | public override RegionInfo RequestNeighbourInfo(UUID Region_UUID) |
125 | { | 125 | { |
126 | RegionInfo info = m_localBackend.RequestNeighbourInfo(Region_UUID); | 126 | RegionInfo info = m_localBackend.RequestNeighbourInfo(Region_UUID); |
127 | if (info == null) | 127 | if (info == null) |
128 | info = base.RequestNeighbourInfo(Region_UUID); | 128 | info = base.RequestNeighbourInfo(Region_UUID); |
129 | return info; | 129 | return info; |
130 | } | 130 | } |
131 | 131 | ||
132 | public override RegionInfo RequestNeighbourInfo(ulong regionHandle) | 132 | public override RegionInfo RequestNeighbourInfo(ulong regionHandle) |
133 | { | 133 | { |
134 | RegionInfo info = m_localBackend.RequestNeighbourInfo(regionHandle); | 134 | RegionInfo info = m_localBackend.RequestNeighbourInfo(regionHandle); |
135 | //m_log.Info("[HGrid] Request neighbor info, local backend returned " + info); | 135 | //m_log.Info("[HGrid] Request neighbor info, local backend returned " + info); |
136 | if (info == null) | 136 | if (info == null) |
137 | info = base.RequestNeighbourInfo(regionHandle); | 137 | info = base.RequestNeighbourInfo(regionHandle); |
138 | return info; | 138 | return info; |
139 | } | 139 | } |
140 | 140 | ||
141 | public override RegionInfo RequestClosestRegion(string regionName) | 141 | public override RegionInfo RequestClosestRegion(string regionName) |
142 | { | 142 | { |
143 | RegionInfo info = m_localBackend.RequestClosestRegion(regionName); | 143 | RegionInfo info = m_localBackend.RequestClosestRegion(regionName); |
144 | if (info == null) | 144 | if (info == null) |
145 | info = base.RequestClosestRegion(regionName); | 145 | info = base.RequestClosestRegion(regionName); |
146 | return info; | 146 | return info; |
147 | } | 147 | } |
148 | 148 | ||
149 | public override List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) | 149 | public override List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) |
150 | { | 150 | { |
151 | //m_log.Info("[HGrid] Request map blocks " + minX + "-" + minY + "-" + maxX + "-" + maxY); | 151 | //m_log.Info("[HGrid] Request map blocks " + minX + "-" + minY + "-" + maxX + "-" + maxY); |
152 | List<MapBlockData> neighbours = m_localBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | 152 | List<MapBlockData> neighbours = m_localBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); |
153 | List<MapBlockData> remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | 153 | List<MapBlockData> remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); |
154 | neighbours.AddRange(remotes); | 154 | neighbours.AddRange(remotes); |
155 | 155 | ||
156 | return neighbours; | 156 | return neighbours; |
157 | } | 157 | } |
158 | 158 | ||
159 | public override LandData RequestLandData(ulong regionHandle, uint x, uint y) | 159 | public override LandData RequestLandData(ulong regionHandle, uint x, uint y) |
160 | { | 160 | { |
161 | LandData land = m_localBackend.RequestLandData(regionHandle, x, y); | 161 | LandData land = m_localBackend.RequestLandData(regionHandle, x, y); |
162 | if (land == null) | 162 | if (land == null) |
163 | land = base.RequestLandData(regionHandle, x, y); | 163 | land = base.RequestLandData(regionHandle, x, y); |
164 | return land; | 164 | return land; |
165 | } | 165 | } |
166 | 166 | ||
167 | public override List<RegionInfo> RequestNamedRegions(string name, int maxNumber) | 167 | public override List<RegionInfo> RequestNamedRegions(string name, int maxNumber) |
168 | { | 168 | { |
169 | List<RegionInfo> infos = m_localBackend.RequestNamedRegions(name, maxNumber); | 169 | List<RegionInfo> infos = m_localBackend.RequestNamedRegions(name, maxNumber); |
170 | List<RegionInfo> remotes = base.RequestNamedRegions(name, maxNumber); | 170 | List<RegionInfo> remotes = base.RequestNamedRegions(name, maxNumber); |
171 | infos.AddRange(remotes); | 171 | infos.AddRange(remotes); |
172 | return infos; | 172 | return infos; |
173 | } | 173 | } |
174 | 174 | ||
175 | #endregion | 175 | #endregion |
176 | 176 | ||
177 | #region XML Request Handlers | 177 | #region XML Request Handlers |
178 | 178 | ||
179 | /// <summary> | 179 | /// <summary> |
180 | /// A ping / version check | 180 | /// A ping / version check |
181 | /// </summary> | 181 | /// </summary> |
182 | /// <param name="request"></param> | 182 | /// <param name="request"></param> |
183 | /// <returns></returns> | 183 | /// <returns></returns> |
184 | public virtual XmlRpcResponse PingCheckReply(XmlRpcRequest request) | 184 | public virtual XmlRpcResponse PingCheckReply(XmlRpcRequest request) |
185 | { | 185 | { |
186 | XmlRpcResponse response = new XmlRpcResponse(); | 186 | XmlRpcResponse response = new XmlRpcResponse(); |
187 | 187 | ||
188 | Hashtable respData = new Hashtable(); | 188 | Hashtable respData = new Hashtable(); |
189 | respData["online"] = "true"; | 189 | respData["online"] = "true"; |
190 | 190 | ||
191 | m_localBackend.PingCheckReply(respData); | 191 | m_localBackend.PingCheckReply(respData); |
192 | 192 | ||
193 | response.Value = respData; | 193 | response.Value = respData; |
194 | 194 | ||
195 | return response; | 195 | return response; |
196 | } | 196 | } |
197 | 197 | ||
198 | 198 | ||
199 | // Grid Request Processing | 199 | // Grid Request Processing |
200 | /// <summary> | 200 | /// <summary> |
201 | /// Ooops, our Agent must be dead if we're getting this request! | 201 | /// Ooops, our Agent must be dead if we're getting this request! |
202 | /// </summary> | 202 | /// </summary> |
203 | /// <param name="request"></param> | 203 | /// <param name="request"></param> |
204 | /// <returns></returns> | 204 | /// <returns></returns> |
205 | public XmlRpcResponse LogOffUser(XmlRpcRequest request) | 205 | public XmlRpcResponse LogOffUser(XmlRpcRequest request) |
206 | { | 206 | { |
207 | m_log.Debug("[HGrid]: LogOff User Called"); | 207 | m_log.Debug("[HGrid]: LogOff User Called"); |
208 | 208 | ||
209 | Hashtable requestData = (Hashtable)request.Params[0]; | 209 | Hashtable requestData = (Hashtable)request.Params[0]; |
210 | string message = (string)requestData["message"]; | 210 | string message = (string)requestData["message"]; |
211 | UUID agentID = UUID.Zero; | 211 | UUID agentID = UUID.Zero; |
212 | UUID RegionSecret = UUID.Zero; | 212 | UUID RegionSecret = UUID.Zero; |
213 | UUID.TryParse((string)requestData["agent_id"], out agentID); | 213 | UUID.TryParse((string)requestData["agent_id"], out agentID); |
214 | UUID.TryParse((string)requestData["region_secret"], out RegionSecret); | 214 | UUID.TryParse((string)requestData["region_secret"], out RegionSecret); |
215 | 215 | ||
216 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | 216 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); |
217 | 217 | ||
218 | m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret, message); | 218 | m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret, message); |
219 | 219 | ||
220 | return new XmlRpcResponse(); | 220 | return new XmlRpcResponse(); |
221 | } | 221 | } |
222 | 222 | ||
223 | /// <summary> | 223 | /// <summary> |
224 | /// Someone asked us about parcel-information | 224 | /// Someone asked us about parcel-information |
225 | /// </summary> | 225 | /// </summary> |
226 | /// <param name="request"></param> | 226 | /// <param name="request"></param> |
227 | /// <returns></returns> | 227 | /// <returns></returns> |
228 | public XmlRpcResponse LandData(XmlRpcRequest request) | 228 | public XmlRpcResponse LandData(XmlRpcRequest request) |
229 | { | 229 | { |
230 | Hashtable requestData = (Hashtable)request.Params[0]; | 230 | Hashtable requestData = (Hashtable)request.Params[0]; |
231 | ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]); | 231 | ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]); |
232 | uint x = Convert.ToUInt32(requestData["x"]); | 232 | uint x = Convert.ToUInt32(requestData["x"]); |
233 | uint y = Convert.ToUInt32(requestData["y"]); | 233 | uint y = Convert.ToUInt32(requestData["y"]); |
234 | m_log.DebugFormat("[HGrid]: Got XML reqeuest for land data at {0}, {1} in region {2}", x, y, regionHandle); | 234 | m_log.DebugFormat("[HGrid]: Got XML reqeuest for land data at {0}, {1} in region {2}", x, y, regionHandle); |
235 | 235 | ||
236 | LandData landData = m_localBackend.RequestLandData(regionHandle, x, y); | 236 | LandData landData = m_localBackend.RequestLandData(regionHandle, x, y); |
237 | Hashtable hash = new Hashtable(); | 237 | Hashtable hash = new Hashtable(); |
238 | if (landData != null) | 238 | if (landData != null) |
239 | { | 239 | { |
240 | // for now, only push out the data we need for answering a ParcelInfoReqeust | 240 | // for now, only push out the data we need for answering a ParcelInfoReqeust |
241 | hash["AABBMax"] = landData.AABBMax.ToString(); | 241 | hash["AABBMax"] = landData.AABBMax.ToString(); |
242 | hash["AABBMin"] = landData.AABBMin.ToString(); | 242 | hash["AABBMin"] = landData.AABBMin.ToString(); |
243 | hash["Area"] = landData.Area.ToString(); | 243 | hash["Area"] = landData.Area.ToString(); |
244 | hash["AuctionID"] = landData.AuctionID.ToString(); | 244 | hash["AuctionID"] = landData.AuctionID.ToString(); |
245 | hash["Description"] = landData.Description; | 245 | hash["Description"] = landData.Description; |
246 | hash["Flags"] = landData.Flags.ToString(); | 246 | hash["Flags"] = landData.Flags.ToString(); |
247 | hash["GlobalID"] = landData.GlobalID.ToString(); | 247 | hash["GlobalID"] = landData.GlobalID.ToString(); |
248 | hash["Name"] = landData.Name; | 248 | hash["Name"] = landData.Name; |
249 | hash["OwnerID"] = landData.OwnerID.ToString(); | 249 | hash["OwnerID"] = landData.OwnerID.ToString(); |
250 | hash["SalePrice"] = landData.SalePrice.ToString(); | 250 | hash["SalePrice"] = landData.SalePrice.ToString(); |
251 | hash["SnapshotID"] = landData.SnapshotID.ToString(); | 251 | hash["SnapshotID"] = landData.SnapshotID.ToString(); |
252 | hash["UserLocation"] = landData.UserLocation.ToString(); | 252 | hash["UserLocation"] = landData.UserLocation.ToString(); |
253 | } | 253 | } |
254 | 254 | ||
255 | XmlRpcResponse response = new XmlRpcResponse(); | 255 | XmlRpcResponse response = new XmlRpcResponse(); |
256 | response.Value = hash; | 256 | response.Value = hash; |
257 | return response; | 257 | return response; |
258 | } | 258 | } |
259 | 259 | ||
260 | #endregion | 260 | #endregion |
261 | 261 | ||
262 | #region Remoting | 262 | #region Remoting |
263 | 263 | ||
264 | /// <summary> | 264 | /// <summary> |
265 | /// Start listening for .net remoting calls from other regions. | 265 | /// Start listening for .net remoting calls from other regions. |
266 | /// </summary> | 266 | /// </summary> |
267 | private void StartRemoting() | 267 | private void StartRemoting() |
268 | { | 268 | { |
269 | m_log.Info("[HGrid]: Start remoting..."); | 269 | m_log.Info("[HGrid]: Start remoting..."); |
270 | TcpChannel ch; | 270 | TcpChannel ch; |
271 | try | 271 | try |
272 | { | 272 | { |
273 | ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort); | 273 | ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort); |
274 | ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesn't support this. | 274 | ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesn't support this. |
275 | } | 275 | } |
276 | catch (Exception ex) | 276 | catch (Exception ex) |
277 | { | 277 | { |
278 | m_log.Error("[HGrid]: Exception while attempting to listen on TCP port " + (int)NetworkServersInfo.RemotingListenerPort + "."); | 278 | m_log.Error("[HGrid]: Exception while attempting to listen on TCP port " + (int)NetworkServersInfo.RemotingListenerPort + "."); |
279 | throw (ex); | 279 | throw (ex); |
280 | } | 280 | } |
281 | 281 | ||
282 | WellKnownServiceTypeEntry wellType = | 282 | WellKnownServiceTypeEntry wellType = |
283 | new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", | 283 | new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", |
284 | WellKnownObjectMode.Singleton); | 284 | WellKnownObjectMode.Singleton); |
285 | RemotingConfiguration.RegisterWellKnownServiceType(wellType); | 285 | RemotingConfiguration.RegisterWellKnownServiceType(wellType); |
286 | InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing; | 286 | InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing; |
287 | InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; | 287 | InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; |
288 | InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; | 288 | InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; |
289 | InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; | 289 | InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; |
290 | InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; | 290 | InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; |
291 | InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; | 291 | InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; |
292 | InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection; | 292 | InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection; |
293 | } | 293 | } |
294 | 294 | ||
295 | 295 | ||
296 | #endregion | 296 | #endregion |
297 | 297 | ||
298 | #region IInterRegionCommunications interface (Methods called by regions in this instance) | 298 | #region IInterRegionCommunications interface (Methods called by regions in this instance) |
299 | 299 | ||
300 | public override bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | 300 | public override bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) |
301 | { | 301 | { |
302 | int failures = 0; | 302 | int failures = 0; |
303 | lock (m_deadRegionCache) | 303 | lock (m_deadRegionCache) |
304 | { | 304 | { |
305 | if (m_deadRegionCache.ContainsKey(regionHandle)) | 305 | if (m_deadRegionCache.ContainsKey(regionHandle)) |
306 | { | 306 | { |
307 | failures = m_deadRegionCache[regionHandle]; | 307 | failures = m_deadRegionCache[regionHandle]; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | if (failures <= 3) | 310 | if (failures <= 3) |
311 | { | 311 | { |
312 | RegionInfo regInfo = null; | 312 | RegionInfo regInfo = null; |
313 | try | 313 | try |
314 | { | 314 | { |
315 | if (m_localBackend.ChildAgentUpdate(regionHandle, cAgentData)) | 315 | if (m_localBackend.ChildAgentUpdate(regionHandle, cAgentData)) |
316 | { | 316 | { |
317 | return true; | 317 | return true; |
318 | } | 318 | } |
319 | 319 | ||
320 | regInfo = RequestNeighbourInfo(regionHandle); | 320 | regInfo = RequestNeighbourInfo(regionHandle); |
321 | if (regInfo != null) | 321 | if (regInfo != null) |
322 | { | 322 | { |
323 | //don't want to be creating a new link to the remote instance every time like we are here | 323 | //don't want to be creating a new link to the remote instance every time like we are here |
324 | bool retValue = false; | 324 | bool retValue = false; |
325 | 325 | ||
326 | 326 | ||
327 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 327 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
328 | typeof(OGS1InterRegionRemoting), | 328 | typeof(OGS1InterRegionRemoting), |
329 | "tcp://" + regInfo.RemotingAddress + | 329 | "tcp://" + regInfo.RemotingAddress + |
330 | ":" + regInfo.RemotingPort + | 330 | ":" + regInfo.RemotingPort + |
331 | "/InterRegions"); | 331 | "/InterRegions"); |
332 | 332 | ||
333 | if (remObject != null) | 333 | if (remObject != null) |
334 | { | 334 | { |
335 | retValue = remObject.ChildAgentUpdate(regionHandle, cAgentData); | 335 | retValue = remObject.ChildAgentUpdate(regionHandle, cAgentData); |
336 | } | 336 | } |
337 | else | 337 | else |
338 | { | 338 | { |
339 | m_log.Warn("[HGrid]: remoting object not found"); | 339 | m_log.Warn("[HGrid]: remoting object not found"); |
340 | } | 340 | } |
341 | remObject = null; | 341 | remObject = null; |
342 | 342 | ||
343 | return retValue; | 343 | return retValue; |
344 | } | 344 | } |
345 | NoteDeadRegion(regionHandle); | 345 | NoteDeadRegion(regionHandle); |
346 | 346 | ||
347 | return false; | 347 | return false; |
348 | } | 348 | } |
349 | catch (RemotingException e) | 349 | catch (RemotingException e) |
350 | { | 350 | { |
351 | NoteDeadRegion(regionHandle); | 351 | NoteDeadRegion(regionHandle); |
352 | 352 | ||
353 | m_log.WarnFormat( | 353 | m_log.WarnFormat( |
354 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | 354 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", |
355 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 355 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
356 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 356 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
357 | 357 | ||
358 | return false; | 358 | return false; |
359 | } | 359 | } |
360 | catch (SocketException e) | 360 | catch (SocketException e) |
361 | { | 361 | { |
362 | NoteDeadRegion(regionHandle); | 362 | NoteDeadRegion(regionHandle); |
363 | 363 | ||
364 | m_log.WarnFormat( | 364 | m_log.WarnFormat( |
365 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | 365 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", |
366 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 366 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
367 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 367 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
368 | 368 | ||
369 | return false; | 369 | return false; |
370 | } | 370 | } |
371 | catch (InvalidCredentialException e) | 371 | catch (InvalidCredentialException e) |
372 | { | 372 | { |
373 | NoteDeadRegion(regionHandle); | 373 | NoteDeadRegion(regionHandle); |
374 | 374 | ||
375 | m_log.WarnFormat( | 375 | m_log.WarnFormat( |
376 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | 376 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", |
377 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 377 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
378 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 378 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
379 | 379 | ||
380 | return false; | 380 | return false; |
381 | } | 381 | } |
382 | catch (AuthenticationException e) | 382 | catch (AuthenticationException e) |
383 | { | 383 | { |
384 | NoteDeadRegion(regionHandle); | 384 | NoteDeadRegion(regionHandle); |
385 | 385 | ||
386 | m_log.WarnFormat( | 386 | m_log.WarnFormat( |
387 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | 387 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", |
388 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 388 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
389 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 389 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
390 | 390 | ||
391 | return false; | 391 | return false; |
392 | } | 392 | } |
393 | catch (Exception e) | 393 | catch (Exception e) |
394 | { | 394 | { |
395 | NoteDeadRegion(regionHandle); | 395 | NoteDeadRegion(regionHandle); |
396 | 396 | ||
397 | m_log.WarnFormat("[HGrid]: Unable to connect to adjacent region: {0} {1},{2}", | 397 | m_log.WarnFormat("[HGrid]: Unable to connect to adjacent region: {0} {1},{2}", |
398 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | 398 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); |
399 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 399 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
400 | 400 | ||
401 | return false; | 401 | return false; |
402 | } | 402 | } |
403 | } | 403 | } |
404 | else | 404 | else |
405 | { | 405 | { |
406 | //m_log.Info("[INTERREGION]: Skipped Sending Child Update to a region because it failed too many times:" + regionHandle.ToString()); | 406 | //m_log.Info("[INTERREGION]: Skipped Sending Child Update to a region because it failed too many times:" + regionHandle.ToString()); |
407 | return false; | 407 | return false; |
408 | } | 408 | } |
409 | } | 409 | } |
410 | 410 | ||
411 | /// <summary> | 411 | /// <summary> |
412 | /// Inform a region that a child agent will be on the way from a client. | 412 | /// Inform a region that a child agent will be on the way from a client. |
413 | /// </summary> | 413 | /// </summary> |
414 | /// <param name="regionHandle"></param> | 414 | /// <param name="regionHandle"></param> |
415 | /// <param name="agentData"></param> | 415 | /// <param name="agentData"></param> |
416 | /// <returns></returns> | 416 | /// <returns></returns> |
417 | public override bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | 417 | public override bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) |
418 | { | 418 | { |
419 | 419 | ||
420 | if (m_localBackend.InformRegionOfChildAgent(regionHandle, agentData)) | 420 | if (m_localBackend.InformRegionOfChildAgent(regionHandle, agentData)) |
421 | { | 421 | { |
422 | return true; | 422 | return true; |
423 | } | 423 | } |
424 | return base.InformRegionOfChildAgent(regionHandle, agentData); | 424 | return base.InformRegionOfChildAgent(regionHandle, agentData); |
425 | } | 425 | } |
426 | 426 | ||
427 | // UGLY! | 427 | // UGLY! |
428 | public override bool RegionUp(SerializableRegionInfo region, ulong regionhandle) | 428 | public override bool RegionUp(SerializableRegionInfo region, ulong regionhandle) |
429 | { | 429 | { |
430 | if (m_localBackend.RegionUp(region, regionhandle)) | 430 | if (m_localBackend.RegionUp(region, regionhandle)) |
431 | return true; | 431 | return true; |
432 | return base.RegionUp(region, regionhandle); | 432 | return base.RegionUp(region, regionhandle); |
433 | } | 433 | } |
434 | 434 | ||
435 | /// <summary> | 435 | /// <summary> |
436 | /// | 436 | /// |
437 | /// </summary> | 437 | /// </summary> |
438 | /// <param name="regionHandle"></param> | 438 | /// <param name="regionHandle"></param> |
439 | /// <param name="agentData"></param> | 439 | /// <param name="agentData"></param> |
440 | /// <returns></returns> | 440 | /// <returns></returns> |
441 | public override bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) | 441 | public override bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) |
442 | { | 442 | { |
443 | int failures = 0; | 443 | int failures = 0; |
444 | lock (m_deadRegionCache) | 444 | lock (m_deadRegionCache) |
445 | { | 445 | { |
446 | if (m_deadRegionCache.ContainsKey(regionHandle)) | 446 | if (m_deadRegionCache.ContainsKey(regionHandle)) |
447 | { | 447 | { |
448 | failures = m_deadRegionCache[regionHandle]; | 448 | failures = m_deadRegionCache[regionHandle]; |
449 | } | 449 | } |
450 | } | 450 | } |
451 | if (failures <= 1) | 451 | if (failures <= 1) |
452 | { | 452 | { |
453 | RegionInfo regInfo = null; | 453 | RegionInfo regInfo = null; |
454 | try | 454 | try |
455 | { | 455 | { |
456 | if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod)) | 456 | if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod)) |
457 | { | 457 | { |
458 | return true; | 458 | return true; |
459 | } | 459 | } |
460 | 460 | ||
461 | regInfo = RequestNeighbourInfo(regionHandle); | 461 | regInfo = RequestNeighbourInfo(regionHandle); |
462 | if (regInfo != null) | 462 | if (regInfo != null) |
463 | { | 463 | { |
464 | //don't want to be creating a new link to the remote instance every time like we are here | 464 | //don't want to be creating a new link to the remote instance every time like we are here |
465 | bool retValue = false; | 465 | bool retValue = false; |
466 | 466 | ||
467 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 467 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
468 | typeof(OGS1InterRegionRemoting), | 468 | typeof(OGS1InterRegionRemoting), |
469 | "tcp://" + regInfo.RemotingAddress + | 469 | "tcp://" + regInfo.RemotingAddress + |
470 | ":" + regInfo.RemotingPort + | 470 | ":" + regInfo.RemotingPort + |
471 | "/InterRegions"); | 471 | "/InterRegions"); |
472 | 472 | ||
473 | if (remObject != null) | 473 | if (remObject != null) |
474 | { | 474 | { |
475 | retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.Guid, objData, XMLMethod); | 475 | retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.Guid, objData, XMLMethod); |
476 | } | 476 | } |
477 | else | 477 | else |
478 | { | 478 | { |
479 | m_log.Warn("[HGrid]: Remoting object not found"); | 479 | m_log.Warn("[HGrid]: Remoting object not found"); |
480 | } | 480 | } |
481 | remObject = null; | 481 | remObject = null; |
482 | 482 | ||
483 | return retValue; | 483 | return retValue; |
484 | } | 484 | } |
485 | NoteDeadRegion(regionHandle); | 485 | NoteDeadRegion(regionHandle); |
486 | return false; | 486 | return false; |
487 | } | 487 | } |
488 | catch (RemotingException e) | 488 | catch (RemotingException e) |
489 | { | 489 | { |
490 | NoteDeadRegion(regionHandle); | 490 | NoteDeadRegion(regionHandle); |
491 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | 491 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); |
492 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 492 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
493 | return false; | 493 | return false; |
494 | } | 494 | } |
495 | catch (SocketException e) | 495 | catch (SocketException e) |
496 | { | 496 | { |
497 | NoteDeadRegion(regionHandle); | 497 | NoteDeadRegion(regionHandle); |
498 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | 498 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); |
499 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 499 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
500 | return false; | 500 | return false; |
501 | } | 501 | } |
502 | catch (InvalidCredentialException e) | 502 | catch (InvalidCredentialException e) |
503 | { | 503 | { |
504 | NoteDeadRegion(regionHandle); | 504 | NoteDeadRegion(regionHandle); |
505 | m_log.Warn("[HGrid]: Invalid Credential Exception: Invalid Credentials : " + regionHandle); | 505 | m_log.Warn("[HGrid]: Invalid Credential Exception: Invalid Credentials : " + regionHandle); |
506 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 506 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
507 | return false; | 507 | return false; |
508 | } | 508 | } |
509 | catch (AuthenticationException e) | 509 | catch (AuthenticationException e) |
510 | { | 510 | { |
511 | NoteDeadRegion(regionHandle); | 511 | NoteDeadRegion(regionHandle); |
512 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region: " + regionHandle); | 512 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region: " + regionHandle); |
513 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 513 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
514 | return false; | 514 | return false; |
515 | } | 515 | } |
516 | catch (Exception e) | 516 | catch (Exception e) |
517 | { | 517 | { |
518 | NoteDeadRegion(regionHandle); | 518 | NoteDeadRegion(regionHandle); |
519 | m_log.Warn("[HGrid]: Unknown exception: Unable to connect to adjacent region: " + regionHandle); | 519 | m_log.Warn("[HGrid]: Unknown exception: Unable to connect to adjacent region: " + regionHandle); |
520 | m_log.DebugFormat("[HGrid]: {0}", e); | 520 | m_log.DebugFormat("[HGrid]: {0}", e); |
521 | return false; | 521 | return false; |
522 | } | 522 | } |
523 | } | 523 | } |
524 | else | 524 | else |
525 | { | 525 | { |
526 | return false; | 526 | return false; |
527 | } | 527 | } |
528 | } | 528 | } |
529 | 529 | ||
530 | /// <summary> | 530 | /// <summary> |
531 | /// | 531 | /// |
532 | /// </summary> | 532 | /// </summary> |
533 | /// <param name="regionHandle"></param> | 533 | /// <param name="regionHandle"></param> |
534 | /// <param name="agentID"></param> | 534 | /// <param name="agentID"></param> |
535 | /// <param name="position"></param> | 535 | /// <param name="position"></param> |
536 | /// <returns></returns> | 536 | /// <returns></returns> |
537 | public override bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | 537 | public override bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) |
538 | { | 538 | { |
539 | 539 | ||
540 | RegionInfo[] regions = m_regionsOnInstance.ToArray(); | 540 | RegionInfo[] regions = m_regionsOnInstance.ToArray(); |
541 | bool banned = false; | 541 | bool banned = false; |
542 | bool localregion = false; | 542 | bool localregion = false; |
543 | 543 | ||
544 | for (int i = 0; i < regions.Length; i++) | 544 | for (int i = 0; i < regions.Length; i++) |
545 | { | 545 | { |
546 | if (regions[i] != null) | 546 | if (regions[i] != null) |
547 | { | 547 | { |
548 | if (regions[i].RegionHandle == regionHandle) | 548 | if (regions[i].RegionHandle == regionHandle) |
549 | { | 549 | { |
550 | localregion = true; | 550 | localregion = true; |
551 | if (regions[i].EstateSettings.IsBanned(agentID)) | 551 | if (regions[i].EstateSettings.IsBanned(agentID)) |
552 | { | 552 | { |
553 | banned = true; | 553 | banned = true; |
554 | break; | 554 | break; |
555 | } | 555 | } |
556 | } | 556 | } |
557 | } | 557 | } |
558 | } | 558 | } |
559 | 559 | ||
560 | if (banned) | 560 | if (banned) |
561 | return false; | 561 | return false; |
562 | if (localregion) | 562 | if (localregion) |
563 | return m_localBackend.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | 563 | return m_localBackend.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
564 | 564 | ||
565 | return base.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | 565 | return base.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
566 | 566 | ||
567 | } | 567 | } |
568 | 568 | ||
569 | public override bool ExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) | 569 | public override bool ExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) |
570 | { | 570 | { |
571 | RegionInfo regInfo = null; | 571 | RegionInfo regInfo = null; |
572 | try | 572 | try |
573 | { | 573 | { |
574 | if (m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical)) | 574 | if (m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical)) |
575 | { | 575 | { |
576 | return true; | 576 | return true; |
577 | } | 577 | } |
578 | 578 | ||
579 | regInfo = RequestNeighbourInfo(regionHandle); | 579 | regInfo = RequestNeighbourInfo(regionHandle); |
580 | if (regInfo != null) | 580 | if (regInfo != null) |
581 | { | 581 | { |
582 | bool retValue = false; | 582 | bool retValue = false; |
583 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 583 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
584 | typeof(OGS1InterRegionRemoting), | 584 | typeof(OGS1InterRegionRemoting), |
585 | "tcp://" + regInfo.RemotingAddress + | 585 | "tcp://" + regInfo.RemotingAddress + |
586 | ":" + regInfo.RemotingPort + | 586 | ":" + regInfo.RemotingPort + |
587 | "/InterRegions"); | 587 | "/InterRegions"); |
588 | 588 | ||
589 | if (remObject != null) | 589 | if (remObject != null) |
590 | { | 590 | { |
591 | retValue = | 591 | retValue = |
592 | remObject.ExpectAvatarCrossing(regionHandle, agentID.Guid, new sLLVector3(position), | 592 | remObject.ExpectAvatarCrossing(regionHandle, agentID.Guid, new sLLVector3(position), |
593 | isPhysical); | 593 | isPhysical); |
594 | } | 594 | } |
595 | else | 595 | else |
596 | { | 596 | { |
597 | m_log.Warn("[HGrid]: Remoting object not found"); | 597 | m_log.Warn("[HGrid]: Remoting object not found"); |
598 | } | 598 | } |
599 | remObject = null; | 599 | remObject = null; |
600 | 600 | ||
601 | return retValue; | 601 | return retValue; |
602 | } | 602 | } |
603 | //TODO need to see if we know about where this region is and use .net remoting | 603 | //TODO need to see if we know about where this region is and use .net remoting |
604 | // to inform it. | 604 | // to inform it. |
605 | NoteDeadRegion(regionHandle); | 605 | NoteDeadRegion(regionHandle); |
606 | return false; | 606 | return false; |
607 | } | 607 | } |
608 | catch (RemotingException e) | 608 | catch (RemotingException e) |
609 | { | 609 | { |
610 | NoteDeadRegion(regionHandle); | 610 | NoteDeadRegion(regionHandle); |
611 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | 611 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); |
612 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 612 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
613 | return false; | 613 | return false; |
614 | } | 614 | } |
615 | catch (SocketException e) | 615 | catch (SocketException e) |
616 | { | 616 | { |
617 | NoteDeadRegion(regionHandle); | 617 | NoteDeadRegion(regionHandle); |
618 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | 618 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); |
619 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 619 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
620 | return false; | 620 | return false; |
621 | } | 621 | } |
622 | catch (InvalidCredentialException e) | 622 | catch (InvalidCredentialException e) |
623 | { | 623 | { |
624 | NoteDeadRegion(regionHandle); | 624 | NoteDeadRegion(regionHandle); |
625 | m_log.Warn("[HGrid]: Invalid Credential Exception: Invalid Credentials : " + regionHandle); | 625 | m_log.Warn("[HGrid]: Invalid Credential Exception: Invalid Credentials : " + regionHandle); |
626 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 626 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
627 | return false; | 627 | return false; |
628 | } | 628 | } |
629 | catch (AuthenticationException e) | 629 | catch (AuthenticationException e) |
630 | { | 630 | { |
631 | NoteDeadRegion(regionHandle); | 631 | NoteDeadRegion(regionHandle); |
632 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region: " + regionHandle); | 632 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region: " + regionHandle); |
633 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 633 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
634 | return false; | 634 | return false; |
635 | } | 635 | } |
636 | catch (Exception e) | 636 | catch (Exception e) |
637 | { | 637 | { |
638 | NoteDeadRegion(regionHandle); | 638 | NoteDeadRegion(regionHandle); |
639 | m_log.Warn("[HGrid]: Unknown exception: Unable to connect to adjacent region: " + regionHandle); | 639 | m_log.Warn("[HGrid]: Unknown exception: Unable to connect to adjacent region: " + regionHandle); |
640 | m_log.DebugFormat("[HGrid]: {0}", e); | 640 | m_log.DebugFormat("[HGrid]: {0}", e); |
641 | return false; | 641 | return false; |
642 | } | 642 | } |
643 | } | 643 | } |
644 | 644 | ||
645 | public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | 645 | public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) |
646 | { | 646 | { |
647 | RegionInfo regInfo = null; | 647 | RegionInfo regInfo = null; |
648 | try | 648 | try |
649 | { | 649 | { |
650 | if (m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID)) | 650 | if (m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID)) |
651 | { | 651 | { |
652 | return true; | 652 | return true; |
653 | } | 653 | } |
654 | 654 | ||
655 | regInfo = RequestNeighbourInfo(regionHandle); | 655 | regInfo = RequestNeighbourInfo(regionHandle); |
656 | if (regInfo != null) | 656 | if (regInfo != null) |
657 | { | 657 | { |
658 | // bool retValue = false; | 658 | // bool retValue = false; |
659 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 659 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
660 | typeof(OGS1InterRegionRemoting), | 660 | typeof(OGS1InterRegionRemoting), |
661 | "tcp://" + regInfo.RemotingAddress + | 661 | "tcp://" + regInfo.RemotingAddress + |
662 | ":" + regInfo.RemotingPort + | 662 | ":" + regInfo.RemotingPort + |
663 | "/InterRegions"); | 663 | "/InterRegions"); |
664 | 664 | ||
665 | if (remObject != null) | 665 | if (remObject != null) |
666 | { | 666 | { |
667 | // retValue = | 667 | // retValue = |
668 | remObject.TellRegionToCloseChildConnection(regionHandle, agentID.Guid); | 668 | remObject.TellRegionToCloseChildConnection(regionHandle, agentID.Guid); |
669 | } | 669 | } |
670 | else | 670 | else |
671 | { | 671 | { |
672 | m_log.Warn("[HGrid]: Remoting object not found"); | 672 | m_log.Warn("[HGrid]: Remoting object not found"); |
673 | } | 673 | } |
674 | remObject = null; | 674 | remObject = null; |
675 | 675 | ||
676 | return true; | 676 | return true; |
677 | } | 677 | } |
678 | //TODO need to see if we know about where this region is and use .net remoting | 678 | //TODO need to see if we know about where this region is and use .net remoting |
679 | // to inform it. | 679 | // to inform it. |
680 | NoteDeadRegion(regionHandle); | 680 | NoteDeadRegion(regionHandle); |
681 | return false; | 681 | return false; |
682 | } | 682 | } |
683 | catch (RemotingException) | 683 | catch (RemotingException) |
684 | { | 684 | { |
685 | NoteDeadRegion(regionHandle); | 685 | NoteDeadRegion(regionHandle); |
686 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName + | 686 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName + |
687 | " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 687 | " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
688 | //m_log.Debug(e.ToString()); | 688 | //m_log.Debug(e.ToString()); |
689 | return false; | 689 | return false; |
690 | } | 690 | } |
691 | catch (SocketException e) | 691 | catch (SocketException e) |
692 | { | 692 | { |
693 | NoteDeadRegion(regionHandle); | 693 | NoteDeadRegion(regionHandle); |
694 | m_log.Warn("[HGridS]: Socket Error: Unable to connect to adjacent region using tcp://" + | 694 | m_log.Warn("[HGridS]: Socket Error: Unable to connect to adjacent region using tcp://" + |
695 | regInfo.RemotingAddress + | 695 | regInfo.RemotingAddress + |
696 | ":" + regInfo.RemotingPort + | 696 | ":" + regInfo.RemotingPort + |
697 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + | 697 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + |
698 | " - Is this neighbor up?"); | 698 | " - Is this neighbor up?"); |
699 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 699 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
700 | return false; | 700 | return false; |
701 | } | 701 | } |
702 | catch (InvalidCredentialException e) | 702 | catch (InvalidCredentialException e) |
703 | { | 703 | { |
704 | NoteDeadRegion(regionHandle); | 704 | NoteDeadRegion(regionHandle); |
705 | m_log.Warn("[HGrid]: Invalid Credentials: Unable to connect to adjacent region using tcp://" + | 705 | m_log.Warn("[HGrid]: Invalid Credentials: Unable to connect to adjacent region using tcp://" + |
706 | regInfo.RemotingAddress + | 706 | regInfo.RemotingAddress + |
707 | ":" + regInfo.RemotingPort + | 707 | ":" + regInfo.RemotingPort + |
708 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 708 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
709 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 709 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
710 | return false; | 710 | return false; |
711 | } | 711 | } |
712 | catch (AuthenticationException e) | 712 | catch (AuthenticationException e) |
713 | { | 713 | { |
714 | NoteDeadRegion(regionHandle); | 714 | NoteDeadRegion(regionHandle); |
715 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region using tcp://" + | 715 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region using tcp://" + |
716 | regInfo.RemotingAddress + | 716 | regInfo.RemotingAddress + |
717 | ":" + regInfo.RemotingPort + | 717 | ":" + regInfo.RemotingPort + |
718 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 718 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
719 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 719 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
720 | return false; | 720 | return false; |
721 | } | 721 | } |
722 | catch (WebException e) | 722 | catch (WebException e) |
723 | { | 723 | { |
724 | NoteDeadRegion(regionHandle); | 724 | NoteDeadRegion(regionHandle); |
725 | m_log.Warn("[HGrid]: WebException exception: Unable to connect to adjacent region using tcp://" + | 725 | m_log.Warn("[HGrid]: WebException exception: Unable to connect to adjacent region using tcp://" + |
726 | regInfo.RemotingAddress + | 726 | regInfo.RemotingAddress + |
727 | ":" + regInfo.RemotingPort + | 727 | ":" + regInfo.RemotingPort + |
728 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 728 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); |
729 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | 729 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); |
730 | return false; | 730 | return false; |
731 | } | 731 | } |
732 | catch (Exception e) | 732 | catch (Exception e) |
733 | { | 733 | { |
734 | NoteDeadRegion(regionHandle); | 734 | NoteDeadRegion(regionHandle); |
735 | // This line errors with a Null Reference Exception.. Why? @.@ | 735 | // This line errors with a Null Reference Exception.. Why? @.@ |
736 | //m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + | 736 | //m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + |
737 | // ":" + regInfo.RemotingPort + | 737 | // ":" + regInfo.RemotingPort + |
738 | //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); | 738 | //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); |
739 | m_log.DebugFormat("[HGrid]: {0}", e); | 739 | m_log.DebugFormat("[HGrid]: {0}", e); |
740 | return false; | 740 | return false; |
741 | } | 741 | } |
742 | } | 742 | } |
743 | 743 | ||
744 | public override bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) | 744 | public override bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) |
745 | { | 745 | { |
746 | return m_localBackend.AcknowledgeAgentCrossed(regionHandle, agentId); | 746 | return m_localBackend.AcknowledgeAgentCrossed(regionHandle, agentId); |
747 | } | 747 | } |
748 | 748 | ||
749 | public override bool AcknowledgePrimCrossed(ulong regionHandle, UUID primId) | 749 | public override bool AcknowledgePrimCrossed(ulong regionHandle, UUID primId) |
750 | { | 750 | { |
751 | return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId); | 751 | return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId); |
752 | } | 752 | } |
753 | 753 | ||
754 | #endregion | 754 | #endregion |
755 | 755 | ||
756 | #region Methods triggered by calls from external instances | 756 | #region Methods triggered by calls from external instances |
757 | 757 | ||
758 | /// <summary> | 758 | /// <summary> |
759 | /// | 759 | /// |
760 | /// </summary> | 760 | /// </summary> |
761 | /// <param name="regionHandle"></param> | 761 | /// <param name="regionHandle"></param> |
762 | /// <param name="agentData"></param> | 762 | /// <param name="agentData"></param> |
763 | /// <returns></returns> | 763 | /// <returns></returns> |
764 | public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) | 764 | public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) |
765 | { | 765 | { |
766 | HGIncomingChildAgent(regionHandle, agentData); | 766 | HGIncomingChildAgent(regionHandle, agentData); |
767 | 767 | ||
768 | m_log.Info("[HGrid]: " + gdebugRegionName + ": Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname); | 768 | m_log.Info("[HGrid]: " + gdebugRegionName + ": Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname); |
769 | 769 | ||
770 | return m_localBackend.IncomingChildAgent(regionHandle, agentData); | 770 | return m_localBackend.IncomingChildAgent(regionHandle, agentData); |
771 | } | 771 | } |
772 | 772 | ||
773 | public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle) | 773 | public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle) |
774 | { | 774 | { |
775 | m_log.Info( | 775 | m_log.Info( |
776 | "[HGrid]: " + | 776 | "[HGrid]: " + |
777 | m_localBackend._gdebugRegionName + "Incoming HGrid RegionUpReport: " + "(" + regionData.X + | 777 | m_localBackend._gdebugRegionName + "Incoming HGrid RegionUpReport: " + "(" + regionData.X + |
778 | "," + regionData.Y + "). Giving this region a fresh set of 'dead' tries"); | 778 | "," + regionData.Y + "). Giving this region a fresh set of 'dead' tries"); |
779 | 779 | ||
780 | RegionInfo nRegionInfo = new RegionInfo(); | 780 | RegionInfo nRegionInfo = new RegionInfo(); |
781 | nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT); | 781 | nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT); |
782 | nRegionInfo.ExternalHostName = regionData.IPADDR; | 782 | nRegionInfo.ExternalHostName = regionData.IPADDR; |
783 | nRegionInfo.RegionLocX = regionData.X; | 783 | nRegionInfo.RegionLocX = regionData.X; |
784 | nRegionInfo.RegionLocY = regionData.Y; | 784 | nRegionInfo.RegionLocY = regionData.Y; |
785 | 785 | ||
786 | lock (m_deadRegionCache) | 786 | lock (m_deadRegionCache) |
787 | { | 787 | { |
788 | if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle)) | 788 | if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle)) |
789 | { | 789 | { |
790 | m_deadRegionCache.Remove(nRegionInfo.RegionHandle); | 790 | m_deadRegionCache.Remove(nRegionInfo.RegionHandle); |
791 | } | 791 | } |
792 | } | 792 | } |
793 | 793 | ||
794 | return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle); | 794 | return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle); |
795 | } | 795 | } |
796 | 796 | ||
797 | public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | 797 | public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) |
798 | { | 798 | { |
799 | //m_log.Info("[INTER]: Incoming HGrid Child Agent Data Update"); | 799 | //m_log.Info("[INTER]: Incoming HGrid Child Agent Data Update"); |
800 | 800 | ||
801 | return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData); | 801 | return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData); |
802 | } | 802 | } |
803 | 803 | ||
804 | /// <summary> | 804 | /// <summary> |
805 | /// | 805 | /// |
806 | /// </summary> | 806 | /// </summary> |
807 | /// <param name="regionHandle"></param> | 807 | /// <param name="regionHandle"></param> |
808 | /// <param name="agentData"></param> | 808 | /// <param name="agentData"></param> |
809 | /// <returns></returns> | 809 | /// <returns></returns> |
810 | public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod) | 810 | public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod) |
811 | { | 811 | { |
812 | m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); | 812 | m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); |
813 | 813 | ||
814 | return true; | 814 | return true; |
815 | } | 815 | } |
816 | 816 | ||
817 | /// <summary> | 817 | /// <summary> |
818 | /// | 818 | /// |
819 | /// </summary> | 819 | /// </summary> |
820 | /// <param name="regionHandle"></param> | 820 | /// <param name="regionHandle"></param> |
821 | /// <param name="agentID"></param> | 821 | /// <param name="agentID"></param> |
822 | /// <param name="position"></param> | 822 | /// <param name="position"></param> |
823 | /// <returns></returns> | 823 | /// <returns></returns> |
824 | public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | 824 | public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) |
825 | { | 825 | { |
826 | return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | 826 | return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); |
827 | } | 827 | } |
828 | 828 | ||
829 | public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) | 829 | public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) |
830 | { | 830 | { |
831 | return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical); | 831 | return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical); |
832 | } | 832 | } |
833 | 833 | ||
834 | public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | 834 | public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) |
835 | { | 835 | { |
836 | return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID); | 836 | return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID); |
837 | } | 837 | } |
838 | 838 | ||
839 | int timeOut = 10; //10 seconds | 839 | int timeOut = 10; //10 seconds |
840 | /// <summary> | 840 | /// <summary> |
841 | /// Check that a region is available for TCP comms. This is necessary for .NET remoting between regions. | 841 | /// Check that a region is available for TCP comms. This is necessary for .NET remoting between regions. |
842 | /// </summary> | 842 | /// </summary> |
843 | /// <param name="address"></param> | 843 | /// <param name="address"></param> |
844 | /// <param name="port"></param> | 844 | /// <param name="port"></param> |
845 | /// <param name="retry"></param> | 845 | /// <param name="retry"></param> |
846 | /// <returns></returns> | 846 | /// <returns></returns> |
847 | public bool CheckRegion(string address, uint port, bool retry) | 847 | public bool CheckRegion(string address, uint port, bool retry) |
848 | { | 848 | { |
849 | bool available = false; | 849 | bool available = false; |
850 | bool timed_out = true; | 850 | bool timed_out = true; |
851 | 851 | ||
852 | IPAddress ia; | 852 | IPAddress ia; |
853 | IPAddress.TryParse(address, out ia); | 853 | IPAddress.TryParse(address, out ia); |
854 | IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port); | 854 | IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port); |
855 | 855 | ||
856 | AsyncCallback callback = delegate(IAsyncResult iar) | 856 | AsyncCallback callback = delegate(IAsyncResult iar) |
857 | { | 857 | { |
858 | Socket s = (Socket)iar.AsyncState; | 858 | Socket s = (Socket)iar.AsyncState; |
859 | try | 859 | try |
860 | { | 860 | { |
861 | s.EndConnect(iar); | 861 | s.EndConnect(iar); |
862 | available = true; | 862 | available = true; |
863 | timed_out = false; | 863 | timed_out = false; |
864 | } | 864 | } |
865 | catch (Exception e) | 865 | catch (Exception e) |
866 | { | 866 | { |
867 | m_log.DebugFormat( | 867 | m_log.DebugFormat( |
868 | "[HGrid]: Callback EndConnect exception: {0}:{1}", e.Message, e.StackTrace); | 868 | "[HGrid]: Callback EndConnect exception: {0}:{1}", e.Message, e.StackTrace); |
869 | } | 869 | } |
870 | 870 | ||
871 | s.Close(); | 871 | s.Close(); |
872 | }; | 872 | }; |
873 | 873 | ||
874 | try | 874 | try |
875 | { | 875 | { |
876 | Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); | 876 | Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); |
877 | IAsyncResult ar = socket.BeginConnect(m_EndPoint, callback, socket); | 877 | IAsyncResult ar = socket.BeginConnect(m_EndPoint, callback, socket); |
878 | ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false); | 878 | ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false); |
879 | } | 879 | } |
880 | catch (Exception e) | 880 | catch (Exception e) |
881 | { | 881 | { |
882 | m_log.DebugFormat( | 882 | m_log.DebugFormat( |
883 | "[HGrid]: CheckRegion Socket Setup exception: {0}:{1}", e.Message, e.StackTrace); | 883 | "[HGrid]: CheckRegion Socket Setup exception: {0}:{1}", e.Message, e.StackTrace); |
884 | 884 | ||
885 | return false; | 885 | return false; |
886 | } | 886 | } |
887 | 887 | ||
888 | if (timed_out) | 888 | if (timed_out) |
889 | { | 889 | { |
890 | m_log.DebugFormat( | 890 | m_log.DebugFormat( |
891 | "[HGrid]: socket [{0}] timed out ({1}) waiting to obtain a connection.", | 891 | "[HGrid]: socket [{0}] timed out ({1}) waiting to obtain a connection.", |
892 | m_EndPoint, timeOut * 1000); | 892 | m_EndPoint, timeOut * 1000); |
893 | 893 | ||
894 | if (retry) | 894 | if (retry) |
895 | { | 895 | { |
896 | return CheckRegion(address, port, false); | 896 | return CheckRegion(address, port, false); |
897 | } | 897 | } |
898 | } | 898 | } |
899 | 899 | ||
900 | return available; | 900 | return available; |
901 | } | 901 | } |
902 | 902 | ||
903 | public override bool CheckRegion(string address, uint port) | 903 | public override bool CheckRegion(string address, uint port) |
904 | { | 904 | { |
905 | return CheckRegion(address, port, true); | 905 | return CheckRegion(address, port, true); |
906 | } | 906 | } |
907 | 907 | ||
908 | public void NoteDeadRegion(ulong regionhandle) | 908 | public void NoteDeadRegion(ulong regionhandle) |
909 | { | 909 | { |
910 | lock (m_deadRegionCache) | 910 | lock (m_deadRegionCache) |
911 | { | 911 | { |
912 | if (m_deadRegionCache.ContainsKey(regionhandle)) | 912 | if (m_deadRegionCache.ContainsKey(regionhandle)) |
913 | { | 913 | { |
914 | m_deadRegionCache[regionhandle] = m_deadRegionCache[regionhandle] + 1; | 914 | m_deadRegionCache[regionhandle] = m_deadRegionCache[regionhandle] + 1; |
915 | } | 915 | } |
916 | else | 916 | else |
917 | { | 917 | { |
918 | m_deadRegionCache.Add(regionhandle, 1); | 918 | m_deadRegionCache.Add(regionhandle, 1); |
919 | } | 919 | } |
920 | } | 920 | } |
921 | 921 | ||
922 | } | 922 | } |
923 | 923 | ||
924 | #endregion | 924 | #endregion |
925 | 925 | ||
926 | 926 | ||
927 | } | 927 | } |
928 | } | 928 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs index 136fea1..874e8fb 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs | |||
@@ -1,451 +1,451 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using log4net; | 33 | using log4net; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Framework.Statistics; | 38 | using OpenSim.Framework.Statistics; |
39 | using OpenSim.Region.Communications.Local; | 39 | using OpenSim.Region.Communications.Local; |
40 | 40 | ||
41 | namespace OpenSim.Region.Communications.Hypergrid | 41 | namespace OpenSim.Region.Communications.Hypergrid |
42 | { | 42 | { |
43 | public class HGInventoryService : LocalInventoryService, ISecureInventoryService | 43 | public class HGInventoryService : LocalInventoryService, ISecureInventoryService |
44 | { | 44 | { |
45 | private static readonly ILog m_log | 45 | private static readonly ILog m_log |
46 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private string _inventoryServerUrl; | 48 | private string _inventoryServerUrl; |
49 | //private Uri m_Uri; | 49 | //private Uri m_Uri; |
50 | private UserProfileCacheService m_userProfileCache; | 50 | private UserProfileCacheService m_userProfileCache; |
51 | private bool m_gridmode = false; | 51 | private bool m_gridmode = false; |
52 | 52 | ||
53 | private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory | 53 | private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory |
54 | = new Dictionary<UUID, InventoryReceiptCallback>(); | 54 | = new Dictionary<UUID, InventoryReceiptCallback>(); |
55 | 55 | ||
56 | public UserProfileCacheService UserProfileCache | 56 | public UserProfileCacheService UserProfileCache |
57 | { | 57 | { |
58 | set { m_userProfileCache = value; } | 58 | set { m_userProfileCache = value; } |
59 | } | 59 | } |
60 | 60 | ||
61 | public HGInventoryService(string inventoryServerUrl, UserProfileCacheService userProfileCacheService, bool gridmode) | 61 | public HGInventoryService(string inventoryServerUrl, UserProfileCacheService userProfileCacheService, bool gridmode) |
62 | { | 62 | { |
63 | _inventoryServerUrl = HGNetworkServersInfo.ServerURI(inventoryServerUrl); | 63 | _inventoryServerUrl = HGNetworkServersInfo.ServerURI(inventoryServerUrl); |
64 | //m_Uri = new Uri(_inventoryServerUrl); | 64 | //m_Uri = new Uri(_inventoryServerUrl); |
65 | m_userProfileCache = userProfileCacheService; | 65 | m_userProfileCache = userProfileCacheService; |
66 | m_gridmode = gridmode; | 66 | m_gridmode = gridmode; |
67 | } | 67 | } |
68 | 68 | ||
69 | #region ISecureInventoryService Members | 69 | #region ISecureInventoryService Members |
70 | 70 | ||
71 | public void RequestInventoryForUser(UUID userID, UUID session_id, InventoryReceiptCallback callback) | 71 | public void RequestInventoryForUser(UUID userID, UUID session_id, InventoryReceiptCallback callback) |
72 | { | 72 | { |
73 | if (IsLocalStandaloneUser(userID)) | 73 | if (IsLocalStandaloneUser(userID)) |
74 | { | 74 | { |
75 | base.RequestInventoryForUser(userID, callback); | 75 | base.RequestInventoryForUser(userID, callback); |
76 | return; | 76 | return; |
77 | } | 77 | } |
78 | 78 | ||
79 | // grid/hypergrid mode | 79 | // grid/hypergrid mode |
80 | if (!m_RequestingInventory.ContainsKey(userID)) | 80 | if (!m_RequestingInventory.ContainsKey(userID)) |
81 | { | 81 | { |
82 | m_RequestingInventory.Add(userID, callback); | 82 | m_RequestingInventory.Add(userID, callback); |
83 | 83 | ||
84 | try | 84 | try |
85 | { | 85 | { |
86 | string invServer = GetUserInventoryURI(userID); | 86 | string invServer = GetUserInventoryURI(userID); |
87 | m_log.InfoFormat( | 87 | m_log.InfoFormat( |
88 | "[HGrid INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1} ({2})", | 88 | "[HGrid INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1} ({2})", |
89 | /*_inventoryServerUrl*/ invServer, userID, userID.Guid); | 89 | /*_inventoryServerUrl*/ invServer, userID, userID.Guid); |
90 | 90 | ||
91 | 91 | ||
92 | RestSessionObjectPosterResponse<Guid, InventoryCollection> requester | 92 | RestSessionObjectPosterResponse<Guid, InventoryCollection> requester |
93 | = new RestSessionObjectPosterResponse<Guid, InventoryCollection>(); | 93 | = new RestSessionObjectPosterResponse<Guid, InventoryCollection>(); |
94 | requester.ResponseCallback = InventoryResponse; | 94 | requester.ResponseCallback = InventoryResponse; |
95 | 95 | ||
96 | requester.BeginPostObject(invServer + "/GetInventory/", userID.Guid, session_id.ToString(), userID.ToString()); | 96 | requester.BeginPostObject(invServer + "/GetInventory/", userID.Guid, session_id.ToString(), userID.ToString()); |
97 | 97 | ||
98 | //Test(userID.Guid); | 98 | //Test(userID.Guid); |
99 | 99 | ||
100 | //RestObjectPosterResponse<InventoryCollection> requester | 100 | //RestObjectPosterResponse<InventoryCollection> requester |
101 | // = new RestObjectPosterResponse<InventoryCollection>(); | 101 | // = new RestObjectPosterResponse<InventoryCollection>(); |
102 | //requester.ResponseCallback = InventoryResponse; | 102 | //requester.ResponseCallback = InventoryResponse; |
103 | 103 | ||
104 | //requester.BeginPostObject<Guid>(/*_inventoryServerUrl*/ invServer + "/GetInventory/", userID.Guid); | 104 | //requester.BeginPostObject<Guid>(/*_inventoryServerUrl*/ invServer + "/GetInventory/", userID.Guid); |
105 | 105 | ||
106 | //RestClient cli = new RestClient(invServer + "/GetInventory/" + userID.Guid); | 106 | //RestClient cli = new RestClient(invServer + "/GetInventory/" + userID.Guid); |
107 | //Stream reply = cli.Request(); | 107 | //Stream reply = cli.Request(); |
108 | } | 108 | } |
109 | catch (WebException e) | 109 | catch (WebException e) |
110 | { | 110 | { |
111 | if (StatsManager.SimExtraStats != null) | 111 | if (StatsManager.SimExtraStats != null) |
112 | StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure(); | 112 | StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure(); |
113 | 113 | ||
114 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Request inventory operation failed, {0} {1}", | 114 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Request inventory operation failed, {0} {1}", |
115 | e.Source, e.Message); | 115 | e.Source, e.Message); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | else | 118 | else |
119 | { | 119 | { |
120 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: RequestInventoryForUser() - could not find user profile for {0}", userID); | 120 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: RequestInventoryForUser() - could not find user profile for {0}", userID); |
121 | } | 121 | } |
122 | 122 | ||
123 | } | 123 | } |
124 | 124 | ||
125 | /// <summary> | 125 | /// <summary> |
126 | /// Add a new folder to the user's inventory | 126 | /// Add a new folder to the user's inventory |
127 | /// </summary> | 127 | /// </summary> |
128 | /// <param name="folder"></param> | 128 | /// <param name="folder"></param> |
129 | /// <returns>true if the folder was successfully added</returns> | 129 | /// <returns>true if the folder was successfully added</returns> |
130 | public bool AddFolder(InventoryFolderBase folder, UUID session_id) | 130 | public bool AddFolder(InventoryFolderBase folder, UUID session_id) |
131 | { | 131 | { |
132 | if (IsLocalStandaloneUser(folder.Owner)) | 132 | if (IsLocalStandaloneUser(folder.Owner)) |
133 | { | 133 | { |
134 | return base.AddFolder(folder); | 134 | return base.AddFolder(folder); |
135 | } | 135 | } |
136 | 136 | ||
137 | try | 137 | try |
138 | { | 138 | { |
139 | string invServ = GetUserInventoryURI(folder.Owner); | 139 | string invServ = GetUserInventoryURI(folder.Owner); |
140 | 140 | ||
141 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( | 141 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( |
142 | "POST", invServ + "/NewFolder/", folder, session_id.ToString(), folder.Owner.ToString()); | 142 | "POST", invServ + "/NewFolder/", folder, session_id.ToString(), folder.Owner.ToString()); |
143 | } | 143 | } |
144 | catch (WebException e) | 144 | catch (WebException e) |
145 | { | 145 | { |
146 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}", | 146 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}", |
147 | e.Source, e.Message); | 147 | e.Source, e.Message); |
148 | } | 148 | } |
149 | 149 | ||
150 | return false; | 150 | return false; |
151 | 151 | ||
152 | } | 152 | } |
153 | 153 | ||
154 | /// <summary> | 154 | /// <summary> |
155 | /// Update a folder in the user's inventory | 155 | /// Update a folder in the user's inventory |
156 | /// </summary> | 156 | /// </summary> |
157 | /// <param name="folder"></param> | 157 | /// <param name="folder"></param> |
158 | /// <returns>true if the folder was successfully updated</returns> | 158 | /// <returns>true if the folder was successfully updated</returns> |
159 | public bool UpdateFolder(InventoryFolderBase folder, UUID session_id) | 159 | public bool UpdateFolder(InventoryFolderBase folder, UUID session_id) |
160 | { | 160 | { |
161 | if (IsLocalStandaloneUser(folder.Owner)) | 161 | if (IsLocalStandaloneUser(folder.Owner)) |
162 | { | 162 | { |
163 | return base.UpdateFolder(folder); | 163 | return base.UpdateFolder(folder); |
164 | } | 164 | } |
165 | try | 165 | try |
166 | { | 166 | { |
167 | string invServ = GetUserInventoryURI(folder.Owner); | 167 | string invServ = GetUserInventoryURI(folder.Owner); |
168 | 168 | ||
169 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( | 169 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( |
170 | "POST", invServ + "/UpdateFolder/", folder, session_id.ToString(), folder.Owner.ToString()); | 170 | "POST", invServ + "/UpdateFolder/", folder, session_id.ToString(), folder.Owner.ToString()); |
171 | } | 171 | } |
172 | catch (WebException e) | 172 | catch (WebException e) |
173 | { | 173 | { |
174 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Update inventory folder operation failed, {0} {1}", | 174 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Update inventory folder operation failed, {0} {1}", |
175 | e.Source, e.Message); | 175 | e.Source, e.Message); |
176 | } | 176 | } |
177 | 177 | ||
178 | return false; | 178 | return false; |
179 | 179 | ||
180 | } | 180 | } |
181 | 181 | ||
182 | /// <summary> | 182 | /// <summary> |
183 | /// Move an inventory folder to a new location | 183 | /// Move an inventory folder to a new location |
184 | /// </summary> | 184 | /// </summary> |
185 | /// <param name="folder">A folder containing the details of the new location</param> | 185 | /// <param name="folder">A folder containing the details of the new location</param> |
186 | /// <returns>true if the folder was successfully moved</returns> | 186 | /// <returns>true if the folder was successfully moved</returns> |
187 | public bool MoveFolder(InventoryFolderBase folder, UUID session_id) | 187 | public bool MoveFolder(InventoryFolderBase folder, UUID session_id) |
188 | { | 188 | { |
189 | if (IsLocalStandaloneUser(folder.Owner)) | 189 | if (IsLocalStandaloneUser(folder.Owner)) |
190 | { | 190 | { |
191 | return base.MoveFolder(folder); | 191 | return base.MoveFolder(folder); |
192 | } | 192 | } |
193 | 193 | ||
194 | try | 194 | try |
195 | { | 195 | { |
196 | string invServ = GetUserInventoryURI(folder.Owner); | 196 | string invServ = GetUserInventoryURI(folder.Owner); |
197 | 197 | ||
198 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( | 198 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( |
199 | "POST", invServ + "/MoveFolder/", folder, session_id.ToString(), folder.Owner.ToString()); | 199 | "POST", invServ + "/MoveFolder/", folder, session_id.ToString(), folder.Owner.ToString()); |
200 | } | 200 | } |
201 | catch (WebException e) | 201 | catch (WebException e) |
202 | { | 202 | { |
203 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", | 203 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", |
204 | e.Source, e.Message); | 204 | e.Source, e.Message); |
205 | } | 205 | } |
206 | 206 | ||
207 | return false; | 207 | return false; |
208 | } | 208 | } |
209 | 209 | ||
210 | /// <summary> | 210 | /// <summary> |
211 | /// Purge an inventory folder of all its items and subfolders. | 211 | /// Purge an inventory folder of all its items and subfolders. |
212 | /// </summary> | 212 | /// </summary> |
213 | /// <param name="folder"></param> | 213 | /// <param name="folder"></param> |
214 | /// <returns>true if the folder was successfully purged</returns> | 214 | /// <returns>true if the folder was successfully purged</returns> |
215 | public bool PurgeFolder(InventoryFolderBase folder, UUID session_id) | 215 | public bool PurgeFolder(InventoryFolderBase folder, UUID session_id) |
216 | { | 216 | { |
217 | if (IsLocalStandaloneUser(folder.Owner)) | 217 | if (IsLocalStandaloneUser(folder.Owner)) |
218 | { | 218 | { |
219 | return base.PurgeFolder(folder); | 219 | return base.PurgeFolder(folder); |
220 | } | 220 | } |
221 | 221 | ||
222 | try | 222 | try |
223 | { | 223 | { |
224 | string invServ = GetUserInventoryURI(folder.Owner); | 224 | string invServ = GetUserInventoryURI(folder.Owner); |
225 | 225 | ||
226 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( | 226 | return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject( |
227 | "POST", invServ + "/PurgeFolder/", folder, session_id.ToString(), folder.Owner.ToString()); | 227 | "POST", invServ + "/PurgeFolder/", folder, session_id.ToString(), folder.Owner.ToString()); |
228 | } | 228 | } |
229 | catch (WebException e) | 229 | catch (WebException e) |
230 | { | 230 | { |
231 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", | 231 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", |
232 | e.Source, e.Message); | 232 | e.Source, e.Message); |
233 | } | 233 | } |
234 | 234 | ||
235 | return false; | 235 | return false; |
236 | } | 236 | } |
237 | 237 | ||
238 | /// <summary> | 238 | /// <summary> |
239 | /// Add a new item to the user's inventory | 239 | /// Add a new item to the user's inventory |
240 | /// </summary> | 240 | /// </summary> |
241 | /// <param name="item"></param> | 241 | /// <param name="item"></param> |
242 | /// <returns>true if the item was successfully added</returns> | 242 | /// <returns>true if the item was successfully added</returns> |
243 | public bool AddItem(InventoryItemBase item, UUID session_id) | 243 | public bool AddItem(InventoryItemBase item, UUID session_id) |
244 | { | 244 | { |
245 | if (IsLocalStandaloneUser(item.Owner)) | 245 | if (IsLocalStandaloneUser(item.Owner)) |
246 | { | 246 | { |
247 | return base.AddItem(item); | 247 | return base.AddItem(item); |
248 | } | 248 | } |
249 | 249 | ||
250 | try | 250 | try |
251 | { | 251 | { |
252 | string invServ = GetUserInventoryURI(item.Owner); | 252 | string invServ = GetUserInventoryURI(item.Owner); |
253 | 253 | ||
254 | return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( | 254 | return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( |
255 | "POST", invServ + "/NewItem/", item, session_id.ToString(), item.Owner.ToString()); | 255 | "POST", invServ + "/NewItem/", item, session_id.ToString(), item.Owner.ToString()); |
256 | } | 256 | } |
257 | catch (WebException e) | 257 | catch (WebException e) |
258 | { | 258 | { |
259 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}", | 259 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}", |
260 | e.Source, e.Message); | 260 | e.Source, e.Message); |
261 | } | 261 | } |
262 | 262 | ||
263 | return false; | 263 | return false; |
264 | } | 264 | } |
265 | 265 | ||
266 | /// <summary> | 266 | /// <summary> |
267 | /// Update an item in the user's inventory | 267 | /// Update an item in the user's inventory |
268 | /// </summary> | 268 | /// </summary> |
269 | /// <param name="item"></param> | 269 | /// <param name="item"></param> |
270 | /// <returns>true if the item was successfully updated</returns> | 270 | /// <returns>true if the item was successfully updated</returns> |
271 | public bool UpdateItem(InventoryItemBase item, UUID session_id) | 271 | public bool UpdateItem(InventoryItemBase item, UUID session_id) |
272 | { | 272 | { |
273 | if (IsLocalStandaloneUser(item.Owner)) | 273 | if (IsLocalStandaloneUser(item.Owner)) |
274 | { | 274 | { |
275 | return base.UpdateItem(item); | 275 | return base.UpdateItem(item); |
276 | } | 276 | } |
277 | 277 | ||
278 | try | 278 | try |
279 | { | 279 | { |
280 | string invServ = GetUserInventoryURI(item.Owner); | 280 | string invServ = GetUserInventoryURI(item.Owner); |
281 | return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( | 281 | return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( |
282 | "POST", invServ + "/NewItem/", item, session_id.ToString(), item.Owner.ToString()); | 282 | "POST", invServ + "/NewItem/", item, session_id.ToString(), item.Owner.ToString()); |
283 | } | 283 | } |
284 | catch (WebException e) | 284 | catch (WebException e) |
285 | { | 285 | { |
286 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}", | 286 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}", |
287 | e.Source, e.Message); | 287 | e.Source, e.Message); |
288 | } | 288 | } |
289 | 289 | ||
290 | return false; | 290 | return false; |
291 | } | 291 | } |
292 | 292 | ||
293 | /// <summary> | 293 | /// <summary> |
294 | /// Delete an item from the user's inventory | 294 | /// Delete an item from the user's inventory |
295 | /// </summary> | 295 | /// </summary> |
296 | /// <param name="item"></param> | 296 | /// <param name="item"></param> |
297 | /// <returns>true if the item was successfully deleted</returns> | 297 | /// <returns>true if the item was successfully deleted</returns> |
298 | public bool DeleteItem(InventoryItemBase item, UUID session_id) | 298 | public bool DeleteItem(InventoryItemBase item, UUID session_id) |
299 | { | 299 | { |
300 | if (IsLocalStandaloneUser(item.Owner)) | 300 | if (IsLocalStandaloneUser(item.Owner)) |
301 | { | 301 | { |
302 | return base.DeleteItem(item); | 302 | return base.DeleteItem(item); |
303 | } | 303 | } |
304 | 304 | ||
305 | try | 305 | try |
306 | { | 306 | { |
307 | string invServ = GetUserInventoryURI(item.Owner); | 307 | string invServ = GetUserInventoryURI(item.Owner); |
308 | 308 | ||
309 | return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( | 309 | return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( |
310 | "POST", invServ + "/DeleteItem/", item, session_id.ToString(), item.Owner.ToString()); | 310 | "POST", invServ + "/DeleteItem/", item, session_id.ToString(), item.Owner.ToString()); |
311 | } | 311 | } |
312 | catch (WebException e) | 312 | catch (WebException e) |
313 | { | 313 | { |
314 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}", | 314 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}", |
315 | e.Source, e.Message); | 315 | e.Source, e.Message); |
316 | } | 316 | } |
317 | 317 | ||
318 | return false; | 318 | return false; |
319 | } | 319 | } |
320 | #endregion | 320 | #endregion |
321 | 321 | ||
322 | #region Methods common to ISecureInventoryService and IInventoryService | 322 | #region Methods common to ISecureInventoryService and IInventoryService |
323 | 323 | ||
324 | /// <summary> | 324 | /// <summary> |
325 | /// Does the given user have an inventory structure? | 325 | /// Does the given user have an inventory structure? |
326 | /// </summary> | 326 | /// </summary> |
327 | /// <param name="userID"></param> | 327 | /// <param name="userID"></param> |
328 | /// <returns></returns> | 328 | /// <returns></returns> |
329 | public override bool HasInventoryForUser(UUID userID) | 329 | public override bool HasInventoryForUser(UUID userID) |
330 | { | 330 | { |
331 | if (IsLocalStandaloneUser(userID)) | 331 | if (IsLocalStandaloneUser(userID)) |
332 | { | 332 | { |
333 | return base.HasInventoryForUser(userID); | 333 | return base.HasInventoryForUser(userID); |
334 | } | 334 | } |
335 | return false; | 335 | return false; |
336 | } | 336 | } |
337 | 337 | ||
338 | /// <summary> | 338 | /// <summary> |
339 | /// Retrieve the root inventory folder for the given user. | 339 | /// Retrieve the root inventory folder for the given user. |
340 | /// </summary> | 340 | /// </summary> |
341 | /// <param name="userID"></param> | 341 | /// <param name="userID"></param> |
342 | /// <returns>null if no root folder was found</returns> | 342 | /// <returns>null if no root folder was found</returns> |
343 | public override InventoryFolderBase RequestRootFolder(UUID userID) | 343 | public override InventoryFolderBase RequestRootFolder(UUID userID) |
344 | { | 344 | { |
345 | if (IsLocalStandaloneUser(userID)) | 345 | if (IsLocalStandaloneUser(userID)) |
346 | { | 346 | { |
347 | return base.RequestRootFolder(userID); | 347 | return base.RequestRootFolder(userID); |
348 | } | 348 | } |
349 | 349 | ||
350 | return null; | 350 | return null; |
351 | } | 351 | } |
352 | 352 | ||
353 | #endregion | 353 | #endregion |
354 | 354 | ||
355 | 355 | ||
356 | /// <summary> | 356 | /// <summary> |
357 | /// Callback used by the inventory server GetInventory request | 357 | /// Callback used by the inventory server GetInventory request |
358 | /// </summary> | 358 | /// </summary> |
359 | /// <param name="userID"></param> | 359 | /// <param name="userID"></param> |
360 | private void InventoryResponse(InventoryCollection response) | 360 | private void InventoryResponse(InventoryCollection response) |
361 | { | 361 | { |
362 | UUID userID = response.UserID; | 362 | UUID userID = response.UserID; |
363 | if (m_RequestingInventory.ContainsKey(userID)) | 363 | if (m_RequestingInventory.ContainsKey(userID)) |
364 | { | 364 | { |
365 | m_log.InfoFormat("[HGrid INVENTORY SERVICE]: " + | 365 | m_log.InfoFormat("[HGrid INVENTORY SERVICE]: " + |
366 | "Received inventory response for user {0} containing {1} folders and {2} items", | 366 | "Received inventory response for user {0} containing {1} folders and {2} items", |
367 | userID, response.Folders.Count, response.Items.Count); | 367 | userID, response.Folders.Count, response.Items.Count); |
368 | 368 | ||
369 | InventoryFolderImpl rootFolder = null; | 369 | InventoryFolderImpl rootFolder = null; |
370 | InventoryReceiptCallback callback = m_RequestingInventory[userID]; | 370 | InventoryReceiptCallback callback = m_RequestingInventory[userID]; |
371 | 371 | ||
372 | ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); | 372 | ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); |
373 | ICollection<InventoryItemBase> items = new List<InventoryItemBase>(); | 373 | ICollection<InventoryItemBase> items = new List<InventoryItemBase>(); |
374 | 374 | ||
375 | foreach (InventoryFolderBase folder in response.Folders) | 375 | foreach (InventoryFolderBase folder in response.Folders) |
376 | { | 376 | { |
377 | if (folder.ParentID == UUID.Zero) | 377 | if (folder.ParentID == UUID.Zero) |
378 | { | 378 | { |
379 | rootFolder = new InventoryFolderImpl(folder); | 379 | rootFolder = new InventoryFolderImpl(folder); |
380 | folders.Add(rootFolder); | 380 | folders.Add(rootFolder); |
381 | 381 | ||
382 | break; | 382 | break; |
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
386 | if (rootFolder != null) | 386 | if (rootFolder != null) |
387 | { | 387 | { |
388 | foreach (InventoryFolderBase folder in response.Folders) | 388 | foreach (InventoryFolderBase folder in response.Folders) |
389 | { | 389 | { |
390 | if (folder.ID != rootFolder.ID) | 390 | if (folder.ID != rootFolder.ID) |
391 | { | 391 | { |
392 | folders.Add(new InventoryFolderImpl(folder)); | 392 | folders.Add(new InventoryFolderImpl(folder)); |
393 | } | 393 | } |
394 | } | 394 | } |
395 | 395 | ||
396 | foreach (InventoryItemBase item in response.Items) | 396 | foreach (InventoryItemBase item in response.Items) |
397 | { | 397 | { |
398 | items.Add(item); | 398 | items.Add(item); |
399 | } | 399 | } |
400 | } | 400 | } |
401 | else | 401 | else |
402 | { | 402 | { |
403 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID); | 403 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID); |
404 | } | 404 | } |
405 | 405 | ||
406 | callback(folders, items); | 406 | callback(folders, items); |
407 | 407 | ||
408 | m_RequestingInventory.Remove(userID); | 408 | m_RequestingInventory.Remove(userID); |
409 | } | 409 | } |
410 | else | 410 | else |
411 | { | 411 | { |
412 | m_log.WarnFormat( | 412 | m_log.WarnFormat( |
413 | "[HGrid INVENTORY SERVICE]: " + | 413 | "[HGrid INVENTORY SERVICE]: " + |
414 | "Received inventory response for {0} for which we do not have a record of requesting!", | 414 | "Received inventory response for {0} for which we do not have a record of requesting!", |
415 | userID); | 415 | userID); |
416 | } | 416 | } |
417 | } | 417 | } |
418 | 418 | ||
419 | 419 | ||
420 | private bool IsLocalStandaloneUser(UUID userID) | 420 | private bool IsLocalStandaloneUser(UUID userID) |
421 | { | 421 | { |
422 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userID); | 422 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userID); |
423 | if (uinfo == null) | 423 | if (uinfo == null) |
424 | return true; | 424 | return true; |
425 | 425 | ||
426 | string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); | 426 | string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); |
427 | 427 | ||
428 | if ((!m_gridmode) && ((userInventoryServerURI == _inventoryServerUrl)) || (userInventoryServerURI == "")) | 428 | if ((!m_gridmode) && ((userInventoryServerURI == _inventoryServerUrl)) || (userInventoryServerURI == "")) |
429 | { | 429 | { |
430 | return true; | 430 | return true; |
431 | } | 431 | } |
432 | return false; | 432 | return false; |
433 | } | 433 | } |
434 | 434 | ||
435 | private string GetUserInventoryURI(UUID userID) | 435 | private string GetUserInventoryURI(UUID userID) |
436 | { | 436 | { |
437 | string invURI = _inventoryServerUrl; | 437 | string invURI = _inventoryServerUrl; |
438 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userID); | 438 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userID); |
439 | if ((uinfo == null) || (uinfo.UserProfile == null)) | 439 | if ((uinfo == null) || (uinfo.UserProfile == null)) |
440 | return invURI; | 440 | return invURI; |
441 | 441 | ||
442 | string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); | 442 | string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); |
443 | 443 | ||
444 | if ((userInventoryServerURI != null) && | 444 | if ((userInventoryServerURI != null) && |
445 | (userInventoryServerURI != "")) | 445 | (userInventoryServerURI != "")) |
446 | invURI = userInventoryServerURI; | 446 | invURI = userInventoryServerURI; |
447 | return invURI; | 447 | return invURI; |
448 | } | 448 | } |
449 | 449 | ||
450 | } | 450 | } |
451 | } | 451 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs index 0ac39e9..06534be 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs | |||
@@ -1,267 +1,267 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text.RegularExpressions; | 33 | using System.Text.RegularExpressions; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using log4net; | 35 | using log4net; |
36 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Region.Communications.OGS1; | 39 | using OpenSim.Region.Communications.OGS1; |
40 | 40 | ||
41 | namespace OpenSim.Region.Communications.Hypergrid | 41 | namespace OpenSim.Region.Communications.Hypergrid |
42 | { | 42 | { |
43 | /// <summary> | 43 | /// <summary> |
44 | /// For the time being, this class is just an identity wrapper around OGS1UserServices, | 44 | /// For the time being, this class is just an identity wrapper around OGS1UserServices, |
45 | /// so it always fails for foreign users. | 45 | /// so it always fails for foreign users. |
46 | /// Later it needs to talk with the foreign users' user servers. | 46 | /// Later it needs to talk with the foreign users' user servers. |
47 | /// </summary> | 47 | /// </summary> |
48 | public class HGUserServices : IUserService, IAvatarService, IMessagingService | 48 | public class HGUserServices : IUserService, IAvatarService, IMessagingService |
49 | { | 49 | { |
50 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | //private HGCommunicationsGridMode m_parent; | 52 | //private HGCommunicationsGridMode m_parent; |
53 | private OGS1UserServices m_remoteUserServices; | 53 | private OGS1UserServices m_remoteUserServices; |
54 | 54 | ||
55 | public HGUserServices(HGCommunicationsGridMode parent) | 55 | public HGUserServices(HGCommunicationsGridMode parent) |
56 | { | 56 | { |
57 | //m_parent = parent; | 57 | //m_parent = parent; |
58 | m_remoteUserServices = new OGS1UserServices(parent); | 58 | m_remoteUserServices = new OGS1UserServices(parent); |
59 | } | 59 | } |
60 | 60 | ||
61 | public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) | 61 | public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) |
62 | { | 62 | { |
63 | return m_remoteUserServices.ConvertXMLRPCDataToUserProfile(data); | 63 | return m_remoteUserServices.ConvertXMLRPCDataToUserProfile(data); |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Get a user agent from the user server | 67 | /// Get a user agent from the user server |
68 | /// </summary> | 68 | /// </summary> |
69 | /// <param name="avatarID"></param> | 69 | /// <param name="avatarID"></param> |
70 | /// <returns>null if the request fails</returns> | 70 | /// <returns>null if the request fails</returns> |
71 | public UserAgentData GetAgentByUUID(UUID userId) | 71 | public UserAgentData GetAgentByUUID(UUID userId) |
72 | { | 72 | { |
73 | return m_remoteUserServices.GetAgentByUUID(userId); | 73 | return m_remoteUserServices.GetAgentByUUID(userId); |
74 | } | 74 | } |
75 | 75 | ||
76 | public AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data) | 76 | public AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data) |
77 | { | 77 | { |
78 | return m_remoteUserServices.ConvertXMLRPCDataToAvatarAppearance(data); | 78 | return m_remoteUserServices.ConvertXMLRPCDataToAvatarAppearance(data); |
79 | } | 79 | } |
80 | 80 | ||
81 | public List<AvatarPickerAvatar> ConvertXMLRPCDataToAvatarPickerList(UUID queryID, Hashtable data) | 81 | public List<AvatarPickerAvatar> ConvertXMLRPCDataToAvatarPickerList(UUID queryID, Hashtable data) |
82 | { | 82 | { |
83 | return m_remoteUserServices.ConvertXMLRPCDataToAvatarPickerList(queryID, data); | 83 | return m_remoteUserServices.ConvertXMLRPCDataToAvatarPickerList(queryID, data); |
84 | } | 84 | } |
85 | 85 | ||
86 | public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) | 86 | public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) |
87 | { | 87 | { |
88 | return m_remoteUserServices.ConvertXMLRPCDataToFriendListItemList(data); | 88 | return m_remoteUserServices.ConvertXMLRPCDataToFriendListItemList(data); |
89 | } | 89 | } |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// Logs off a user on the user server | 92 | /// Logs off a user on the user server |
93 | /// </summary> | 93 | /// </summary> |
94 | /// <param name="UserID">UUID of the user</param> | 94 | /// <param name="UserID">UUID of the user</param> |
95 | /// <param name="regionID">UUID of the Region</param> | 95 | /// <param name="regionID">UUID of the Region</param> |
96 | /// <param name="regionhandle">regionhandle</param> | 96 | /// <param name="regionhandle">regionhandle</param> |
97 | /// <param name="position">final position</param> | 97 | /// <param name="position">final position</param> |
98 | /// <param name="lookat">final lookat</param> | 98 | /// <param name="lookat">final lookat</param> |
99 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) | 99 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) |
100 | { | 100 | { |
101 | m_remoteUserServices.LogOffUser(userid, regionid, regionhandle, position, lookat); | 101 | m_remoteUserServices.LogOffUser(userid, regionid, regionhandle, position, lookat); |
102 | } | 102 | } |
103 | 103 | ||
104 | /// <summary> | 104 | /// <summary> |
105 | /// Logs off a user on the user server (deprecated as of 2008-08-27) | 105 | /// Logs off a user on the user server (deprecated as of 2008-08-27) |
106 | /// </summary> | 106 | /// </summary> |
107 | /// <param name="UserID">UUID of the user</param> | 107 | /// <param name="UserID">UUID of the user</param> |
108 | /// <param name="regionID">UUID of the Region</param> | 108 | /// <param name="regionID">UUID of the Region</param> |
109 | /// <param name="regionhandle">regionhandle</param> | 109 | /// <param name="regionhandle">regionhandle</param> |
110 | /// <param name="posx">final position x</param> | 110 | /// <param name="posx">final position x</param> |
111 | /// <param name="posy">final position y</param> | 111 | /// <param name="posy">final position y</param> |
112 | /// <param name="posz">final position z</param> | 112 | /// <param name="posz">final position z</param> |
113 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) | 113 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) |
114 | { | 114 | { |
115 | m_remoteUserServices.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); | 115 | m_remoteUserServices.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); |
116 | } | 116 | } |
117 | 117 | ||
118 | public UserProfileData GetUserProfile(string firstName, string lastName) | 118 | public UserProfileData GetUserProfile(string firstName, string lastName) |
119 | { | 119 | { |
120 | return GetUserProfile(firstName + " " + lastName); | 120 | return GetUserProfile(firstName + " " + lastName); |
121 | } | 121 | } |
122 | 122 | ||
123 | public void UpdateUserCurrentRegion(UUID avatarid, UUID regionuuid, ulong regionhandle) | 123 | public void UpdateUserCurrentRegion(UUID avatarid, UUID regionuuid, ulong regionhandle) |
124 | { | 124 | { |
125 | m_remoteUserServices.UpdateUserCurrentRegion(avatarid, regionuuid, regionhandle); | 125 | m_remoteUserServices.UpdateUserCurrentRegion(avatarid, regionuuid, regionhandle); |
126 | } | 126 | } |
127 | 127 | ||
128 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) | 128 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) |
129 | { | 129 | { |
130 | return m_remoteUserServices.GenerateAgentPickerRequestResponse(queryID, query); | 130 | return m_remoteUserServices.GenerateAgentPickerRequestResponse(queryID, query); |
131 | } | 131 | } |
132 | 132 | ||
133 | /// <summary> | 133 | /// <summary> |
134 | /// Get a user profile from the user server | 134 | /// Get a user profile from the user server |
135 | /// </summary> | 135 | /// </summary> |
136 | /// <param name="avatarID"></param> | 136 | /// <param name="avatarID"></param> |
137 | /// <returns>null if the request fails</returns> | 137 | /// <returns>null if the request fails</returns> |
138 | public UserProfileData GetUserProfile(string name) | 138 | public UserProfileData GetUserProfile(string name) |
139 | { | 139 | { |
140 | return m_remoteUserServices.GetUserProfile(name); | 140 | return m_remoteUserServices.GetUserProfile(name); |
141 | } | 141 | } |
142 | 142 | ||
143 | /// <summary> | 143 | /// <summary> |
144 | /// Get a user profile from the user server | 144 | /// Get a user profile from the user server |
145 | /// </summary> | 145 | /// </summary> |
146 | /// <param name="avatarID"></param> | 146 | /// <param name="avatarID"></param> |
147 | /// <returns>null if the request fails</returns> | 147 | /// <returns>null if the request fails</returns> |
148 | public UserProfileData GetUserProfile(UUID avatarID) | 148 | public UserProfileData GetUserProfile(UUID avatarID) |
149 | { | 149 | { |
150 | return m_remoteUserServices.GetUserProfile(avatarID); | 150 | return m_remoteUserServices.GetUserProfile(avatarID); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | public void ClearUserAgent(UUID avatarID) | 154 | public void ClearUserAgent(UUID avatarID) |
155 | { | 155 | { |
156 | m_remoteUserServices.ClearUserAgent(avatarID); | 156 | m_remoteUserServices.ClearUserAgent(avatarID); |
157 | } | 157 | } |
158 | 158 | ||
159 | /// <summary> | 159 | /// <summary> |
160 | /// Retrieve the user information for the given master uuid. | 160 | /// Retrieve the user information for the given master uuid. |
161 | /// </summary> | 161 | /// </summary> |
162 | /// <param name="uuid"></param> | 162 | /// <param name="uuid"></param> |
163 | /// <returns></returns> | 163 | /// <returns></returns> |
164 | public UserProfileData SetupMasterUser(string firstName, string lastName) | 164 | public UserProfileData SetupMasterUser(string firstName, string lastName) |
165 | { | 165 | { |
166 | return m_remoteUserServices.SetupMasterUser(firstName, lastName); | 166 | return m_remoteUserServices.SetupMasterUser(firstName, lastName); |
167 | } | 167 | } |
168 | 168 | ||
169 | /// <summary> | 169 | /// <summary> |
170 | /// Retrieve the user information for the given master uuid. | 170 | /// Retrieve the user information for the given master uuid. |
171 | /// </summary> | 171 | /// </summary> |
172 | /// <param name="uuid"></param> | 172 | /// <param name="uuid"></param> |
173 | /// <returns></returns> | 173 | /// <returns></returns> |
174 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) | 174 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) |
175 | { | 175 | { |
176 | return m_remoteUserServices.SetupMasterUser(firstName, lastName, password); | 176 | return m_remoteUserServices.SetupMasterUser(firstName, lastName, password); |
177 | } | 177 | } |
178 | 178 | ||
179 | /// <summary> | 179 | /// <summary> |
180 | /// Retrieve the user information for the given master uuid. | 180 | /// Retrieve the user information for the given master uuid. |
181 | /// </summary> | 181 | /// </summary> |
182 | /// <param name="uuid"></param> | 182 | /// <param name="uuid"></param> |
183 | /// <returns></returns> | 183 | /// <returns></returns> |
184 | public UserProfileData SetupMasterUser(UUID uuid) | 184 | public UserProfileData SetupMasterUser(UUID uuid) |
185 | { | 185 | { |
186 | return m_remoteUserServices.SetupMasterUser(uuid); | 186 | return m_remoteUserServices.SetupMasterUser(uuid); |
187 | } | 187 | } |
188 | 188 | ||
189 | public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) | 189 | public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) |
190 | { | 190 | { |
191 | return m_remoteUserServices.AddUserProfile(firstName, lastName, pass, regX, regY); | 191 | return m_remoteUserServices.AddUserProfile(firstName, lastName, pass, regX, regY); |
192 | } | 192 | } |
193 | 193 | ||
194 | public bool ResetUserPassword(string firstName, string lastName, string newPassword) | 194 | public bool ResetUserPassword(string firstName, string lastName, string newPassword) |
195 | { | 195 | { |
196 | return m_remoteUserServices.ResetUserPassword(firstName, lastName, newPassword); | 196 | return m_remoteUserServices.ResetUserPassword(firstName, lastName, newPassword); |
197 | } | 197 | } |
198 | 198 | ||
199 | public bool UpdateUserProfile(UserProfileData userProfile) | 199 | public bool UpdateUserProfile(UserProfileData userProfile) |
200 | { | 200 | { |
201 | return m_remoteUserServices.UpdateUserProfile(userProfile); | 201 | return m_remoteUserServices.UpdateUserProfile(userProfile); |
202 | } | 202 | } |
203 | 203 | ||
204 | #region IUserServices Friend Methods | 204 | #region IUserServices Friend Methods |
205 | /// <summary> | 205 | /// <summary> |
206 | /// Adds a new friend to the database for XUser | 206 | /// Adds a new friend to the database for XUser |
207 | /// </summary> | 207 | /// </summary> |
208 | /// <param name="friendlistowner">The agent that who's friends list is being added to</param> | 208 | /// <param name="friendlistowner">The agent that who's friends list is being added to</param> |
209 | /// <param name="friend">The agent that being added to the friends list of the friends list owner</param> | 209 | /// <param name="friend">The agent that being added to the friends list of the friends list owner</param> |
210 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | 210 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> |
211 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) | 211 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) |
212 | { | 212 | { |
213 | m_remoteUserServices.AddNewUserFriend(friendlistowner, friend, perms); | 213 | m_remoteUserServices.AddNewUserFriend(friendlistowner, friend, perms); |
214 | } | 214 | } |
215 | 215 | ||
216 | /// <summary> | 216 | /// <summary> |
217 | /// Delete friend on friendlistowner's friendlist. | 217 | /// Delete friend on friendlistowner's friendlist. |
218 | /// </summary> | 218 | /// </summary> |
219 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | 219 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> |
220 | /// <param name="friend">The Ex-friend agent</param> | 220 | /// <param name="friend">The Ex-friend agent</param> |
221 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) | 221 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) |
222 | { | 222 | { |
223 | m_remoteUserServices.RemoveUserFriend(friend, friend); | 223 | m_remoteUserServices.RemoveUserFriend(friend, friend); |
224 | } | 224 | } |
225 | 225 | ||
226 | /// <summary> | 226 | /// <summary> |
227 | /// Update permissions for friend on friendlistowner's friendlist. | 227 | /// Update permissions for friend on friendlistowner's friendlist. |
228 | /// </summary> | 228 | /// </summary> |
229 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | 229 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> |
230 | /// <param name="friend">The agent that is getting or loosing permissions</param> | 230 | /// <param name="friend">The agent that is getting or loosing permissions</param> |
231 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | 231 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> |
232 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) | 232 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) |
233 | { | 233 | { |
234 | m_remoteUserServices.UpdateUserFriendPerms(friendlistowner, friend, perms); | 234 | m_remoteUserServices.UpdateUserFriendPerms(friendlistowner, friend, perms); |
235 | } | 235 | } |
236 | /// <summary> | 236 | /// <summary> |
237 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner | 237 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner |
238 | /// </summary> | 238 | /// </summary> |
239 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> | 239 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> |
240 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) | 240 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) |
241 | { | 241 | { |
242 | return m_remoteUserServices.GetUserFriendList(friendlistowner); | 242 | return m_remoteUserServices.GetUserFriendList(friendlistowner); |
243 | } | 243 | } |
244 | 244 | ||
245 | #endregion | 245 | #endregion |
246 | 246 | ||
247 | /// Appearance | 247 | /// Appearance |
248 | public AvatarAppearance GetUserAppearance(UUID user) | 248 | public AvatarAppearance GetUserAppearance(UUID user) |
249 | { | 249 | { |
250 | return m_remoteUserServices.GetUserAppearance(user); | 250 | return m_remoteUserServices.GetUserAppearance(user); |
251 | } | 251 | } |
252 | 252 | ||
253 | public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) | 253 | public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) |
254 | { | 254 | { |
255 | m_remoteUserServices.UpdateUserAppearance(user, appearance); | 255 | m_remoteUserServices.UpdateUserAppearance(user, appearance); |
256 | } | 256 | } |
257 | 257 | ||
258 | #region IMessagingService | 258 | #region IMessagingService |
259 | 259 | ||
260 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) | 260 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) |
261 | { | 261 | { |
262 | return m_remoteUserServices.GetFriendRegionInfos(uuids); | 262 | return m_remoteUserServices.GetFriendRegionInfos(uuids); |
263 | } | 263 | } |
264 | #endregion | 264 | #endregion |
265 | 265 | ||
266 | } | 266 | } |
267 | } | 267 | } |
diff --git a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs index 192904c..d090052 100644 --- a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs +++ b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs | |||
@@ -1,200 +1,200 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | 33 | ||
34 | using log4net; | 34 | using log4net; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | 36 | ||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | 38 | ||
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Framework.Communications.Cache; | 41 | using OpenSim.Framework.Communications.Cache; |
42 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
43 | using OpenSim.Region.Environment.Interfaces; | 43 | using OpenSim.Region.Environment.Interfaces; |
44 | using OpenSim.Region.Environment.Scenes; | 44 | using OpenSim.Region.Environment.Scenes; |
45 | using OpenSim.Grid.AssetServer; | 45 | using OpenSim.Grid.AssetServer; |
46 | 46 | ||
47 | namespace OpenSim.Region.Environment.Modules.Hypergrid | 47 | namespace OpenSim.Region.Environment.Modules.Hypergrid |
48 | { | 48 | { |
49 | public class HGStandaloneAssetService : IRegionModule | 49 | public class HGStandaloneAssetService : IRegionModule |
50 | { | 50 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | private static bool initialized = false; | 52 | private static bool initialized = false; |
53 | private static bool enabled = false; | 53 | private static bool enabled = false; |
54 | 54 | ||
55 | Scene m_scene; | 55 | Scene m_scene; |
56 | //AssetService m_assetService; | 56 | //AssetService m_assetService; |
57 | 57 | ||
58 | #region IRegionModule interface | 58 | #region IRegionModule interface |
59 | 59 | ||
60 | public void Initialise(Scene scene, IConfigSource config) | 60 | public void Initialise(Scene scene, IConfigSource config) |
61 | { | 61 | { |
62 | if (!initialized) | 62 | if (!initialized) |
63 | { | 63 | { |
64 | initialized = true; | 64 | initialized = true; |
65 | m_scene = scene; | 65 | m_scene = scene; |
66 | 66 | ||
67 | // This module is only on for standalones in hypergrid mode | 67 | // This module is only on for standalones in hypergrid mode |
68 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); | 68 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | public void PostInitialise() | 72 | public void PostInitialise() |
73 | { | 73 | { |
74 | if (enabled) | 74 | if (enabled) |
75 | { | 75 | { |
76 | m_log.Info("[HGStandaloneAssetService]: Starting..."); | 76 | m_log.Info("[HGStandaloneAssetService]: Starting..."); |
77 | 77 | ||
78 | //m_assetService = new AssetService(m_scene); | 78 | //m_assetService = new AssetService(m_scene); |
79 | new AssetService(m_scene); | 79 | new AssetService(m_scene); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | public void Close() | 83 | public void Close() |
84 | { | 84 | { |
85 | } | 85 | } |
86 | 86 | ||
87 | public string Name | 87 | public string Name |
88 | { | 88 | { |
89 | get { return "HGStandaloneAssetService"; } | 89 | get { return "HGStandaloneAssetService"; } |
90 | } | 90 | } |
91 | 91 | ||
92 | public bool IsSharedModule | 92 | public bool IsSharedModule |
93 | { | 93 | { |
94 | get { return true; } | 94 | get { return true; } |
95 | } | 95 | } |
96 | 96 | ||
97 | #endregion | 97 | #endregion |
98 | 98 | ||
99 | } | 99 | } |
100 | 100 | ||
101 | public class AssetService | 101 | public class AssetService |
102 | { | 102 | { |
103 | private IUserService m_userService; | 103 | private IUserService m_userService; |
104 | private bool m_doLookup = false; | 104 | private bool m_doLookup = false; |
105 | 105 | ||
106 | public bool DoLookup | 106 | public bool DoLookup |
107 | { | 107 | { |
108 | get { return m_doLookup; } | 108 | get { return m_doLookup; } |
109 | set { m_doLookup = value; } | 109 | set { m_doLookup = value; } |
110 | } | 110 | } |
111 | private static readonly ILog m_log | 111 | private static readonly ILog m_log |
112 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 112 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
113 | 113 | ||
114 | public AssetService(Scene m_scene) | 114 | public AssetService(Scene m_scene) |
115 | { | 115 | { |
116 | AddHttpHandlers(m_scene); | 116 | AddHttpHandlers(m_scene); |
117 | m_userService = m_scene.CommsManager.UserService; | 117 | m_userService = m_scene.CommsManager.UserService; |
118 | } | 118 | } |
119 | 119 | ||
120 | protected void AddHttpHandlers(Scene m_scene) | 120 | protected void AddHttpHandlers(Scene m_scene) |
121 | { | 121 | { |
122 | IAssetProviderPlugin m_assetProvider = ((AssetServerBase)m_scene.AssetCache.AssetServer).AssetProviderPlugin; | 122 | IAssetProviderPlugin m_assetProvider = ((AssetServerBase)m_scene.AssetCache.AssetServer).AssetProviderPlugin; |
123 | 123 | ||
124 | m_scene.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); | 124 | m_scene.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); |
125 | m_scene.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider)); | 125 | m_scene.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider)); |
126 | 126 | ||
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | ///// <summary> | 130 | ///// <summary> |
131 | ///// Check that the source of an inventory request is one that we trust. | 131 | ///// Check that the source of an inventory request is one that we trust. |
132 | ///// </summary> | 132 | ///// </summary> |
133 | ///// <param name="peer"></param> | 133 | ///// <param name="peer"></param> |
134 | ///// <returns></returns> | 134 | ///// <returns></returns> |
135 | //public bool CheckTrustSource(IPEndPoint peer) | 135 | //public bool CheckTrustSource(IPEndPoint peer) |
136 | //{ | 136 | //{ |
137 | // if (m_doLookup) | 137 | // if (m_doLookup) |
138 | // { | 138 | // { |
139 | // m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer); | 139 | // m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer); |
140 | // UriBuilder ub = new UriBuilder(m_userserver_url); | 140 | // UriBuilder ub = new UriBuilder(m_userserver_url); |
141 | // IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host); | 141 | // IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host); |
142 | // foreach (IPAddress uaddr in uaddrs) | 142 | // foreach (IPAddress uaddr in uaddrs) |
143 | // { | 143 | // { |
144 | // if (uaddr.Equals(peer.Address)) | 144 | // if (uaddr.Equals(peer.Address)) |
145 | // { | 145 | // { |
146 | // return true; | 146 | // return true; |
147 | // } | 147 | // } |
148 | // } | 148 | // } |
149 | 149 | ||
150 | // m_log.WarnFormat( | 150 | // m_log.WarnFormat( |
151 | // "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources", | 151 | // "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources", |
152 | // peer); | 152 | // peer); |
153 | 153 | ||
154 | // return false; | 154 | // return false; |
155 | // } | 155 | // } |
156 | // else | 156 | // else |
157 | // { | 157 | // { |
158 | // return true; | 158 | // return true; |
159 | // } | 159 | // } |
160 | //} | 160 | //} |
161 | 161 | ||
162 | /// <summary> | 162 | /// <summary> |
163 | /// Check that the source of an inventory request for a particular agent is a current session belonging to | 163 | /// Check that the source of an inventory request for a particular agent is a current session belonging to |
164 | /// that agent. | 164 | /// that agent. |
165 | /// </summary> | 165 | /// </summary> |
166 | /// <param name="session_id"></param> | 166 | /// <param name="session_id"></param> |
167 | /// <param name="avatar_id"></param> | 167 | /// <param name="avatar_id"></param> |
168 | /// <returns></returns> | 168 | /// <returns></returns> |
169 | public bool CheckAuthSession(string session_id, string avatar_id) | 169 | public bool CheckAuthSession(string session_id, string avatar_id) |
170 | { | 170 | { |
171 | if (m_doLookup) | 171 | if (m_doLookup) |
172 | { | 172 | { |
173 | m_log.InfoFormat("[HGStandaloneInvService]: checking authed session {0} {1}", session_id, avatar_id); | 173 | m_log.InfoFormat("[HGStandaloneInvService]: checking authed session {0} {1}", session_id, avatar_id); |
174 | UUID userID = UUID.Zero; | 174 | UUID userID = UUID.Zero; |
175 | UUID sessionID = UUID.Zero; | 175 | UUID sessionID = UUID.Zero; |
176 | UUID.TryParse(avatar_id, out userID); | 176 | UUID.TryParse(avatar_id, out userID); |
177 | UUID.TryParse(session_id, out sessionID); | 177 | UUID.TryParse(session_id, out sessionID); |
178 | if (userID.Equals(UUID.Zero) || sessionID.Equals(UUID.Zero)) | 178 | if (userID.Equals(UUID.Zero) || sessionID.Equals(UUID.Zero)) |
179 | { | 179 | { |
180 | m_log.Info("[HGStandaloneInvService]: Invalid user or session id " + avatar_id + "; " + session_id); | 180 | m_log.Info("[HGStandaloneInvService]: Invalid user or session id " + avatar_id + "; " + session_id); |
181 | return false; | 181 | return false; |
182 | } | 182 | } |
183 | UserProfileData userProfile = m_userService.GetUserProfile(userID); | 183 | UserProfileData userProfile = m_userService.GetUserProfile(userID); |
184 | if (userProfile != null && userProfile.CurrentAgent != null && | 184 | if (userProfile != null && userProfile.CurrentAgent != null && |
185 | userProfile.CurrentAgent.SessionID == sessionID) | 185 | userProfile.CurrentAgent.SessionID == sessionID) |
186 | { | 186 | { |
187 | m_log.Info("[HGStandaloneInvService]: user is logged in and session is valid. Authorizing access."); | 187 | m_log.Info("[HGStandaloneInvService]: user is logged in and session is valid. Authorizing access."); |
188 | return true; | 188 | return true; |
189 | } | 189 | } |
190 | 190 | ||
191 | m_log.Warn("[HGStandaloneInvService]: unknown user or session_id, request rejected"); | 191 | m_log.Warn("[HGStandaloneInvService]: unknown user or session_id, request rejected"); |
192 | return false; | 192 | return false; |
193 | } | 193 | } |
194 | else | 194 | else |
195 | { | 195 | { |
196 | return true; | 196 | return true; |
197 | } | 197 | } |
198 | } | 198 | } |
199 | } | 199 | } |
200 | } | 200 | } |
diff --git a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs index 7eeece9..bfdbcfc 100644 --- a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs +++ b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs | |||
@@ -1,316 +1,316 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | 33 | ||
34 | using log4net; | 34 | using log4net; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | 36 | ||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | 38 | ||
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Framework.Communications.Cache; | 41 | using OpenSim.Framework.Communications.Cache; |
42 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
43 | using OpenSim.Region.Environment.Interfaces; | 43 | using OpenSim.Region.Environment.Interfaces; |
44 | using OpenSim.Region.Environment.Scenes; | 44 | using OpenSim.Region.Environment.Scenes; |
45 | 45 | ||
46 | namespace OpenSim.Region.Environment.Modules.Hypergrid | 46 | namespace OpenSim.Region.Environment.Modules.Hypergrid |
47 | { | 47 | { |
48 | public class HGStandaloneInventoryService : IRegionModule | 48 | public class HGStandaloneInventoryService : IRegionModule |
49 | { | 49 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | private static bool initialized = false; | 51 | private static bool initialized = false; |
52 | private static bool enabled = false; | 52 | private static bool enabled = false; |
53 | 53 | ||
54 | Scene m_scene; | 54 | Scene m_scene; |
55 | //InventoryService m_inventoryService; | 55 | //InventoryService m_inventoryService; |
56 | 56 | ||
57 | #region IRegionModule interface | 57 | #region IRegionModule interface |
58 | 58 | ||
59 | public void Initialise(Scene scene, IConfigSource config) | 59 | public void Initialise(Scene scene, IConfigSource config) |
60 | { | 60 | { |
61 | if (!initialized) | 61 | if (!initialized) |
62 | { | 62 | { |
63 | initialized = true; | 63 | initialized = true; |
64 | m_scene = scene; | 64 | m_scene = scene; |
65 | 65 | ||
66 | // This module is only on for standalones | 66 | // This module is only on for standalones |
67 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); | 67 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | public void PostInitialise() | 71 | public void PostInitialise() |
72 | { | 72 | { |
73 | if (enabled) | 73 | if (enabled) |
74 | { | 74 | { |
75 | m_log.Info("[HGStandaloneInvService]: Starting..."); | 75 | m_log.Info("[HGStandaloneInvService]: Starting..."); |
76 | //m_inventoryService = new InventoryService(m_scene); | 76 | //m_inventoryService = new InventoryService(m_scene); |
77 | new InventoryService(m_scene); | 77 | new InventoryService(m_scene); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | public void Close() | 81 | public void Close() |
82 | { | 82 | { |
83 | } | 83 | } |
84 | 84 | ||
85 | public string Name | 85 | public string Name |
86 | { | 86 | { |
87 | get { return "HGStandaloneInventoryService"; } | 87 | get { return "HGStandaloneInventoryService"; } |
88 | } | 88 | } |
89 | 89 | ||
90 | public bool IsSharedModule | 90 | public bool IsSharedModule |
91 | { | 91 | { |
92 | get { return true; } | 92 | get { return true; } |
93 | } | 93 | } |
94 | 94 | ||
95 | #endregion | 95 | #endregion |
96 | 96 | ||
97 | } | 97 | } |
98 | 98 | ||
99 | public class InventoryService | 99 | public class InventoryService |
100 | { | 100 | { |
101 | private InventoryServiceBase m_inventoryService; | 101 | private InventoryServiceBase m_inventoryService; |
102 | private IUserService m_userService; | 102 | private IUserService m_userService; |
103 | private bool m_doLookup = false; | 103 | private bool m_doLookup = false; |
104 | 104 | ||
105 | public bool DoLookup | 105 | public bool DoLookup |
106 | { | 106 | { |
107 | get { return m_doLookup; } | 107 | get { return m_doLookup; } |
108 | set { m_doLookup = value; } | 108 | set { m_doLookup = value; } |
109 | } | 109 | } |
110 | private static readonly ILog m_log | 110 | private static readonly ILog m_log |
111 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 111 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
112 | 112 | ||
113 | public InventoryService(Scene m_scene) | 113 | public InventoryService(Scene m_scene) |
114 | { | 114 | { |
115 | m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService; | 115 | m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService; |
116 | m_userService = m_scene.CommsManager.UserService; | 116 | m_userService = m_scene.CommsManager.UserService; |
117 | AddHttpHandlers(m_scene); | 117 | AddHttpHandlers(m_scene); |
118 | 118 | ||
119 | } | 119 | } |
120 | 120 | ||
121 | protected void AddHttpHandlers(Scene m_scene) | 121 | protected void AddHttpHandlers(Scene m_scene) |
122 | { | 122 | { |
123 | m_scene.AddStreamHandler( | 123 | m_scene.AddStreamHandler( |
124 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( | 124 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( |
125 | "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); | 125 | "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); |
126 | 126 | ||
127 | m_scene.AddStreamHandler( | 127 | m_scene.AddStreamHandler( |
128 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 128 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
129 | "POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession)); | 129 | "POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession)); |
130 | 130 | ||
131 | m_scene.AddStreamHandler( | 131 | m_scene.AddStreamHandler( |
132 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 132 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
133 | "POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession)); | 133 | "POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession)); |
134 | 134 | ||
135 | m_scene.AddStreamHandler( | 135 | m_scene.AddStreamHandler( |
136 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 136 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
137 | "POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession)); | 137 | "POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession)); |
138 | 138 | ||
139 | m_scene.AddStreamHandler( | 139 | m_scene.AddStreamHandler( |
140 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 140 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
141 | "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession)); | 141 | "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession)); |
142 | 142 | ||
143 | m_scene.AddStreamHandler( | 143 | m_scene.AddStreamHandler( |
144 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | 144 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( |
145 | "POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession)); | 145 | "POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession)); |
146 | 146 | ||
147 | m_scene.AddStreamHandler( | 147 | m_scene.AddStreamHandler( |
148 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | 148 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( |
149 | "POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession)); | 149 | "POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession)); |
150 | 150 | ||
151 | //// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g | 151 | //// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g |
152 | //// system folders such as Objects, Textures), but it now returns the entire inventory skeleton. | 152 | //// system folders such as Objects, Textures), but it now returns the entire inventory skeleton. |
153 | //// It would have been better to rename this request, but complexities in the BaseHttpServer | 153 | //// It would have been better to rename this request, but complexities in the BaseHttpServer |
154 | //// (e.g. any http request not found is automatically treated as an xmlrpc request) make it easier | 154 | //// (e.g. any http request not found is automatically treated as an xmlrpc request) make it easier |
155 | //// to do this for now. | 155 | //// to do this for now. |
156 | //m_scene.AddStreamHandler( | 156 | //m_scene.AddStreamHandler( |
157 | // new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>> | 157 | // new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>> |
158 | // ("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource)); | 158 | // ("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource)); |
159 | 159 | ||
160 | //// for persistent active gestures | 160 | //// for persistent active gestures |
161 | //m_scene.AddStreamHandler( | 161 | //m_scene.AddStreamHandler( |
162 | // new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>> | 162 | // new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>> |
163 | // ("POST", "/ActiveGestures/", GetActiveGestures, CheckTrustSource)); | 163 | // ("POST", "/ActiveGestures/", GetActiveGestures, CheckTrustSource)); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | ///// <summary> | 167 | ///// <summary> |
168 | ///// Check that the source of an inventory request is one that we trust. | 168 | ///// Check that the source of an inventory request is one that we trust. |
169 | ///// </summary> | 169 | ///// </summary> |
170 | ///// <param name="peer"></param> | 170 | ///// <param name="peer"></param> |
171 | ///// <returns></returns> | 171 | ///// <returns></returns> |
172 | //public bool CheckTrustSource(IPEndPoint peer) | 172 | //public bool CheckTrustSource(IPEndPoint peer) |
173 | //{ | 173 | //{ |
174 | // if (m_doLookup) | 174 | // if (m_doLookup) |
175 | // { | 175 | // { |
176 | // m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer); | 176 | // m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer); |
177 | // UriBuilder ub = new UriBuilder(m_userserver_url); | 177 | // UriBuilder ub = new UriBuilder(m_userserver_url); |
178 | // IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host); | 178 | // IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host); |
179 | // foreach (IPAddress uaddr in uaddrs) | 179 | // foreach (IPAddress uaddr in uaddrs) |
180 | // { | 180 | // { |
181 | // if (uaddr.Equals(peer.Address)) | 181 | // if (uaddr.Equals(peer.Address)) |
182 | // { | 182 | // { |
183 | // return true; | 183 | // return true; |
184 | // } | 184 | // } |
185 | // } | 185 | // } |
186 | 186 | ||
187 | // m_log.WarnFormat( | 187 | // m_log.WarnFormat( |
188 | // "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources", | 188 | // "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources", |
189 | // peer); | 189 | // peer); |
190 | 190 | ||
191 | // return false; | 191 | // return false; |
192 | // } | 192 | // } |
193 | // else | 193 | // else |
194 | // { | 194 | // { |
195 | // return true; | 195 | // return true; |
196 | // } | 196 | // } |
197 | //} | 197 | //} |
198 | 198 | ||
199 | /// <summary> | 199 | /// <summary> |
200 | /// Check that the source of an inventory request for a particular agent is a current session belonging to | 200 | /// Check that the source of an inventory request for a particular agent is a current session belonging to |
201 | /// that agent. | 201 | /// that agent. |
202 | /// </summary> | 202 | /// </summary> |
203 | /// <param name="session_id"></param> | 203 | /// <param name="session_id"></param> |
204 | /// <param name="avatar_id"></param> | 204 | /// <param name="avatar_id"></param> |
205 | /// <returns></returns> | 205 | /// <returns></returns> |
206 | public bool CheckAuthSession(string session_id, string avatar_id) | 206 | public bool CheckAuthSession(string session_id, string avatar_id) |
207 | { | 207 | { |
208 | if (m_doLookup) | 208 | if (m_doLookup) |
209 | { | 209 | { |
210 | m_log.InfoFormat("[HGStandaloneInvService]: checking authed session {0} {1}", session_id, avatar_id); | 210 | m_log.InfoFormat("[HGStandaloneInvService]: checking authed session {0} {1}", session_id, avatar_id); |
211 | UUID userID = UUID.Zero; | 211 | UUID userID = UUID.Zero; |
212 | UUID sessionID = UUID.Zero; | 212 | UUID sessionID = UUID.Zero; |
213 | UUID.TryParse(avatar_id, out userID); | 213 | UUID.TryParse(avatar_id, out userID); |
214 | UUID.TryParse(session_id, out sessionID); | 214 | UUID.TryParse(session_id, out sessionID); |
215 | if (userID.Equals(UUID.Zero) || sessionID.Equals(UUID.Zero)) | 215 | if (userID.Equals(UUID.Zero) || sessionID.Equals(UUID.Zero)) |
216 | { | 216 | { |
217 | m_log.Info("[HGStandaloneInvService]: Invalid user or session id " + avatar_id + "; " + session_id); | 217 | m_log.Info("[HGStandaloneInvService]: Invalid user or session id " + avatar_id + "; " + session_id); |
218 | return false; | 218 | return false; |
219 | } | 219 | } |
220 | UserProfileData userProfile = m_userService.GetUserProfile(userID); | 220 | UserProfileData userProfile = m_userService.GetUserProfile(userID); |
221 | if (userProfile != null && userProfile.CurrentAgent != null && | 221 | if (userProfile != null && userProfile.CurrentAgent != null && |
222 | userProfile.CurrentAgent.SessionID == sessionID) | 222 | userProfile.CurrentAgent.SessionID == sessionID) |
223 | { | 223 | { |
224 | m_log.Info("[HGStandaloneInvService]: user is logged in and session is valid. Authorizing access."); | 224 | m_log.Info("[HGStandaloneInvService]: user is logged in and session is valid. Authorizing access."); |
225 | return true; | 225 | return true; |
226 | } | 226 | } |
227 | 227 | ||
228 | m_log.Warn("[HGStandaloneInvService]: unknown user or session_id, request rejected"); | 228 | m_log.Warn("[HGStandaloneInvService]: unknown user or session_id, request rejected"); |
229 | return false; | 229 | return false; |
230 | } | 230 | } |
231 | else | 231 | else |
232 | { | 232 | { |
233 | return true; | 233 | return true; |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | /// <summary> | 238 | /// <summary> |
239 | /// Return a user's entire inventory | 239 | /// Return a user's entire inventory |
240 | /// </summary> | 240 | /// </summary> |
241 | /// <param name="rawUserID"></param> | 241 | /// <param name="rawUserID"></param> |
242 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> | 242 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> |
243 | public InventoryCollection GetUserInventory(Guid rawUserID) | 243 | public InventoryCollection GetUserInventory(Guid rawUserID) |
244 | { | 244 | { |
245 | UUID userID = new UUID(rawUserID); | 245 | UUID userID = new UUID(rawUserID); |
246 | 246 | ||
247 | m_log.Info("[HGStandaloneInvService]: Processing request for inventory of " + userID); | 247 | m_log.Info("[HGStandaloneInvService]: Processing request for inventory of " + userID); |
248 | 248 | ||
249 | // Uncomment me to simulate a slow responding inventory server | 249 | // Uncomment me to simulate a slow responding inventory server |
250 | //Thread.Sleep(16000); | 250 | //Thread.Sleep(16000); |
251 | 251 | ||
252 | InventoryCollection invCollection = new InventoryCollection(); | 252 | InventoryCollection invCollection = new InventoryCollection(); |
253 | 253 | ||
254 | List<InventoryFolderBase> allFolders = ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); | 254 | List<InventoryFolderBase> allFolders = ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); |
255 | 255 | ||
256 | if (null == allFolders) | 256 | if (null == allFolders) |
257 | { | 257 | { |
258 | m_log.WarnFormat("[HGStandaloneInvService]: No inventory found for user {0}", rawUserID); | 258 | m_log.WarnFormat("[HGStandaloneInvService]: No inventory found for user {0}", rawUserID); |
259 | 259 | ||
260 | return invCollection; | 260 | return invCollection; |
261 | } | 261 | } |
262 | 262 | ||
263 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); | 263 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); |
264 | 264 | ||
265 | foreach (InventoryFolderBase folder in allFolders) | 265 | foreach (InventoryFolderBase folder in allFolders) |
266 | { | 266 | { |
267 | List<InventoryItemBase> items = ((InventoryServiceBase)m_inventoryService).RequestFolderItems(folder.ID); | 267 | List<InventoryItemBase> items = ((InventoryServiceBase)m_inventoryService).RequestFolderItems(folder.ID); |
268 | 268 | ||
269 | if (items != null) | 269 | if (items != null) |
270 | { | 270 | { |
271 | allItems.InsertRange(0, items); | 271 | allItems.InsertRange(0, items); |
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | invCollection.UserID = userID; | 275 | invCollection.UserID = userID; |
276 | invCollection.Folders = allFolders; | 276 | invCollection.Folders = allFolders; |
277 | invCollection.Items = allItems; | 277 | invCollection.Items = allItems; |
278 | 278 | ||
279 | // foreach (InventoryFolderBase folder in invCollection.Folders) | 279 | // foreach (InventoryFolderBase folder in invCollection.Folders) |
280 | // { | 280 | // { |
281 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); | 281 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); |
282 | // } | 282 | // } |
283 | // | 283 | // |
284 | // foreach (InventoryItemBase item in invCollection.Items) | 284 | // foreach (InventoryItemBase item in invCollection.Items) |
285 | // { | 285 | // { |
286 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); | 286 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); |
287 | // } | 287 | // } |
288 | 288 | ||
289 | m_log.InfoFormat( | 289 | m_log.InfoFormat( |
290 | "[HGStandaloneInvService]: Sending back inventory response to user {0} containing {1} folders and {2} items", | 290 | "[HGStandaloneInvService]: Sending back inventory response to user {0} containing {1} folders and {2} items", |
291 | invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); | 291 | invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); |
292 | 292 | ||
293 | return invCollection; | 293 | return invCollection; |
294 | } | 294 | } |
295 | 295 | ||
296 | /// <summary> | 296 | /// <summary> |
297 | /// Guid to UUID wrapper for same name IInventoryServices method | 297 | /// Guid to UUID wrapper for same name IInventoryServices method |
298 | /// </summary> | 298 | /// </summary> |
299 | /// <param name="rawUserID"></param> | 299 | /// <param name="rawUserID"></param> |
300 | /// <returns></returns> | 300 | /// <returns></returns> |
301 | public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID) | 301 | public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID) |
302 | { | 302 | { |
303 | UUID userID = new UUID(rawUserID); | 303 | UUID userID = new UUID(rawUserID); |
304 | return ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); | 304 | return ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); |
305 | } | 305 | } |
306 | 306 | ||
307 | public List<InventoryItemBase> GetActiveGestures(Guid rawUserID) | 307 | public List<InventoryItemBase> GetActiveGestures(Guid rawUserID) |
308 | { | 308 | { |
309 | UUID userID = new UUID(rawUserID); | 309 | UUID userID = new UUID(rawUserID); |
310 | 310 | ||
311 | m_log.InfoFormat("[HGStandaloneInvService]: fetching active gestures for user {0}", userID); | 311 | m_log.InfoFormat("[HGStandaloneInvService]: fetching active gestures for user {0}", userID); |
312 | 312 | ||
313 | return ((InventoryServiceBase)m_inventoryService).GetActiveGestures(userID); | 313 | return ((InventoryServiceBase)m_inventoryService).GetActiveGestures(userID); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | } | 316 | } |
diff --git a/OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs index 7f8f285..e642b7f 100644 --- a/OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/Environment/Modules/Hypergrid/HGWorldMapModule.cs | |||
@@ -1,178 +1,178 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | using System; | 30 | using System; |
31 | using System.Collections; | 31 | using System.Collections; |
32 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
33 | using System.Drawing; | 33 | using System.Drawing; |
34 | using System.Drawing.Imaging; | 34 | using System.Drawing.Imaging; |
35 | using System.IO; | 35 | using System.IO; |
36 | using System.Net; | 36 | using System.Net; |
37 | using System.Reflection; | 37 | using System.Reflection; |
38 | using System.Threading; | 38 | using System.Threading; |
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | using OpenMetaverse.Imaging; | 40 | using OpenMetaverse.Imaging; |
41 | using OpenMetaverse.StructuredData; | 41 | using OpenMetaverse.StructuredData; |
42 | using log4net; | 42 | using log4net; |
43 | using Nini.Config; | 43 | using Nini.Config; |
44 | using Nwc.XmlRpc; | 44 | using Nwc.XmlRpc; |
45 | 45 | ||
46 | using OpenSim.Framework; | 46 | using OpenSim.Framework; |
47 | using OpenSim.Framework.Communications.Cache; | 47 | using OpenSim.Framework.Communications.Cache; |
48 | using OpenSim.Framework.Communications.Capabilities; | 48 | using OpenSim.Framework.Communications.Capabilities; |
49 | using OpenSim.Framework.Servers; | 49 | using OpenSim.Framework.Servers; |
50 | using OpenSim.Region.Environment.Interfaces; | 50 | using OpenSim.Region.Environment.Interfaces; |
51 | using OpenSim.Region.Environment.Modules.World.WorldMap; | 51 | using OpenSim.Region.Environment.Modules.World.WorldMap; |
52 | using OpenSim.Region.Environment.Scenes; | 52 | using OpenSim.Region.Environment.Scenes; |
53 | using OpenSim.Region.Environment.Types; | 53 | using OpenSim.Region.Environment.Types; |
54 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | 54 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; |
55 | 55 | ||
56 | using OSD = OpenMetaverse.StructuredData.OSD; | 56 | using OSD = OpenMetaverse.StructuredData.OSD; |
57 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | 57 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; |
58 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | 58 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; |
59 | 59 | ||
60 | namespace OpenSim.Region.Environment.Modules.Hypergrid | 60 | namespace OpenSim.Region.Environment.Modules.Hypergrid |
61 | { | 61 | { |
62 | public class HGWorldMapModule : WorldMapModule, IRegionModule | 62 | public class HGWorldMapModule : WorldMapModule, IRegionModule |
63 | { | 63 | { |
64 | private static readonly ILog m_log = | 64 | private static readonly ILog m_log = |
65 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 65 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
66 | 66 | ||
67 | #region IRegionModule Members | 67 | #region IRegionModule Members |
68 | 68 | ||
69 | public override void Initialise(Scene scene, IConfigSource config) | 69 | public override void Initialise(Scene scene, IConfigSource config) |
70 | { | 70 | { |
71 | IConfig startupConfig = config.Configs["Startup"]; | 71 | IConfig startupConfig = config.Configs["Startup"]; |
72 | if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap") | 72 | if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap") |
73 | m_Enabled = true; | 73 | m_Enabled = true; |
74 | 74 | ||
75 | if (!m_Enabled) | 75 | if (!m_Enabled) |
76 | return; | 76 | return; |
77 | m_log.Info("[HGMap] Initializing..."); | 77 | m_log.Info("[HGMap] Initializing..."); |
78 | m_scene = scene; | 78 | m_scene = scene; |
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | public override string Name | 82 | public override string Name |
83 | { | 83 | { |
84 | get { return "HGWorldMap"; } | 84 | get { return "HGWorldMap"; } |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | #endregion | 88 | #endregion |
89 | 89 | ||
90 | /// <summary> | 90 | /// <summary> |
91 | /// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates | 91 | /// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates |
92 | /// </summary> | 92 | /// </summary> |
93 | /// <param name="minX"></param> | 93 | /// <param name="minX"></param> |
94 | /// <param name="minY"></param> | 94 | /// <param name="minY"></param> |
95 | /// <param name="maxX"></param> | 95 | /// <param name="maxX"></param> |
96 | /// <param name="maxY"></param> | 96 | /// <param name="maxY"></param> |
97 | public override void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | 97 | public override void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) |
98 | { | 98 | { |
99 | // | 99 | // |
100 | // WARNING!!! COPY & PASTE FROM SUPERCLASS | 100 | // WARNING!!! COPY & PASTE FROM SUPERCLASS |
101 | // The only difference is at the very end | 101 | // The only difference is at the very end |
102 | // | 102 | // |
103 | 103 | ||
104 | m_log.Info("[HGMap]: Request map blocks " + minX + "-" + maxX + " " + minY + "-" + maxY); | 104 | m_log.Info("[HGMap]: Request map blocks " + minX + "-" + maxX + " " + minY + "-" + maxY); |
105 | 105 | ||
106 | //m_scene.ForEachScenePresence(delegate (ScenePresence sp) { | 106 | //m_scene.ForEachScenePresence(delegate (ScenePresence sp) { |
107 | // if (!sp.IsChildAgent && sp.UUID == remoteClient.AgentId) | 107 | // if (!sp.IsChildAgent && sp.UUID == remoteClient.AgentId) |
108 | // { | 108 | // { |
109 | // Console.WriteLine("XXX Root agent"); | 109 | // Console.WriteLine("XXX Root agent"); |
110 | // DoRequestMapBlocks(remoteClient, minX, minY, maxX, maxY, flag); | 110 | // DoRequestMapBlocks(remoteClient, minX, minY, maxX, maxY, flag); |
111 | // } | 111 | // } |
112 | //}; | 112 | //}; |
113 | 113 | ||
114 | List<MapBlockData> mapBlocks; | 114 | List<MapBlockData> mapBlocks; |
115 | if ((flag & 0x10000) != 0) // user clicked on the map a tile that isn't visible | 115 | if ((flag & 0x10000) != 0) // user clicked on the map a tile that isn't visible |
116 | { | 116 | { |
117 | List<MapBlockData> response = new List<MapBlockData>(); | 117 | List<MapBlockData> response = new List<MapBlockData>(); |
118 | 118 | ||
119 | // this should return one mapblock at most. But make sure: Look whether the one we requested is in there | 119 | // this should return one mapblock at most. But make sure: Look whether the one we requested is in there |
120 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | 120 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); |
121 | if (mapBlocks != null) | 121 | if (mapBlocks != null) |
122 | { | 122 | { |
123 | foreach (MapBlockData block in mapBlocks) | 123 | foreach (MapBlockData block in mapBlocks) |
124 | { | 124 | { |
125 | if (block.X == minX && block.Y == minY) | 125 | if (block.X == minX && block.Y == minY) |
126 | { | 126 | { |
127 | // found it => add it to response | 127 | // found it => add it to response |
128 | response.Add(block); | 128 | response.Add(block); |
129 | break; | 129 | break; |
130 | } | 130 | } |
131 | } | 131 | } |
132 | } | 132 | } |
133 | response = mapBlocks; | 133 | response = mapBlocks; |
134 | if (response.Count == 0) | 134 | if (response.Count == 0) |
135 | { | 135 | { |
136 | // response still empty => couldn't find the map-tile the user clicked on => tell the client | 136 | // response still empty => couldn't find the map-tile the user clicked on => tell the client |
137 | MapBlockData block = new MapBlockData(); | 137 | MapBlockData block = new MapBlockData(); |
138 | block.X = (ushort)minX; | 138 | block.X = (ushort)minX; |
139 | block.Y = (ushort)minY; | 139 | block.Y = (ushort)minY; |
140 | block.Access = 254; // == not there | 140 | block.Access = 254; // == not there |
141 | response.Add(block); | 141 | response.Add(block); |
142 | } | 142 | } |
143 | remoteClient.SendMapBlock(response, 0); | 143 | remoteClient.SendMapBlock(response, 0); |
144 | } | 144 | } |
145 | else | 145 | else |
146 | { | 146 | { |
147 | // normal mapblock request. Use the provided values | 147 | // normal mapblock request. Use the provided values |
148 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); | 148 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); |
149 | 149 | ||
150 | // Different from super | 150 | // Different from super |
151 | FillInMap(mapBlocks, minX, minY, maxX, maxY); | 151 | FillInMap(mapBlocks, minX, minY, maxX, maxY); |
152 | // | 152 | // |
153 | 153 | ||
154 | remoteClient.SendMapBlock(mapBlocks, flag); | 154 | remoteClient.SendMapBlock(mapBlocks, flag); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
159 | private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY) | 159 | private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY) |
160 | { | 160 | { |
161 | for (int x = minX; x <= maxX; x++) | 161 | for (int x = minX; x <= maxX; x++) |
162 | for (int y = minY; y <= maxY; y++) | 162 | for (int y = minY; y <= maxY; y++) |
163 | { | 163 | { |
164 | MapBlockData mblock = mapBlocks.Find(delegate(MapBlockData mb) { return ((mb.X == x) && (mb.Y == y)); }); | 164 | MapBlockData mblock = mapBlocks.Find(delegate(MapBlockData mb) { return ((mb.X == x) && (mb.Y == y)); }); |
165 | if (mblock == null) | 165 | if (mblock == null) |
166 | { | 166 | { |
167 | mblock = new MapBlockData(); | 167 | mblock = new MapBlockData(); |
168 | mblock.X = (ushort)x; | 168 | mblock.X = (ushort)x; |
169 | mblock.Y = (ushort)y; | 169 | mblock.Y = (ushort)y; |
170 | mblock.Name = ""; | 170 | mblock.Name = ""; |
171 | mblock.Access = 254; // not here??? | 171 | mblock.Access = 254; // not here??? |
172 | mblock.MapImageId = UUID.Zero; | 172 | mblock.MapImageId = UUID.Zero; |
173 | mapBlocks.Add(mblock); | 173 | mapBlocks.Add(mblock); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | } | 176 | } |
177 | } | 177 | } |
178 | } | 178 | } |
diff --git a/OpenSim/Region/Environment/Scenes/EntityManager.cs b/OpenSim/Region/Environment/Scenes/EntityManager.cs index be39878..eb29ead 100644 --- a/OpenSim/Region/Environment/Scenes/EntityManager.cs +++ b/OpenSim/Region/Environment/Scenes/EntityManager.cs | |||
@@ -1,182 +1,182 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using OpenMetaverse; | 4 | using OpenMetaverse; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Scenes | 6 | namespace OpenSim.Region.Environment.Scenes |
7 | { | 7 | { |
8 | public class EntityManager : IEnumerable<EntityBase> | 8 | public class EntityManager : IEnumerable<EntityBase> |
9 | { | 9 | { |
10 | private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>(); | 10 | private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>(); |
11 | private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>(); | 11 | private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>(); |
12 | private readonly Object m_lock = new Object(); | 12 | private readonly Object m_lock = new Object(); |
13 | 13 | ||
14 | [Obsolete("Use Add() instead.")] | 14 | [Obsolete("Use Add() instead.")] |
15 | public void Add(UUID id, EntityBase eb) | 15 | public void Add(UUID id, EntityBase eb) |
16 | { | 16 | { |
17 | Add(eb); | 17 | Add(eb); |
18 | } | 18 | } |
19 | 19 | ||
20 | public void Add(EntityBase entity) | 20 | public void Add(EntityBase entity) |
21 | { | 21 | { |
22 | lock(m_lock) | 22 | lock(m_lock) |
23 | { | 23 | { |
24 | m_eb_uuid.Add(entity.UUID, entity); | 24 | m_eb_uuid.Add(entity.UUID, entity); |
25 | m_eb_localID.Add(entity.LocalId, entity); | 25 | m_eb_localID.Add(entity.LocalId, entity); |
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | public void InsertOrReplace(EntityBase entity) | 29 | public void InsertOrReplace(EntityBase entity) |
30 | { | 30 | { |
31 | lock(m_lock) | 31 | lock(m_lock) |
32 | { | 32 | { |
33 | m_eb_uuid[entity.UUID] = entity; | 33 | m_eb_uuid[entity.UUID] = entity; |
34 | m_eb_localID[entity.LocalId] = entity; | 34 | m_eb_localID[entity.LocalId] = entity; |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | public void Clear() | 38 | public void Clear() |
39 | { | 39 | { |
40 | lock (m_lock) | 40 | lock (m_lock) |
41 | { | 41 | { |
42 | m_eb_uuid.Clear(); | 42 | m_eb_uuid.Clear(); |
43 | m_eb_localID.Clear(); | 43 | m_eb_localID.Clear(); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | public int Count | 47 | public int Count |
48 | { | 48 | { |
49 | get | 49 | get |
50 | { | 50 | { |
51 | lock (m_lock) | 51 | lock (m_lock) |
52 | { | 52 | { |
53 | return m_eb_uuid.Count; | 53 | return m_eb_uuid.Count; |
54 | } | 54 | } |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | public bool ContainsKey(UUID id) | 58 | public bool ContainsKey(UUID id) |
59 | { | 59 | { |
60 | lock(m_lock) | 60 | lock(m_lock) |
61 | { | 61 | { |
62 | return m_eb_uuid.ContainsKey(id); | 62 | return m_eb_uuid.ContainsKey(id); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | public bool ContainsKey(uint localID) | 66 | public bool ContainsKey(uint localID) |
67 | { | 67 | { |
68 | lock (m_lock) | 68 | lock (m_lock) |
69 | { | 69 | { |
70 | return m_eb_localID.ContainsKey(localID); | 70 | return m_eb_localID.ContainsKey(localID); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | public bool Remove(uint localID) | 74 | public bool Remove(uint localID) |
75 | { | 75 | { |
76 | lock(m_lock) | 76 | lock(m_lock) |
77 | { | 77 | { |
78 | bool a = m_eb_uuid.Remove(m_eb_localID[localID].UUID); | 78 | bool a = m_eb_uuid.Remove(m_eb_localID[localID].UUID); |
79 | bool b = m_eb_localID.Remove(localID); | 79 | bool b = m_eb_localID.Remove(localID); |
80 | 80 | ||
81 | return a && b; | 81 | return a && b; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | public bool Remove(UUID id) | 85 | public bool Remove(UUID id) |
86 | { | 86 | { |
87 | lock(m_lock) | 87 | lock(m_lock) |
88 | { | 88 | { |
89 | bool a = m_eb_localID.Remove(m_eb_uuid[id].LocalId); | 89 | bool a = m_eb_localID.Remove(m_eb_uuid[id].LocalId); |
90 | bool b = m_eb_uuid.Remove(id); | 90 | bool b = m_eb_uuid.Remove(id); |
91 | 91 | ||
92 | return a && b; | 92 | return a && b; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | public List<EntityBase> GetAllByType<T>() | 96 | public List<EntityBase> GetAllByType<T>() |
97 | { | 97 | { |
98 | List<EntityBase> tmp = new List<EntityBase>(); | 98 | List<EntityBase> tmp = new List<EntityBase>(); |
99 | 99 | ||
100 | lock(m_lock) | 100 | lock(m_lock) |
101 | { | 101 | { |
102 | foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid) | 102 | foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid) |
103 | { | 103 | { |
104 | if(pair.Value is T) | 104 | if(pair.Value is T) |
105 | { | 105 | { |
106 | tmp.Add(pair.Value); | 106 | tmp.Add(pair.Value); |
107 | } | 107 | } |
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | return tmp; | 111 | return tmp; |
112 | } | 112 | } |
113 | 113 | ||
114 | public List<EntityBase> GetEntities() | 114 | public List<EntityBase> GetEntities() |
115 | { | 115 | { |
116 | lock (m_lock) | 116 | lock (m_lock) |
117 | { | 117 | { |
118 | return new List<EntityBase>(m_eb_uuid.Values); | 118 | return new List<EntityBase>(m_eb_uuid.Values); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | public EntityBase this[UUID id] | 122 | public EntityBase this[UUID id] |
123 | { | 123 | { |
124 | get | 124 | get |
125 | { | 125 | { |
126 | lock (m_lock) | 126 | lock (m_lock) |
127 | { | 127 | { |
128 | return m_eb_uuid[id]; | 128 | return m_eb_uuid[id]; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | set | 131 | set |
132 | { | 132 | { |
133 | InsertOrReplace(value); | 133 | InsertOrReplace(value); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | public EntityBase this[uint localID] | 137 | public EntityBase this[uint localID] |
138 | { | 138 | { |
139 | get | 139 | get |
140 | { | 140 | { |
141 | lock (m_lock) | 141 | lock (m_lock) |
142 | { | 142 | { |
143 | return m_eb_localID[localID]; | 143 | return m_eb_localID[localID]; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | set | 146 | set |
147 | { | 147 | { |
148 | InsertOrReplace(value); | 148 | InsertOrReplace(value); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | public bool TryGetValue(UUID key, out EntityBase obj) | 152 | public bool TryGetValue(UUID key, out EntityBase obj) |
153 | { | 153 | { |
154 | lock(m_lock) | 154 | lock(m_lock) |
155 | { | 155 | { |
156 | return m_eb_uuid.TryGetValue(key, out obj); | 156 | return m_eb_uuid.TryGetValue(key, out obj); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | public bool TryGetValue(uint key, out EntityBase obj) | 160 | public bool TryGetValue(uint key, out EntityBase obj) |
161 | { | 161 | { |
162 | lock (m_lock) | 162 | lock (m_lock) |
163 | { | 163 | { |
164 | return m_eb_localID.TryGetValue(key, out obj); | 164 | return m_eb_localID.TryGetValue(key, out obj); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
168 | /// <summary> | 168 | /// <summary> |
169 | /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. | 169 | /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. |
170 | /// </summary> | 170 | /// </summary> |
171 | /// <returns></returns> | 171 | /// <returns></returns> |
172 | public IEnumerator<EntityBase> GetEnumerator() | 172 | public IEnumerator<EntityBase> GetEnumerator() |
173 | { | 173 | { |
174 | return GetEntities().GetEnumerator(); | 174 | return GetEntities().GetEnumerator(); |
175 | } | 175 | } |
176 | 176 | ||
177 | IEnumerator IEnumerable.GetEnumerator() | 177 | IEnumerator IEnumerable.GetEnumerator() |
178 | { | 178 | { |
179 | return GetEnumerator(); | 179 | return GetEnumerator(); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | } | 182 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs index 1715ffe..889c77e 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGAssetMapper.cs | |||
@@ -1,377 +1,377 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Threading; | 33 | using System.Threading; |
34 | 34 | ||
35 | using log4net; | 35 | using log4net; |
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | 38 | ||
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Framework.Communications.Cache; | 41 | using OpenSim.Framework.Communications.Cache; |
42 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
43 | using OpenSim.Region.Environment; | 43 | using OpenSim.Region.Environment; |
44 | using OpenSim.Region.Environment.Scenes; | 44 | using OpenSim.Region.Environment.Scenes; |
45 | 45 | ||
46 | //using HyperGrid.Framework; | 46 | //using HyperGrid.Framework; |
47 | //using OpenSim.Region.Communications.Hypergrid; | 47 | //using OpenSim.Region.Communications.Hypergrid; |
48 | 48 | ||
49 | namespace OpenSim.Region.Environment.Scenes.Hypergrid | 49 | namespace OpenSim.Region.Environment.Scenes.Hypergrid |
50 | { | 50 | { |
51 | public class HGAssetMapper | 51 | public class HGAssetMapper |
52 | { | 52 | { |
53 | #region Fields | 53 | #region Fields |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 55 | ||
56 | // This maps between asset server URLs and asset server clients | 56 | // This maps between asset server URLs and asset server clients |
57 | private Dictionary<string, GridAssetClient> m_assetServers = new Dictionary<string, GridAssetClient>(); | 57 | private Dictionary<string, GridAssetClient> m_assetServers = new Dictionary<string, GridAssetClient>(); |
58 | 58 | ||
59 | // This maps between asset UUIDs and asset servers | 59 | // This maps between asset UUIDs and asset servers |
60 | private Dictionary<UUID, GridAssetClient> m_assetMap = new Dictionary<UUID, GridAssetClient>(); | 60 | private Dictionary<UUID, GridAssetClient> m_assetMap = new Dictionary<UUID, GridAssetClient>(); |
61 | 61 | ||
62 | private Scene m_scene; | 62 | private Scene m_scene; |
63 | #endregion | 63 | #endregion |
64 | 64 | ||
65 | #region Constructor | 65 | #region Constructor |
66 | 66 | ||
67 | public HGAssetMapper(Scene scene) | 67 | public HGAssetMapper(Scene scene) |
68 | { | 68 | { |
69 | m_scene = scene; | 69 | m_scene = scene; |
70 | } | 70 | } |
71 | 71 | ||
72 | #endregion | 72 | #endregion |
73 | 73 | ||
74 | #region Internal functions | 74 | #region Internal functions |
75 | 75 | ||
76 | private string UserAssetURL(UUID userID) | 76 | private string UserAssetURL(UUID userID) |
77 | { | 77 | { |
78 | CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); | 78 | CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); |
79 | if (uinfo != null) | 79 | if (uinfo != null) |
80 | return (uinfo.UserProfile.UserAssetURI == "") ? null : uinfo.UserProfile.UserAssetURI; | 80 | return (uinfo.UserProfile.UserAssetURI == "") ? null : uinfo.UserProfile.UserAssetURI; |
81 | return null; | 81 | return null; |
82 | } | 82 | } |
83 | 83 | ||
84 | private bool IsHomeUser(UUID userID) | 84 | private bool IsHomeUser(UUID userID) |
85 | { | 85 | { |
86 | CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); | 86 | CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); |
87 | 87 | ||
88 | if (uinfo != null) | 88 | if (uinfo != null) |
89 | { | 89 | { |
90 | //if ((uinfo.UserProfile.UserAssetURI == null) || (uinfo.UserProfile.UserAssetURI == "") || | 90 | //if ((uinfo.UserProfile.UserAssetURI == null) || (uinfo.UserProfile.UserAssetURI == "") || |
91 | // uinfo.UserProfile.UserAssetURI.Equals(m_scene.CommsManager.NetworkServersInfo.AssetURL)) | 91 | // uinfo.UserProfile.UserAssetURI.Equals(m_scene.CommsManager.NetworkServersInfo.AssetURL)) |
92 | if (HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile.UserAssetURI)) | 92 | if (HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile.UserAssetURI)) |
93 | { | 93 | { |
94 | m_log.Debug("[HGScene]: Home user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); | 94 | m_log.Debug("[HGScene]: Home user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); |
95 | return true; | 95 | return true; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | m_log.Debug("[HGScene]: Foreign user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); | 99 | m_log.Debug("[HGScene]: Foreign user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); |
100 | return false; | 100 | return false; |
101 | } | 101 | } |
102 | 102 | ||
103 | private bool IsInAssetMap(UUID uuid) | 103 | private bool IsInAssetMap(UUID uuid) |
104 | { | 104 | { |
105 | return m_assetMap.ContainsKey(uuid); | 105 | return m_assetMap.ContainsKey(uuid); |
106 | } | 106 | } |
107 | 107 | ||
108 | private bool FetchAsset(GridAssetClient asscli, UUID assetID, bool isTexture) | 108 | private bool FetchAsset(GridAssetClient asscli, UUID assetID, bool isTexture) |
109 | { | 109 | { |
110 | // I'm not going over 3 seconds since this will be blocking processing of all the other inbound | 110 | // I'm not going over 3 seconds since this will be blocking processing of all the other inbound |
111 | // packets from the client. | 111 | // packets from the client. |
112 | int pollPeriod = 200; | 112 | int pollPeriod = 200; |
113 | int maxPolls = 15; | 113 | int maxPolls = 15; |
114 | 114 | ||
115 | AssetBase asset; | 115 | AssetBase asset; |
116 | 116 | ||
117 | // Maybe it came late, and it's already here. Check first. | 117 | // Maybe it came late, and it's already here. Check first. |
118 | if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset)) | 118 | if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset)) |
119 | { | 119 | { |
120 | m_log.Debug("[HGScene]: Asset already in asset cache. " + assetID); | 120 | m_log.Debug("[HGScene]: Asset already in asset cache. " + assetID); |
121 | return true; | 121 | return true; |
122 | } | 122 | } |
123 | 123 | ||
124 | 124 | ||
125 | asscli.RequestAsset(assetID, isTexture); | 125 | asscli.RequestAsset(assetID, isTexture); |
126 | 126 | ||
127 | do | 127 | do |
128 | { | 128 | { |
129 | Thread.Sleep(pollPeriod); | 129 | Thread.Sleep(pollPeriod); |
130 | 130 | ||
131 | if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset) && (asset != null)) | 131 | if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset) && (asset != null)) |
132 | { | 132 | { |
133 | m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Name + " " + assetID); | 133 | m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Name + " " + assetID); |
134 | // I think I need to store it in the asset DB too. | 134 | // I think I need to store it in the asset DB too. |
135 | // For now, let me just do it for textures and scripts | 135 | // For now, let me just do it for textures and scripts |
136 | if (((AssetType)asset.Type == AssetType.Texture) || | 136 | if (((AssetType)asset.Type == AssetType.Texture) || |
137 | ((AssetType)asset.Type == AssetType.LSLBytecode) || | 137 | ((AssetType)asset.Type == AssetType.LSLBytecode) || |
138 | ((AssetType)asset.Type == AssetType.LSLText)) | 138 | ((AssetType)asset.Type == AssetType.LSLText)) |
139 | { | 139 | { |
140 | AssetBase asset1 = new AssetBase(); | 140 | AssetBase asset1 = new AssetBase(); |
141 | Copy(asset, asset1); | 141 | Copy(asset, asset1); |
142 | m_scene.AssetCache.AssetServer.StoreAsset(asset1); | 142 | m_scene.AssetCache.AssetServer.StoreAsset(asset1); |
143 | } | 143 | } |
144 | return true; | 144 | return true; |
145 | } | 145 | } |
146 | } while (--maxPolls > 0); | 146 | } while (--maxPolls > 0); |
147 | 147 | ||
148 | m_log.WarnFormat("[HGScene]: {0} {1} was not received before the retrieval timeout was reached", | 148 | m_log.WarnFormat("[HGScene]: {0} {1} was not received before the retrieval timeout was reached", |
149 | isTexture ? "texture" : "asset", assetID.ToString()); | 149 | isTexture ? "texture" : "asset", assetID.ToString()); |
150 | 150 | ||
151 | return false; | 151 | return false; |
152 | } | 152 | } |
153 | 153 | ||
154 | private bool PostAsset(GridAssetClient asscli, UUID assetID) | 154 | private bool PostAsset(GridAssetClient asscli, UUID assetID) |
155 | { | 155 | { |
156 | AssetBase asset1; | 156 | AssetBase asset1; |
157 | m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset1); | 157 | m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset1); |
158 | 158 | ||
159 | if (asset1 != null) | 159 | if (asset1 != null) |
160 | { | 160 | { |
161 | // See long comment in AssetCache.AddAsset | 161 | // See long comment in AssetCache.AddAsset |
162 | if (!asset1.Temporary || asset1.Local) | 162 | if (!asset1.Temporary || asset1.Local) |
163 | { | 163 | { |
164 | // The asset cache returns instances of subclasses of AssetBase: | 164 | // The asset cache returns instances of subclasses of AssetBase: |
165 | // TextureImage or AssetInfo. So in passing them to the remote | 165 | // TextureImage or AssetInfo. So in passing them to the remote |
166 | // server we first need to convert this to instances of AssetBase, | 166 | // server we first need to convert this to instances of AssetBase, |
167 | // which is the serializable class for assets. | 167 | // which is the serializable class for assets. |
168 | AssetBase asset = new AssetBase(); | 168 | AssetBase asset = new AssetBase(); |
169 | Copy(asset1, asset); | 169 | Copy(asset1, asset); |
170 | 170 | ||
171 | asscli.StoreAsset(asset); | 171 | asscli.StoreAsset(asset); |
172 | } | 172 | } |
173 | return true; | 173 | return true; |
174 | } | 174 | } |
175 | else | 175 | else |
176 | m_log.Warn("[HGScene]: Tried to post asset to remote server, but asset not in local cache."); | 176 | m_log.Warn("[HGScene]: Tried to post asset to remote server, but asset not in local cache."); |
177 | 177 | ||
178 | return false; | 178 | return false; |
179 | } | 179 | } |
180 | 180 | ||
181 | private void Copy(AssetBase from, AssetBase to) | 181 | private void Copy(AssetBase from, AssetBase to) |
182 | { | 182 | { |
183 | to.Data = from.Data; | 183 | to.Data = from.Data; |
184 | to.Description = from.Description; | 184 | to.Description = from.Description; |
185 | to.FullID = from.FullID; | 185 | to.FullID = from.FullID; |
186 | to.ID = from.ID; | 186 | to.ID = from.ID; |
187 | to.Local = from.Local; | 187 | to.Local = from.Local; |
188 | to.Name = from.Name; | 188 | to.Name = from.Name; |
189 | to.Temporary = from.Temporary; | 189 | to.Temporary = from.Temporary; |
190 | to.Type = from.Type; | 190 | to.Type = from.Type; |
191 | 191 | ||
192 | } | 192 | } |
193 | 193 | ||
194 | private void _guardedAdd(Dictionary<UUID, bool> lst, UUID obj, bool val) | 194 | private void _guardedAdd(Dictionary<UUID, bool> lst, UUID obj, bool val) |
195 | { | 195 | { |
196 | if (!lst.ContainsKey(obj)) | 196 | if (!lst.ContainsKey(obj)) |
197 | lst.Add(obj, val); | 197 | lst.Add(obj, val); |
198 | } | 198 | } |
199 | 199 | ||
200 | private void SniffTextureUUIDs(Dictionary<UUID, bool> uuids, SceneObjectGroup sog) | 200 | private void SniffTextureUUIDs(Dictionary<UUID, bool> uuids, SceneObjectGroup sog) |
201 | { | 201 | { |
202 | try | 202 | try |
203 | { | 203 | { |
204 | _guardedAdd(uuids, sog.RootPart.Shape.Textures.DefaultTexture.TextureID, true); | 204 | _guardedAdd(uuids, sog.RootPart.Shape.Textures.DefaultTexture.TextureID, true); |
205 | } | 205 | } |
206 | catch (Exception) { } | 206 | catch (Exception) { } |
207 | 207 | ||
208 | foreach (Primitive.TextureEntryFace tface in sog.RootPart.Shape.Textures.FaceTextures) | 208 | foreach (Primitive.TextureEntryFace tface in sog.RootPart.Shape.Textures.FaceTextures) |
209 | { | 209 | { |
210 | try | 210 | try |
211 | { | 211 | { |
212 | _guardedAdd(uuids, tface.TextureID, true); | 212 | _guardedAdd(uuids, tface.TextureID, true); |
213 | } | 213 | } |
214 | catch (Exception) { } | 214 | catch (Exception) { } |
215 | } | 215 | } |
216 | 216 | ||
217 | foreach (SceneObjectPart sop in sog.Children.Values) | 217 | foreach (SceneObjectPart sop in sog.Children.Values) |
218 | { | 218 | { |
219 | try | 219 | try |
220 | { | 220 | { |
221 | _guardedAdd(uuids, sop.Shape.Textures.DefaultTexture.TextureID, true); | 221 | _guardedAdd(uuids, sop.Shape.Textures.DefaultTexture.TextureID, true); |
222 | } | 222 | } |
223 | catch (Exception) { } | 223 | catch (Exception) { } |
224 | foreach (Primitive.TextureEntryFace tface in sop.Shape.Textures.FaceTextures) | 224 | foreach (Primitive.TextureEntryFace tface in sop.Shape.Textures.FaceTextures) |
225 | { | 225 | { |
226 | try | 226 | try |
227 | { | 227 | { |
228 | _guardedAdd(uuids, tface.TextureID, true); | 228 | _guardedAdd(uuids, tface.TextureID, true); |
229 | } | 229 | } |
230 | catch (Exception) { } | 230 | catch (Exception) { } |
231 | } | 231 | } |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | private void SniffTaskInventoryUUIDs(Dictionary<UUID, bool> uuids, SceneObjectGroup sog) | 235 | private void SniffTaskInventoryUUIDs(Dictionary<UUID, bool> uuids, SceneObjectGroup sog) |
236 | { | 236 | { |
237 | TaskInventoryDictionary tinv = sog.RootPart.TaskInventory; | 237 | TaskInventoryDictionary tinv = sog.RootPart.TaskInventory; |
238 | 238 | ||
239 | foreach (TaskInventoryItem titem in tinv.Values) | 239 | foreach (TaskInventoryItem titem in tinv.Values) |
240 | { | 240 | { |
241 | uuids.Add(titem.AssetID, (InventoryType)titem.Type == InventoryType.Texture); | 241 | uuids.Add(titem.AssetID, (InventoryType)titem.Type == InventoryType.Texture); |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | private Dictionary<UUID, bool> SniffUUIDs(AssetBase asset) | 245 | private Dictionary<UUID, bool> SniffUUIDs(AssetBase asset) |
246 | { | 246 | { |
247 | Dictionary<UUID, bool> uuids = new Dictionary<UUID, bool>(); | 247 | Dictionary<UUID, bool> uuids = new Dictionary<UUID, bool>(); |
248 | if ((asset != null) && ((AssetType)asset.Type == AssetType.Object)) | 248 | if ((asset != null) && ((AssetType)asset.Type == AssetType.Object)) |
249 | { | 249 | { |
250 | string ass_str = Utils.BytesToString(asset.Data); | 250 | string ass_str = Utils.BytesToString(asset.Data); |
251 | SceneObjectGroup sog = new SceneObjectGroup(ass_str, true); | 251 | SceneObjectGroup sog = new SceneObjectGroup(ass_str, true); |
252 | 252 | ||
253 | SniffTextureUUIDs(uuids, sog); | 253 | SniffTextureUUIDs(uuids, sog); |
254 | 254 | ||
255 | // We need to sniff further... | 255 | // We need to sniff further... |
256 | SniffTaskInventoryUUIDs(uuids, sog); | 256 | SniffTaskInventoryUUIDs(uuids, sog); |
257 | 257 | ||
258 | } | 258 | } |
259 | 259 | ||
260 | return uuids; | 260 | return uuids; |
261 | } | 261 | } |
262 | 262 | ||
263 | private Dictionary<UUID, bool> SniffUUIDs(UUID assetID) | 263 | private Dictionary<UUID, bool> SniffUUIDs(UUID assetID) |
264 | { | 264 | { |
265 | //Dictionary<UUID, bool> uuids = new Dictionary<UUID, bool>(); | 265 | //Dictionary<UUID, bool> uuids = new Dictionary<UUID, bool>(); |
266 | 266 | ||
267 | AssetBase asset; | 267 | AssetBase asset; |
268 | m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset); | 268 | m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset); |
269 | 269 | ||
270 | return SniffUUIDs(asset); | 270 | return SniffUUIDs(asset); |
271 | } | 271 | } |
272 | 272 | ||
273 | private void Dump(Dictionary<UUID, bool> lst) | 273 | private void Dump(Dictionary<UUID, bool> lst) |
274 | { | 274 | { |
275 | m_log.Debug("XXX -------- UUID DUMP ------- XXX"); | 275 | m_log.Debug("XXX -------- UUID DUMP ------- XXX"); |
276 | foreach (KeyValuePair<UUID, bool> kvp in lst) | 276 | foreach (KeyValuePair<UUID, bool> kvp in lst) |
277 | m_log.Debug(" >> " + kvp.Key + " (texture? " + kvp.Value + ")"); | 277 | m_log.Debug(" >> " + kvp.Key + " (texture? " + kvp.Value + ")"); |
278 | m_log.Debug("XXX -------- UUID DUMP ------- XXX"); | 278 | m_log.Debug("XXX -------- UUID DUMP ------- XXX"); |
279 | } | 279 | } |
280 | 280 | ||
281 | #endregion | 281 | #endregion |
282 | 282 | ||
283 | 283 | ||
284 | #region Public interface | 284 | #region Public interface |
285 | 285 | ||
286 | public void Get(UUID itemID, UUID ownerID) | 286 | public void Get(UUID itemID, UUID ownerID) |
287 | { | 287 | { |
288 | if (!IsInAssetMap(itemID) && !IsHomeUser(ownerID)) | 288 | if (!IsInAssetMap(itemID) && !IsHomeUser(ownerID)) |
289 | { | 289 | { |
290 | // Get the item from the remote asset server onto the local AssetCache | 290 | // Get the item from the remote asset server onto the local AssetCache |
291 | // and place an entry in m_assetMap | 291 | // and place an entry in m_assetMap |
292 | 292 | ||
293 | GridAssetClient asscli = null; | 293 | GridAssetClient asscli = null; |
294 | string userAssetURL = UserAssetURL(ownerID); | 294 | string userAssetURL = UserAssetURL(ownerID); |
295 | if (userAssetURL != null) | 295 | if (userAssetURL != null) |
296 | { | 296 | { |
297 | m_assetServers.TryGetValue(userAssetURL, out asscli); | 297 | m_assetServers.TryGetValue(userAssetURL, out asscli); |
298 | if (asscli == null) | 298 | if (asscli == null) |
299 | { | 299 | { |
300 | m_log.Debug("[HGScene]: Starting new GridAssetClient for " + userAssetURL); | 300 | m_log.Debug("[HGScene]: Starting new GridAssetClient for " + userAssetURL); |
301 | asscli = new GridAssetClient(userAssetURL); | 301 | asscli = new GridAssetClient(userAssetURL); |
302 | asscli.SetReceiver(m_scene.CommsManager.AssetCache); // Straight to the asset cache! | 302 | asscli.SetReceiver(m_scene.CommsManager.AssetCache); // Straight to the asset cache! |
303 | m_assetServers.Add(userAssetURL, asscli); | 303 | m_assetServers.Add(userAssetURL, asscli); |
304 | } | 304 | } |
305 | 305 | ||
306 | m_log.Debug("[HGScene]: Fetching object " + itemID + " to asset server " + userAssetURL); | 306 | m_log.Debug("[HGScene]: Fetching object " + itemID + " to asset server " + userAssetURL); |
307 | bool success = FetchAsset(asscli, itemID, false); // asscli.RequestAsset(item.ItemID, false); | 307 | bool success = FetchAsset(asscli, itemID, false); // asscli.RequestAsset(item.ItemID, false); |
308 | 308 | ||
309 | // OK, now fetch the inside. | 309 | // OK, now fetch the inside. |
310 | Dictionary<UUID, bool> ids = SniffUUIDs(itemID); | 310 | Dictionary<UUID, bool> ids = SniffUUIDs(itemID); |
311 | Dump(ids); | 311 | Dump(ids); |
312 | foreach (KeyValuePair<UUID, bool> kvp in ids) | 312 | foreach (KeyValuePair<UUID, bool> kvp in ids) |
313 | FetchAsset(asscli, kvp.Key, kvp.Value); | 313 | FetchAsset(asscli, kvp.Key, kvp.Value); |
314 | 314 | ||
315 | 315 | ||
316 | if (success) | 316 | if (success) |
317 | { | 317 | { |
318 | m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL); | 318 | m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL); |
319 | m_assetMap.Add(itemID, asscli); | 319 | m_assetMap.Add(itemID, asscli); |
320 | } | 320 | } |
321 | else | 321 | else |
322 | m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL); | 322 | m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL); |
323 | } | 323 | } |
324 | else | 324 | else |
325 | m_log.Warn("[HGScene]: Unable to locate foreign user's asset server"); | 325 | m_log.Warn("[HGScene]: Unable to locate foreign user's asset server"); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | public void Post(UUID itemID, UUID ownerID) | 329 | public void Post(UUID itemID, UUID ownerID) |
330 | { | 330 | { |
331 | if (!IsHomeUser(ownerID)) | 331 | if (!IsHomeUser(ownerID)) |
332 | { | 332 | { |
333 | // Post the item from the local AssetCache ontp the remote asset server | 333 | // Post the item from the local AssetCache ontp the remote asset server |
334 | // and place an entry in m_assetMap | 334 | // and place an entry in m_assetMap |
335 | 335 | ||
336 | GridAssetClient asscli = null; | 336 | GridAssetClient asscli = null; |
337 | string userAssetURL = UserAssetURL(ownerID); | 337 | string userAssetURL = UserAssetURL(ownerID); |
338 | if (userAssetURL != null) | 338 | if (userAssetURL != null) |
339 | { | 339 | { |
340 | m_assetServers.TryGetValue(userAssetURL, out asscli); | 340 | m_assetServers.TryGetValue(userAssetURL, out asscli); |
341 | if (asscli == null) | 341 | if (asscli == null) |
342 | { | 342 | { |
343 | m_log.Debug("[HGScene]: Starting new GridAssetClient for " + userAssetURL); | 343 | m_log.Debug("[HGScene]: Starting new GridAssetClient for " + userAssetURL); |
344 | asscli = new GridAssetClient(userAssetURL); | 344 | asscli = new GridAssetClient(userAssetURL); |
345 | asscli.SetReceiver(m_scene.CommsManager.AssetCache); // Straight to the asset cache! | 345 | asscli.SetReceiver(m_scene.CommsManager.AssetCache); // Straight to the asset cache! |
346 | m_assetServers.Add(userAssetURL, asscli); | 346 | m_assetServers.Add(userAssetURL, asscli); |
347 | } | 347 | } |
348 | m_log.Debug("[HGScene]: Posting object " + itemID + " to asset server " + userAssetURL); | 348 | m_log.Debug("[HGScene]: Posting object " + itemID + " to asset server " + userAssetURL); |
349 | bool success = PostAsset(asscli, itemID); | 349 | bool success = PostAsset(asscli, itemID); |
350 | 350 | ||
351 | // Now the inside | 351 | // Now the inside |
352 | Dictionary<UUID, bool> ids = SniffUUIDs(itemID); | 352 | Dictionary<UUID, bool> ids = SniffUUIDs(itemID); |
353 | Dump(ids); | 353 | Dump(ids); |
354 | foreach (KeyValuePair<UUID, bool> kvp in ids) | 354 | foreach (KeyValuePair<UUID, bool> kvp in ids) |
355 | PostAsset(asscli, kvp.Key); | 355 | PostAsset(asscli, kvp.Key); |
356 | 356 | ||
357 | if (success) | 357 | if (success) |
358 | { | 358 | { |
359 | m_log.Debug("[HGScene]: Successfully posted item to remote asset server " + userAssetURL); | 359 | m_log.Debug("[HGScene]: Successfully posted item to remote asset server " + userAssetURL); |
360 | m_assetMap.Add(itemID, asscli); | 360 | m_assetMap.Add(itemID, asscli); |
361 | } | 361 | } |
362 | else | 362 | else |
363 | m_log.Warn("[HGScene]: Could not post asset to remote asset server " + userAssetURL); | 363 | m_log.Warn("[HGScene]: Could not post asset to remote asset server " + userAssetURL); |
364 | 364 | ||
365 | //if (!m_assetMap.ContainsKey(itemID)) | 365 | //if (!m_assetMap.ContainsKey(itemID)) |
366 | // m_assetMap.Add(itemID, asscli); | 366 | // m_assetMap.Add(itemID, asscli); |
367 | } | 367 | } |
368 | else | 368 | else |
369 | m_log.Warn("[HGScene]: Unable to locate foreign user's asset server"); | 369 | m_log.Warn("[HGScene]: Unable to locate foreign user's asset server"); |
370 | 370 | ||
371 | } | 371 | } |
372 | } | 372 | } |
373 | 373 | ||
374 | #endregion | 374 | #endregion |
375 | 375 | ||
376 | } | 376 | } |
377 | } | 377 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs index af3c04f..92627d1 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs | |||
@@ -1,152 +1,152 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Threading; | 33 | using System.Threading; |
34 | 34 | ||
35 | using log4net; | 35 | using log4net; |
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | 38 | ||
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Framework.Communications.Cache; | 41 | using OpenSim.Framework.Communications.Cache; |
42 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
43 | using OpenSim.Region.Environment; | 43 | using OpenSim.Region.Environment; |
44 | using OpenSim.Region.Environment.Scenes; | 44 | using OpenSim.Region.Environment.Scenes; |
45 | 45 | ||
46 | namespace OpenSim.Region.Environment.Scenes.Hypergrid | 46 | namespace OpenSim.Region.Environment.Scenes.Hypergrid |
47 | { | 47 | { |
48 | public partial class HGScene : Scene | 48 | public partial class HGScene : Scene |
49 | { | 49 | { |
50 | #region Fields | 50 | #region Fields |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | private HGAssetMapper m_assMapper; | 53 | private HGAssetMapper m_assMapper; |
54 | 54 | ||
55 | #endregion | 55 | #endregion |
56 | 56 | ||
57 | #region Constructors | 57 | #region Constructors |
58 | 58 | ||
59 | public HGScene(RegionInfo regInfo, AgentCircuitManager authen, | 59 | public HGScene(RegionInfo regInfo, AgentCircuitManager authen, |
60 | CommunicationsManager commsMan, SceneCommunicationService sceneGridService, | 60 | CommunicationsManager commsMan, SceneCommunicationService sceneGridService, |
61 | AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, | 61 | AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, |
62 | ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, | 62 | ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, |
63 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) | 63 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) |
64 | : base(regInfo, authen, commsMan, sceneGridService, assetCach, storeManager, httpServer, moduleLoader, | 64 | : base(regInfo, authen, commsMan, sceneGridService, assetCach, storeManager, httpServer, moduleLoader, |
65 | dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion) | 65 | dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion) |
66 | { | 66 | { |
67 | m_log.Info("[HGScene]: Starting HGScene."); | 67 | m_log.Info("[HGScene]: Starting HGScene."); |
68 | m_assMapper = new HGAssetMapper(this); | 68 | m_assMapper = new HGAssetMapper(this); |
69 | 69 | ||
70 | EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; | 70 | EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; |
71 | } | 71 | } |
72 | 72 | ||
73 | #endregion | 73 | #endregion |
74 | 74 | ||
75 | #region Event handlers | 75 | #region Event handlers |
76 | 76 | ||
77 | public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) | 77 | public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) |
78 | { | 78 | { |
79 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(avatarID); | 79 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(avatarID); |
80 | if (userInfo != null) | 80 | if (userInfo != null) |
81 | { | 81 | { |
82 | m_assMapper.Post(assetID, avatarID); | 82 | m_assMapper.Post(assetID, avatarID); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | #endregion | 86 | #endregion |
87 | 87 | ||
88 | #region Overrides of Scene.Inventory methods | 88 | #region Overrides of Scene.Inventory methods |
89 | 89 | ||
90 | /// | 90 | /// |
91 | /// CapsUpdateInventoryItemAsset | 91 | /// CapsUpdateInventoryItemAsset |
92 | /// | 92 | /// |
93 | public override UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) | 93 | public override UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) |
94 | { | 94 | { |
95 | UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data); | 95 | UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data); |
96 | 96 | ||
97 | UploadInventoryItem(remoteClient.AgentId, newAssetID, "", 0); | 97 | UploadInventoryItem(remoteClient.AgentId, newAssetID, "", 0); |
98 | 98 | ||
99 | return newAssetID; | 99 | return newAssetID; |
100 | } | 100 | } |
101 | 101 | ||
102 | /// | 102 | /// |
103 | /// DeleteToInventory | 103 | /// DeleteToInventory |
104 | /// | 104 | /// |
105 | public override UUID DeleteToInventory(int destination, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) | 105 | public override UUID DeleteToInventory(int destination, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) |
106 | { | 106 | { |
107 | UUID assetID = base.DeleteToInventory(destination, folderID, objectGroup, remoteClient); | 107 | UUID assetID = base.DeleteToInventory(destination, folderID, objectGroup, remoteClient); |
108 | 108 | ||
109 | if (!assetID.Equals(UUID.Zero)) | 109 | if (!assetID.Equals(UUID.Zero)) |
110 | { | 110 | { |
111 | UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); | 111 | UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); |
112 | } | 112 | } |
113 | else | 113 | else |
114 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); | 114 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); |
115 | 115 | ||
116 | return assetID; | 116 | return assetID; |
117 | } | 117 | } |
118 | 118 | ||
119 | /// | 119 | /// |
120 | /// RezObject | 120 | /// RezObject |
121 | /// | 121 | /// |
122 | public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, | 122 | public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart, |
123 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 123 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
124 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 124 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
125 | { | 125 | { |
126 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 126 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
127 | if (userInfo != null) | 127 | if (userInfo != null) |
128 | { | 128 | { |
129 | if (userInfo.RootFolder != null) | 129 | if (userInfo.RootFolder != null) |
130 | { | 130 | { |
131 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 131 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); |
132 | 132 | ||
133 | if (item != null) | 133 | if (item != null) |
134 | { | 134 | { |
135 | m_assMapper.Get(item.AssetID, remoteClient.AgentId); | 135 | m_assMapper.Get(item.AssetID, remoteClient.AgentId); |
136 | 136 | ||
137 | } | 137 | } |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | // OK, we're done fetching. Pass it up to the default RezObject | 141 | // OK, we're done fetching. Pass it up to the default RezObject |
142 | return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | 142 | return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, |
143 | RezSelected, RemoveItem, fromTaskID, attachment); | 143 | RezSelected, RemoveItem, fromTaskID, attachment); |
144 | 144 | ||
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | #endregion | 148 | #endregion |
149 | 149 | ||
150 | } | 150 | } |
151 | 151 | ||
152 | } | 152 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.cs index a1a6173..da1d3a7 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.cs | |||
@@ -1,78 +1,78 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | 31 | ||
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | 33 | ||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | 35 | ||
36 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
37 | using OpenSim.Region.Environment; | 37 | using OpenSim.Region.Environment; |
38 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
39 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 39 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
40 | 40 | ||
41 | namespace OpenSim.Region.Environment.Scenes.Hypergrid | 41 | namespace OpenSim.Region.Environment.Scenes.Hypergrid |
42 | { | 42 | { |
43 | public partial class HGScene : Scene | 43 | public partial class HGScene : Scene |
44 | { | 44 | { |
45 | /// <summary> | 45 | /// <summary> |
46 | /// Teleport an avatar to their home region | 46 | /// Teleport an avatar to their home region |
47 | /// </summary> | 47 | /// </summary> |
48 | /// <param name="agentId"></param> | 48 | /// <param name="agentId"></param> |
49 | /// <param name="client"></param> | 49 | /// <param name="client"></param> |
50 | public override void TeleportClientHome(UUID agentId, IClientAPI client) | 50 | public override void TeleportClientHome(UUID agentId, IClientAPI client) |
51 | { | 51 | { |
52 | m_log.Debug("[HGScene]: TeleportClientHome " + client.FirstName + " " + client.LastName); | 52 | m_log.Debug("[HGScene]: TeleportClientHome " + client.FirstName + " " + client.LastName); |
53 | 53 | ||
54 | CachedUserInfo uinfo = CommsManager.UserProfileCacheService.GetUserDetails(agentId); | 54 | CachedUserInfo uinfo = CommsManager.UserProfileCacheService.GetUserDetails(agentId); |
55 | UserProfileData UserProfile = uinfo.UserProfile; | 55 | UserProfileData UserProfile = uinfo.UserProfile; |
56 | 56 | ||
57 | if (UserProfile != null) | 57 | if (UserProfile != null) |
58 | { | 58 | { |
59 | RegionInfo regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion); | 59 | RegionInfo regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion); |
60 | //if (regionInfo != null) | 60 | //if (regionInfo != null) |
61 | //{ | 61 | //{ |
62 | // UserProfile.HomeRegionID = regionInfo.RegionID; | 62 | // UserProfile.HomeRegionID = regionInfo.RegionID; |
63 | // //CommsManager.UserService.UpdateUserProfile(UserProfile); | 63 | // //CommsManager.UserService.UpdateUserProfile(UserProfile); |
64 | //} | 64 | //} |
65 | if (regionInfo == null) | 65 | if (regionInfo == null) |
66 | { | 66 | { |
67 | // can't find the Home region: Tell viewer and abort | 67 | // can't find the Home region: Tell viewer and abort |
68 | client.SendTeleportFailed("Your home-region could not be found."); | 68 | client.SendTeleportFailed("Your home-region could not be found."); |
69 | return; | 69 | return; |
70 | } | 70 | } |
71 | RequestTeleportLocation( | 71 | RequestTeleportLocation( |
72 | client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, | 72 | client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt, |
73 | (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); | 73 | (uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome)); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | } | 77 | } |
78 | } | 78 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs index 501584a..9eb331a 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs | |||
@@ -1,263 +1,263 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | 33 | ||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | 35 | ||
36 | using log4net; | 36 | using log4net; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
40 | using OpenSim.Region.Environment.Scenes; | 40 | using OpenSim.Region.Environment.Scenes; |
41 | using OpenSim.Region.Environment; | 41 | using OpenSim.Region.Environment; |
42 | using OpenSim.Region.Interfaces; | 42 | using OpenSim.Region.Interfaces; |
43 | using OSD = OpenMetaverse.StructuredData.OSD; | 43 | using OSD = OpenMetaverse.StructuredData.OSD; |
44 | 44 | ||
45 | namespace OpenSim.Region.Environment.Scenes.Hypergrid | 45 | namespace OpenSim.Region.Environment.Scenes.Hypergrid |
46 | { | 46 | { |
47 | public class HGSceneCommunicationService : SceneCommunicationService | 47 | public class HGSceneCommunicationService : SceneCommunicationService |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private IHyperlink m_hg; | 51 | private IHyperlink m_hg; |
52 | 52 | ||
53 | public HGSceneCommunicationService(CommunicationsManager commsMan, IHyperlink hg) : base(commsMan) | 53 | public HGSceneCommunicationService(CommunicationsManager commsMan, IHyperlink hg) : base(commsMan) |
54 | { | 54 | { |
55 | m_hg = hg; | 55 | m_hg = hg; |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// Try to teleport an agent to a new region. | 60 | /// Try to teleport an agent to a new region. |
61 | /// </summary> | 61 | /// </summary> |
62 | /// <param name="remoteClient"></param> | 62 | /// <param name="remoteClient"></param> |
63 | /// <param name="RegionHandle"></param> | 63 | /// <param name="RegionHandle"></param> |
64 | /// <param name="position"></param> | 64 | /// <param name="position"></param> |
65 | /// <param name="lookAt"></param> | 65 | /// <param name="lookAt"></param> |
66 | /// <param name="flags"></param> | 66 | /// <param name="flags"></param> |
67 | public override void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position, | 67 | public override void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position, |
68 | Vector3 lookAt, uint teleportFlags) | 68 | Vector3 lookAt, uint teleportFlags) |
69 | { | 69 | { |
70 | if (!avatar.Scene.Permissions.CanTeleport(avatar.UUID)) | 70 | if (!avatar.Scene.Permissions.CanTeleport(avatar.UUID)) |
71 | return; | 71 | return; |
72 | 72 | ||
73 | bool destRegionUp = false; | 73 | bool destRegionUp = false; |
74 | 74 | ||
75 | IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>(); | 75 | IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>(); |
76 | 76 | ||
77 | if (regionHandle == m_regionInfo.RegionHandle) | 77 | if (regionHandle == m_regionInfo.RegionHandle) |
78 | { | 78 | { |
79 | // Teleport within the same region | 79 | // Teleport within the same region |
80 | if (position.X < 0 || position.X > Constants.RegionSize || position.Y < 0 || position.Y > Constants.RegionSize || position.Z < 0) | 80 | if (position.X < 0 || position.X > Constants.RegionSize || position.Y < 0 || position.Y > Constants.RegionSize || position.Z < 0) |
81 | { | 81 | { |
82 | Vector3 emergencyPos = new Vector3(128, 128, 128); | 82 | Vector3 emergencyPos = new Vector3(128, 128, 128); |
83 | 83 | ||
84 | m_log.WarnFormat( | 84 | m_log.WarnFormat( |
85 | "[HGSceneCommService]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", | 85 | "[HGSceneCommService]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", |
86 | position, avatar.Name, avatar.UUID, emergencyPos); | 86 | position, avatar.Name, avatar.UUID, emergencyPos); |
87 | position = emergencyPos; | 87 | position = emergencyPos; |
88 | } | 88 | } |
89 | // TODO: Get proper AVG Height | 89 | // TODO: Get proper AVG Height |
90 | float localAVHeight = 1.56f; | 90 | float localAVHeight = 1.56f; |
91 | float posZLimit = (float)avatar.Scene.GetLandHeight((int)position.X, (int)position.Y); | 91 | float posZLimit = (float)avatar.Scene.GetLandHeight((int)position.X, (int)position.Y); |
92 | float newPosZ = posZLimit + localAVHeight; | 92 | float newPosZ = posZLimit + localAVHeight; |
93 | if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) | 93 | if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) |
94 | { | 94 | { |
95 | position.Z = newPosZ; | 95 | position.Z = newPosZ; |
96 | } | 96 | } |
97 | 97 | ||
98 | // Only send this if the event queue is null | 98 | // Only send this if the event queue is null |
99 | if (eq == null) | 99 | if (eq == null) |
100 | avatar.ControllingClient.SendTeleportLocationStart(); | 100 | avatar.ControllingClient.SendTeleportLocationStart(); |
101 | 101 | ||
102 | 102 | ||
103 | avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 103 | avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
104 | avatar.Teleport(position); | 104 | avatar.Teleport(position); |
105 | } | 105 | } |
106 | else | 106 | else |
107 | { | 107 | { |
108 | RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle); | 108 | RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle); |
109 | if (reg != null) | 109 | if (reg != null) |
110 | { | 110 | { |
111 | /// | 111 | /// |
112 | /// Hypergrid mod start | 112 | /// Hypergrid mod start |
113 | /// | 113 | /// |
114 | /// | 114 | /// |
115 | bool isHyperLink = m_hg.IsHyperlinkRegion(reg.RegionHandle); | 115 | bool isHyperLink = m_hg.IsHyperlinkRegion(reg.RegionHandle); |
116 | bool isHomeUser = true; | 116 | bool isHomeUser = true; |
117 | ulong realHandle = regionHandle; | 117 | ulong realHandle = regionHandle; |
118 | CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID); | 118 | CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID); |
119 | if (uinfo != null) | 119 | if (uinfo != null) |
120 | { | 120 | { |
121 | isHomeUser = HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile.UserAssetURI); | 121 | isHomeUser = HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile.UserAssetURI); |
122 | realHandle = m_hg.FindRegionHandle(regionHandle); | 122 | realHandle = m_hg.FindRegionHandle(regionHandle); |
123 | Console.WriteLine("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString()); | 123 | Console.WriteLine("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString()); |
124 | } | 124 | } |
125 | /// | 125 | /// |
126 | /// Hypergrid mod stop | 126 | /// Hypergrid mod stop |
127 | /// | 127 | /// |
128 | /// | 128 | /// |
129 | 129 | ||
130 | if (eq == null) | 130 | if (eq == null) |
131 | avatar.ControllingClient.SendTeleportLocationStart(); | 131 | avatar.ControllingClient.SendTeleportLocationStart(); |
132 | 132 | ||
133 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); | 133 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); |
134 | agent.BaseFolder = UUID.Zero; | 134 | agent.BaseFolder = UUID.Zero; |
135 | agent.InventoryFolder = UUID.Zero; | 135 | agent.InventoryFolder = UUID.Zero; |
136 | agent.startpos = position; | 136 | agent.startpos = position; |
137 | agent.child = true; | 137 | agent.child = true; |
138 | 138 | ||
139 | if (reg.RemotingAddress != "" && reg.RemotingPort != 0) | 139 | if (reg.RemotingAddress != "" && reg.RemotingPort != 0) |
140 | { | 140 | { |
141 | // region is remote. see if it is up | 141 | // region is remote. see if it is up |
142 | destRegionUp = m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort); | 142 | destRegionUp = m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort); |
143 | } | 143 | } |
144 | else | 144 | else |
145 | { | 145 | { |
146 | // assume local regions are always up | 146 | // assume local regions are always up |
147 | destRegionUp = true; | 147 | destRegionUp = true; |
148 | } | 148 | } |
149 | 149 | ||
150 | if (destRegionUp) | 150 | if (destRegionUp) |
151 | { | 151 | { |
152 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 152 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
153 | // both regions | 153 | // both regions |
154 | if (avatar.ParentID != (uint)0) | 154 | if (avatar.ParentID != (uint)0) |
155 | avatar.StandUp(); | 155 | avatar.StandUp(); |
156 | if (!avatar.ValidateAttachments()) | 156 | if (!avatar.ValidateAttachments()) |
157 | { | 157 | { |
158 | avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); | 158 | avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); |
159 | return; | 159 | return; |
160 | } | 160 | } |
161 | 161 | ||
162 | // the avatar.Close below will clear the child region list. We need this below for (possibly) | 162 | // the avatar.Close below will clear the child region list. We need this below for (possibly) |
163 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | 163 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). |
164 | List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); | 164 | List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); |
165 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | 165 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport |
166 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | 166 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail |
167 | // once we reach here... | 167 | // once we reach here... |
168 | avatar.Scene.RemoveCapsHandler(avatar.UUID); | 168 | avatar.Scene.RemoveCapsHandler(avatar.UUID); |
169 | agent.child = false; | 169 | agent.child = false; |
170 | m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent); | 170 | m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent); |
171 | 171 | ||
172 | m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, | 172 | m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, |
173 | position, false); | 173 | position, false); |
174 | Thread.Sleep(2000); | 174 | Thread.Sleep(2000); |
175 | AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); | 175 | AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); |
176 | 176 | ||
177 | // TODO Should construct this behind a method | 177 | // TODO Should construct this behind a method |
178 | string capsPath = | 178 | string capsPath = |
179 | "http://" + reg.ExternalHostName + ":" + reg.HttpPort | 179 | "http://" + reg.ExternalHostName + ":" + reg.HttpPort |
180 | + "/CAPS/" + circuitdata.CapsPath + "0000/"; | 180 | + "/CAPS/" + circuitdata.CapsPath + "0000/"; |
181 | 181 | ||
182 | m_log.DebugFormat( | 182 | m_log.DebugFormat( |
183 | "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); | 183 | "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); |
184 | 184 | ||
185 | 185 | ||
186 | /// | 186 | /// |
187 | /// Hypergrid mod: realHandle instead of reg.RegionHandle | 187 | /// Hypergrid mod: realHandle instead of reg.RegionHandle |
188 | /// | 188 | /// |
189 | /// | 189 | /// |
190 | if (eq != null) | 190 | if (eq != null) |
191 | { | 191 | { |
192 | OSD Item = EventQueueHelper.TeleportFinishEvent(realHandle, 13, reg.ExternalEndPoint, | 192 | OSD Item = EventQueueHelper.TeleportFinishEvent(realHandle, 13, reg.ExternalEndPoint, |
193 | 4, teleportFlags, capsPath, avatar.UUID); | 193 | 4, teleportFlags, capsPath, avatar.UUID); |
194 | eq.Enqueue(Item, avatar.UUID); | 194 | eq.Enqueue(Item, avatar.UUID); |
195 | } | 195 | } |
196 | else | 196 | else |
197 | { | 197 | { |
198 | avatar.ControllingClient.SendRegionTeleport(realHandle, 13, reg.ExternalEndPoint, 4, | 198 | avatar.ControllingClient.SendRegionTeleport(realHandle, 13, reg.ExternalEndPoint, 4, |
199 | teleportFlags, capsPath); | 199 | teleportFlags, capsPath); |
200 | } | 200 | } |
201 | /// | 201 | /// |
202 | /// Hypergrid mod stop | 202 | /// Hypergrid mod stop |
203 | /// | 203 | /// |
204 | 204 | ||
205 | avatar.MakeChildAgent(); | 205 | avatar.MakeChildAgent(); |
206 | Thread.Sleep(7000); | 206 | Thread.Sleep(7000); |
207 | avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); | 207 | avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); |
208 | if (KiPrimitive != null) | 208 | if (KiPrimitive != null) |
209 | { | 209 | { |
210 | KiPrimitive(avatar.LocalId); | 210 | KiPrimitive(avatar.LocalId); |
211 | } | 211 | } |
212 | 212 | ||
213 | avatar.Close(); | 213 | avatar.Close(); |
214 | 214 | ||
215 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | 215 | uint newRegionX = (uint)(reg.RegionHandle >> 40); |
216 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | 216 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); |
217 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); | 217 | uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); |
218 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); | 218 | uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); |
219 | /// | 219 | /// |
220 | /// Hypergrid mod: extra check for isHyperLink | 220 | /// Hypergrid mod: extra check for isHyperLink |
221 | /// | 221 | /// |
222 | if ((Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) || isHyperLink) | 222 | if ((Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) || isHyperLink) |
223 | { | 223 | { |
224 | //SendCloseChildAgentConnections(avatar.UUID, avatar.GetKnownRegionList()); | 224 | //SendCloseChildAgentConnections(avatar.UUID, avatar.GetKnownRegionList()); |
225 | SendCloseChildAgentConnections(avatar.UUID, childRegions); | 225 | SendCloseChildAgentConnections(avatar.UUID, childRegions); |
226 | CloseConnection(avatar.UUID); | 226 | CloseConnection(avatar.UUID); |
227 | } | 227 | } |
228 | // if (teleport success) // seems to be always success here | 228 | // if (teleport success) // seems to be always success here |
229 | // the user may change their profile information in other region, | 229 | // the user may change their profile information in other region, |
230 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 230 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
231 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) | 231 | if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) |
232 | m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); | 232 | m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); |
233 | m_log.InfoFormat("[HGSceneCommService]: User {0} is going to another region, profile cache removed", avatar.UUID); | 233 | m_log.InfoFormat("[HGSceneCommService]: User {0} is going to another region, profile cache removed", avatar.UUID); |
234 | } | 234 | } |
235 | else | 235 | else |
236 | { | 236 | { |
237 | avatar.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); | 237 | avatar.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | else | 240 | else |
241 | { | 241 | { |
242 | // TP to a place that doesn't exist (anymore) | 242 | // TP to a place that doesn't exist (anymore) |
243 | // Inform the viewer about that | 243 | // Inform the viewer about that |
244 | avatar.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore"); | 244 | avatar.ControllingClient.SendTeleportFailed("The region you tried to teleport to doesn't exist anymore"); |
245 | 245 | ||
246 | // and set the map-tile to '(Offline)' | 246 | // and set the map-tile to '(Offline)' |
247 | uint regX, regY; | 247 | uint regX, regY; |
248 | Utils.LongToUInts(regionHandle, out regX, out regY); | 248 | Utils.LongToUInts(regionHandle, out regX, out regY); |
249 | 249 | ||
250 | MapBlockData block = new MapBlockData(); | 250 | MapBlockData block = new MapBlockData(); |
251 | block.X = (ushort)(regX / Constants.RegionSize); | 251 | block.X = (ushort)(regX / Constants.RegionSize); |
252 | block.Y = (ushort)(regY / Constants.RegionSize); | 252 | block.Y = (ushort)(regY / Constants.RegionSize); |
253 | block.Access = 254; // == not there | 253 | block.Access = 254; // == not there |
254 | 254 | ||
255 | List<MapBlockData> blocks = new List<MapBlockData>(); | 255 | List<MapBlockData> blocks = new List<MapBlockData>(); |
256 | blocks.Add(block); | 256 | blocks.Add(block); |
257 | avatar.ControllingClient.SendMapBlock(blocks, 0); | 257 | avatar.ControllingClient.SendMapBlock(blocks, 0); |
258 | } | 258 | } |
259 | } | 259 | } |
260 | } | 260 | } |
261 | 261 | ||
262 | } | 262 | } |
263 | } | 263 | } |