aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-09 05:59:49 +0000
committerTeravus Ovares2007-12-09 05:59:49 +0000
commitf2b175ef08066649a13b6a42f0a59d9bee503638 (patch)
tree084ef2d6e2c67358b85d62179aee98eaa838d25c
parentadded more packet handling stubs (diff)
downloadopensim-SC-f2b175ef08066649a13b6a42f0a59d9bee503638.zip
opensim-SC-f2b175ef08066649a13b6a42f0a59d9bee503638.tar.gz
opensim-SC-f2b175ef08066649a13b6a42f0a59d9bee503638.tar.bz2
opensim-SC-f2b175ef08066649a13b6a42f0a59d9bee503638.tar.xz
* Added some inter-region comms glue for allowing sims to chat amongst themsevles about an agent behind the agent's back.
* Will be using this glue Tomorrow/today to tell other regions what the agent's draw distance is and what region they're actually in so the region can make decisions on what prim to send, if any.
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs23
-rw-r--r--OpenSim/Framework/Communications/IInterRegionCommunications.cs1
-rw-r--r--OpenSim/Framework/IRegionCommsListener.cs3
-rw-r--r--OpenSim/Framework/RegionCommsListener.cs11
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs22
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs86
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs26
7 files changed, 172 insertions, 0 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
new file mode 100644
index 0000000..c48f53a
--- /dev/null
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -0,0 +1,23 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework
6{
7 [Serializable]
8 public class ChildAgentDataUpdate
9 {
10 public ChildAgentDataUpdate()
11 {
12
13 }
14 public sLLVector3 Position;
15 public ulong regionHandle;
16 public float drawdistance;
17 public sLLVector3 cameraPosition;
18 public sLLVector3 Velocity;
19 public float AVHeight;
20 public Guid AgentID;
21 public float godlevel;
22 }
23}
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
index e025223..e20c627 100644
--- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs
+++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
@@ -36,6 +36,7 @@ namespace OpenSim.Framework.Communications
36 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); 36 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
37 bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); 37 bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData);
38 bool RegionUp(SearializableRegionInfo region, ulong regionhandle); 38 bool RegionUp(SearializableRegionInfo region, ulong regionhandle);
39 bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
39 40
40 bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); 41 bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
41 bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isFlying); 42 bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isFlying);
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs
index 53d0059..5f20362 100644
--- a/OpenSim/Framework/IRegionCommsListener.cs
+++ b/OpenSim/Framework/IRegionCommsListener.cs
@@ -48,6 +48,8 @@ namespace OpenSim.Framework
48 48
49 public delegate bool RegionUp(RegionInfo region); 49 public delegate bool RegionUp(RegionInfo region);
50 50
51 public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
52
51 53
52 54
53 public interface IRegionCommsListener 55 public interface IRegionCommsListener
@@ -62,6 +64,7 @@ namespace OpenSim.Framework
62 event UpdateNeighbours OnNeighboursUpdate; 64 event UpdateNeighbours OnNeighboursUpdate;
63 event CloseAgentConnection OnCloseAgentConnection; 65 event CloseAgentConnection OnCloseAgentConnection;
64 event RegionUp OnRegionUp; 66 event RegionUp OnRegionUp;
67 event ChildAgentUpdate OnChildAgentUpdate;
65 68
66 } 69 }
67} \ No newline at end of file 70} \ No newline at end of file
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs
index d209ff4..62c477b 100644
--- a/OpenSim/Framework/RegionCommsListener.cs
+++ b/OpenSim/Framework/RegionCommsListener.cs
@@ -43,6 +43,7 @@ namespace OpenSim.Framework
43 public event AcknowledgePrimCross OnAcknowledgePrimCrossed; 43 public event AcknowledgePrimCross OnAcknowledgePrimCrossed;
44 public event CloseAgentConnection OnCloseAgentConnection; 44 public event CloseAgentConnection OnCloseAgentConnection;
45 public event RegionUp OnRegionUp; 45 public event RegionUp OnRegionUp;
46 public event ChildAgentUpdate OnChildAgentUpdate;
46 public string debugRegionName=""; 47 public string debugRegionName="";
47 48
48 49
@@ -81,6 +82,16 @@ namespace OpenSim.Framework
81 return false; 82 return false;
82 } 83 }
83 84
85 public virtual bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
86 {
87 if (OnChildAgentUpdate != null)
88 {
89 OnChildAgentUpdate(regionHandle, cAgentData);
90 return true;
91 }
92 return false;
93 }
94
84 public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, 95 public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position,
85 bool isFlying) 96 bool isFlying)
86 { 97 {
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 9d390e4..1bf9801 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -205,6 +205,19 @@ namespace OpenSim.Region.Communications.Local
205 return false; 205 return false;
206 } 206 }
207 207
208 public virtual bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
209 {
210 if (m_regionListeners.ContainsKey(regionHandle))
211 {
212 // Console.WriteLine("CommsManager- Informing a region to expect child agent");
213 m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle, cAgentData);
214 //MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
215
216 return true;
217 }
218 return false;
219 }
220
208 public bool TriggerRegionUp(RegionInfo region, ulong regionhandle) 221 public bool TriggerRegionUp(RegionInfo region, ulong regionhandle)
209 { 222 {
210 if (m_regionListeners.ContainsKey(regionhandle)) 223 if (m_regionListeners.ContainsKey(regionhandle))
@@ -215,6 +228,15 @@ namespace OpenSim.Region.Communications.Local
215 return false; 228 return false;
216 } 229 }
217 230
231 public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
232 {
233 if (m_regionListeners.ContainsKey(regionHandle))
234 {
235 return m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle,cAgentData);
236 }
237 return false;
238 }
239
218 /// <summary> 240 /// <summary>
219 /// </summary> 241 /// </summary>
220 /// <param name="regionHandle"></param> 242 /// <param name="regionHandle"></param>
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 978111f..c556188 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -462,12 +462,83 @@ namespace OpenSim.Region.Communications.OGS1
462 InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; 462 InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim;
463 InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; 463 InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing;
464 InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; 464 InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp;
465 InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate;
465 //InterRegionSingleton.Instance.OnRegionUp += RegionUp; 466 //InterRegionSingleton.Instance.OnRegionUp += RegionUp;
466 } 467 }
467 468
468 #region Methods called by regions in this instance 469 #region Methods called by regions in this instance
469 470
471 public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
472 {
473 RegionInfo regInfo = null;
474 try
475 {
476 if (m_localBackend.ChildAgentUpdate(regionHandle, cAgentData))
477 {
478 return true;
479 }
480
481 regInfo = RequestNeighbourInfo(regionHandle);
482 if (regInfo != null)
483 {
484 //don't want to be creating a new link to the remote instance every time like we are here
485 bool retValue = false;
486
487
488 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
489 typeof(OGS1InterRegionRemoting),
490 "tcp://" + regInfo.RemotingAddress +
491 ":" + regInfo.RemotingPort +
492 "/InterRegions");
493
494 if (remObject != null)
495 {
496 retValue = remObject.ChildAgentUpdate(regionHandle, cAgentData);
497 }
498 else
499 {
500 Console.WriteLine("remoting object not found");
501 }
502 remObject = null;
503 MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to Update Child Agent data on outside region and got " + retValue.ToString());
504
505 return retValue;
506 }
507
508 return false;
509 }
510 catch (RemotingException e)
511 {
512 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
513 MainLog.Instance.Debug(e.ToString());
514 return false;
515 }
516 catch (SocketException e)
517 {
518 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
519 MainLog.Instance.Debug(e.ToString());
520 return false;
521 }
522 catch (InvalidCredentialException e)
523 {
524 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
525 MainLog.Instance.Debug(e.ToString());
526 return false;
527 }
528 catch (AuthenticationException e)
529 {
530 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
531 MainLog.Instance.Debug(e.ToString());
532 return false;
533 }
534 catch (Exception e)
535 {
536 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
537 MainLog.Instance.Debug(e.ToString());
538 return false;
539 }
470 540
541 }
471 542
472 /// <summary> 543 /// <summary>
473 /// 544 ///
@@ -877,6 +948,21 @@ namespace OpenSim.Region.Communications.OGS1
877 return false; 948 return false;
878 } 949 }
879 } 950 }
951 public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
952 {
953 MainLog.Instance.Verbose("INTER", "Incoming OGS1 Child Agent Data Update");
954
955 try
956 {
957 return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData);
958 }
959 catch (RemotingException e)
960 {
961 MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
962 return false;
963 }
964
965 }
880 966
881 /// <summary> 967 /// <summary>
882 /// 968 ///
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
index a7636da..683c471 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
@@ -43,6 +43,8 @@ namespace OpenSim.Region.Communications.OGS1
43 43
44 public delegate bool RegionUp (SearializableRegionInfo region, ulong regionhandle); 44 public delegate bool RegionUp (SearializableRegionInfo region, ulong regionhandle);
45 45
46 public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate);
47
46 public sealed class InterRegionSingleton 48 public sealed class InterRegionSingleton
47 { 49 {
48 private static readonly InterRegionSingleton instance = new InterRegionSingleton(); 50 private static readonly InterRegionSingleton instance = new InterRegionSingleton();
@@ -52,6 +54,7 @@ namespace OpenSim.Region.Communications.OGS1
52 public event InformRegionPrimGroup OnPrimGroupNear; 54 public event InformRegionPrimGroup OnPrimGroupNear;
53 public event PrimGroupArrival OnPrimGroupArrival; 55 public event PrimGroupArrival OnPrimGroupArrival;
54 public event RegionUp OnRegionUp; 56 public event RegionUp OnRegionUp;
57 public event ChildAgentUpdate OnChildAgentUpdate;
55 58
56 59
57 static InterRegionSingleton() 60 static InterRegionSingleton()
@@ -86,6 +89,15 @@ namespace OpenSim.Region.Communications.OGS1
86 return false; 89 return false;
87 } 90 }
88 91
92 public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate)
93 {
94 if (OnChildAgentUpdate != null)
95 {
96 return OnChildAgentUpdate(regionHandle, cAgentUpdate);
97 }
98 return false;
99 }
100
89 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 101 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
90 { 102 {
91 if (OnArrival != null) 103 if (OnArrival != null)
@@ -143,6 +155,20 @@ namespace OpenSim.Region.Communications.OGS1
143 } 155 }
144 } 156 }
145 157
158 public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
159 {
160 try
161 {
162 return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle,cAgentData);
163 }
164 catch (RemotingException e)
165 {
166 Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString());
167 return false;
168 }
169
170 }
171
146 public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying) 172 public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying)
147 { 173 {
148 try 174 try