diff options
Diffstat (limited to 'OpenSim/Grid/GridServer')
-rw-r--r-- | OpenSim/Grid/GridServer/GridMessagingModule.cs | 43 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/GridXmlRpcModule.cs | 8 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/IGridMessagingMapper.cs (renamed from OpenSim/Grid/GridServer/IGridMessagingModule.cs) | 78 |
3 files changed, 75 insertions, 54 deletions
diff --git a/OpenSim/Grid/GridServer/GridMessagingModule.cs b/OpenSim/Grid/GridServer/GridMessagingModule.cs index 16623e7..14ce727 100644 --- a/OpenSim/Grid/GridServer/GridMessagingModule.cs +++ b/OpenSim/Grid/GridServer/GridMessagingModule.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Framework; | |||
37 | 37 | ||
38 | namespace OpenSim.Grid.GridServer | 38 | namespace OpenSim.Grid.GridServer |
39 | { | 39 | { |
40 | public class GridMessagingModule : IGridMessagingModule | 40 | public class GridMessagingModule : IGridMessagingMapper |
41 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
@@ -54,12 +54,7 @@ namespace OpenSim.Grid.GridServer | |||
54 | protected BaseHttpServer m_httpServer; | 54 | protected BaseHttpServer m_httpServer; |
55 | 55 | ||
56 | // This is here so that the grid server can hand out MessageServer settings to regions on registration | 56 | // This is here so that the grid server can hand out MessageServer settings to regions on registration |
57 | private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>(); | 57 | private List<MessageServerInfo> m_messageServers = new List<MessageServerInfo>(); |
58 | |||
59 | public List<MessageServerInfo> MessageServers | ||
60 | { | ||
61 | get { return _MessageServers; } | ||
62 | } | ||
63 | 58 | ||
64 | public GridMessagingModule() | 59 | public GridMessagingModule() |
65 | { | 60 | { |
@@ -72,7 +67,7 @@ namespace OpenSim.Grid.GridServer | |||
72 | m_gridCore = gridCore; | 67 | m_gridCore = gridCore; |
73 | m_config = config; | 68 | m_config = config; |
74 | 69 | ||
75 | m_gridCore.RegisterInterface<IGridMessagingModule>(this); | 70 | m_gridCore.RegisterInterface<IGridMessagingMapper>(this); |
76 | 71 | ||
77 | RegisterHandlers(); | 72 | RegisterHandlers(); |
78 | } | 73 | } |
@@ -92,6 +87,14 @@ namespace OpenSim.Grid.GridServer | |||
92 | m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); | 87 | m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); |
93 | } | 88 | } |
94 | 89 | ||
90 | public List<MessageServerInfo> GetMessageServersList() | ||
91 | { | ||
92 | lock (m_messageServers) | ||
93 | { | ||
94 | return new List<MessageServerInfo>(m_messageServers); | ||
95 | } | ||
96 | } | ||
97 | |||
95 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) | 98 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) |
96 | { | 99 | { |
97 | XmlRpcResponse response = new XmlRpcResponse(); | 100 | XmlRpcResponse response = new XmlRpcResponse(); |
@@ -107,8 +110,7 @@ namespace OpenSim.Grid.GridServer | |||
107 | m.URI = URI; | 110 | m.URI = URI; |
108 | m.sendkey = sendkey; | 111 | m.sendkey = sendkey; |
109 | m.recvkey = recvkey; | 112 | m.recvkey = recvkey; |
110 | if (!_MessageServers.Contains(m)) | 113 | RegisterMessageServer(m); |
111 | _MessageServers.Add(m); | ||
112 | responseData["responsestring"] = "TRUE"; | 114 | responseData["responsestring"] = "TRUE"; |
113 | response.Value = responseData; | 115 | response.Value = responseData; |
114 | } | 116 | } |
@@ -130,12 +132,29 @@ namespace OpenSim.Grid.GridServer | |||
130 | m.URI = URI; | 132 | m.URI = URI; |
131 | m.sendkey = sendkey; | 133 | m.sendkey = sendkey; |
132 | m.recvkey = recvkey; | 134 | m.recvkey = recvkey; |
133 | if (_MessageServers.Contains(m)) | 135 | DeRegisterMessageServer(m); |
134 | _MessageServers.Remove(m); | ||
135 | responseData["responsestring"] = "TRUE"; | 136 | responseData["responsestring"] = "TRUE"; |
136 | response.Value = responseData; | 137 | response.Value = responseData; |
137 | } | 138 | } |
138 | return response; | 139 | return response; |
139 | } | 140 | } |
141 | |||
142 | public void RegisterMessageServer(MessageServerInfo m) | ||
143 | { | ||
144 | lock (m_messageServers) | ||
145 | { | ||
146 | if (!m_messageServers.Contains(m)) | ||
147 | m_messageServers.Add(m); | ||
148 | } | ||
149 | } | ||
150 | |||
151 | public void DeRegisterMessageServer(MessageServerInfo m) | ||
152 | { | ||
153 | lock (m_messageServers) | ||
154 | { | ||
155 | if (m_messageServers.Contains(m)) | ||
156 | m_messageServers.Remove(m); | ||
157 | } | ||
158 | } | ||
140 | } | 159 | } |
141 | } | 160 | } |
diff --git a/OpenSim/Grid/GridServer/GridXmlRpcModule.cs b/OpenSim/Grid/GridServer/GridXmlRpcModule.cs index 874b57f..e0e16b5 100644 --- a/OpenSim/Grid/GridServer/GridXmlRpcModule.cs +++ b/OpenSim/Grid/GridServer/GridXmlRpcModule.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Grid.GridServer | |||
50 | 50 | ||
51 | protected GridConfig m_config; | 51 | protected GridConfig m_config; |
52 | 52 | ||
53 | protected IGridMessagingModule m_messagingServerMapper; | 53 | protected IGridMessagingMapper m_messagingServerMapper; |
54 | /// <value> | 54 | /// <value> |
55 | /// Used to notify old regions as to which OpenSim version to upgrade to | 55 | /// Used to notify old regions as to which OpenSim version to upgrade to |
56 | /// </value> | 56 | /// </value> |
@@ -79,8 +79,8 @@ namespace OpenSim.Grid.GridServer | |||
79 | 79 | ||
80 | public void PostInitialise() | 80 | public void PostInitialise() |
81 | { | 81 | { |
82 | IGridMessagingModule messagingModule; | 82 | IGridMessagingMapper messagingModule; |
83 | if (m_gridCore.TryGet<IGridMessagingModule>(out messagingModule)) | 83 | if (m_gridCore.TryGet<IGridMessagingMapper>(out messagingModule)) |
84 | { | 84 | { |
85 | m_messagingServerMapper = messagingModule; | 85 | m_messagingServerMapper = messagingModule; |
86 | } | 86 | } |
@@ -401,7 +401,7 @@ namespace OpenSim.Grid.GridServer | |||
401 | //{ | 401 | //{ |
402 | if(m_messagingServerMapper != null) | 402 | if(m_messagingServerMapper != null) |
403 | { | 403 | { |
404 | List<MessageServerInfo> messageServers = m_messagingServerMapper.MessageServers; | 404 | List<MessageServerInfo> messageServers = m_messagingServerMapper.GetMessageServersList(); |
405 | responseData["messageserver_count"] = messageServers.Count; | 405 | responseData["messageserver_count"] = messageServers.Count; |
406 | 406 | ||
407 | for (int i = 0; i < messageServers.Count; i++) | 407 | for (int i = 0; i < messageServers.Count; i++) |
diff --git a/OpenSim/Grid/GridServer/IGridMessagingModule.cs b/OpenSim/Grid/GridServer/IGridMessagingMapper.cs index 7e37f586..0183ad5 100644 --- a/OpenSim/Grid/GridServer/IGridMessagingModule.cs +++ b/OpenSim/Grid/GridServer/IGridMessagingMapper.cs | |||
@@ -1,38 +1,40 @@ | |||
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 OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator 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 OpenSim.Framework.Servers; | 30 | using OpenSim.Framework.Servers; |
31 | 31 | ||
32 | namespace OpenSim.Grid.GridServer | 32 | namespace OpenSim.Grid.GridServer |
33 | { | 33 | { |
34 | public interface IGridMessagingModule | 34 | public interface IGridMessagingMapper |
35 | { | 35 | { |
36 | List<MessageServerInfo> MessageServers { get; } | 36 | List<MessageServerInfo> GetMessageServersList(); |
37 | } | 37 | void RegisterMessageServer(MessageServerInfo m); |
38 | } | 38 | void DeRegisterMessageServer(MessageServerInfo m); |
39 | } | ||
40 | } | ||