aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs')
-rw-r--r--Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs77
1 files changed, 69 insertions, 8 deletions
diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
index a67f55d..db64f0c 100644
--- a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
+++ b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
@@ -2,9 +2,11 @@ using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Collections; 3using System.Collections;
4using System.Text; 4using System.Text;
5using System.Runtime.Remoting;
6using System.Runtime.Remoting.Channels;
7using System.Runtime.Remoting.Channels.Tcp;
5 8
6using OpenSim.Servers; 9using OpenSim.Servers;
7
8using OpenSim.Framework; 10using OpenSim.Framework;
9using OpenSim.Framework.Types; 11using OpenSim.Framework.Types;
10using OpenGrid.Framework.Communications; 12using OpenGrid.Framework.Communications;
@@ -14,7 +16,7 @@ using libsecondlife;
14 16
15namespace OpenGrid.Framework.Communications.OGS1 17namespace OpenGrid.Framework.Communications.OGS1
16{ 18{
17 public class OGS1GridServices : IGridServices 19 public class OGS1GridServices : IGridServices, IInterRegionCommunications
18 { 20 {
19 public Dictionary<ulong, RegionCommsListener> listeners = new Dictionary<ulong, RegionCommsListener>(); 21 public Dictionary<ulong, RegionCommsListener> listeners = new Dictionary<ulong, RegionCommsListener>();
20 public GridInfo grid; 22 public GridInfo grid;
@@ -49,19 +51,19 @@ namespace OpenGrid.Framework.Communications.OGS1
49 string errorstring = (string)GridRespData["error"]; 51 string errorstring = (string)GridRespData["error"];
50 OpenSim.Framework.Console.MainLog.Instance.Error("Unable to connect to grid: " + errorstring); 52 OpenSim.Framework.Console.MainLog.Instance.Error("Unable to connect to grid: " + errorstring);
51 return null; 53 return null;
52 } 54 }
53
54 // Initialise the background listeners
55 listeners[regionInfo.RegionHandle] = new RegionCommsListener();
56 55
57 if (!initialised) 56 if (!this.listeners.ContainsKey(regionInfo.RegionHandle))
58 { 57 {
59 initialised = true; 58 // initialised = true;
60 httpListener = new BaseHttpServer(regionInfo.CommsIPListenPort); 59 httpListener = new BaseHttpServer(regionInfo.CommsIPListenPort);
61 httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser); 60 httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser);
62 httpListener.Start(); 61 httpListener.Start();
63 } 62 }
64 63
64 // Initialise the background listeners
65 listeners[regionInfo.RegionHandle] = new RegionCommsListener();
66
65 return listeners[regionInfo.RegionHandle]; 67 return listeners[regionInfo.RegionHandle];
66 } 68 }
67 69
@@ -182,6 +184,65 @@ namespace OpenGrid.Framework.Communications.OGS1
182 return new XmlRpcResponse(); 184 return new XmlRpcResponse();
183 } 185 }
184 186
187 #region InterRegion Comms
188 private void StartRemoting()
189 {
190 TcpChannel ch = new TcpChannel(8895);
191 ChannelServices.RegisterChannel(ch);
192
193 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry( Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton);
194 RemotingConfiguration.RegisterWellKnownServiceType(wellType);
195 InterRegionSingleton.Instance.OnArrival += this.IncomingArrival;
196 InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent;
197 }
198
199 #region Methods called by regions in this instance
200 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
201 {
202 if (this.listeners.ContainsKey(regionHandle))
203 {
204 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
205 return true;
206 }
207 //TODO need to see if we know about where this region is and use .net remoting
208 // to inform it.
209 return false;
210 }
185 211
212 public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
213 {
214 if (this.listeners.ContainsKey(regionHandle))
215 {
216 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
217 return true;
218 }
219 //TODO need to see if we know about where this region is and use .net remoting
220 // to inform it.
221 return false;
222 }
223 #endregion
224
225 #region Methods triggered by calls from external instances
226 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
227 {
228 if (this.listeners.ContainsKey(regionHandle))
229 {
230 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
231 return true;
232 }
233 return false;
234 }
235
236 public bool IncomingArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position)
237 {
238 if (this.listeners.ContainsKey(regionHandle))
239 {
240 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position);
241 return true;
242 }
243 return false;
244 }
245 #endregion
246 #endregion
186 } 247 }
187} 248}