aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer/GridMessagingModule.cs
diff options
context:
space:
mode:
authorMW2009-02-23 20:01:03 +0000
committerMW2009-02-23 20:01:03 +0000
commit931754a1ab86867fb3fd388cb403938351a8da99 (patch)
tree5ebff87c8148025e3846e7f86f28ab7f21fa57f7 /OpenSim/Grid/GridServer/GridMessagingModule.cs
parentmore refactoring of the Grid server, to separate them into modules (diff)
downloadopensim-SC-931754a1ab86867fb3fd388cb403938351a8da99.zip
opensim-SC-931754a1ab86867fb3fd388cb403938351a8da99.tar.gz
opensim-SC-931754a1ab86867fb3fd388cb403938351a8da99.tar.bz2
opensim-SC-931754a1ab86867fb3fd388cb403938351a8da99.tar.xz
Renamed IGridMessagingModule to IGridMessagingMapper.
Plus some general cleanup of the GridMessagingModule.
Diffstat (limited to 'OpenSim/Grid/GridServer/GridMessagingModule.cs')
-rw-r--r--OpenSim/Grid/GridServer/GridMessagingModule.cs43
1 files changed, 31 insertions, 12 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
38namespace OpenSim.Grid.GridServer 38namespace 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}