diff options
author | Teravus Ovares | 2007-12-09 05:59:49 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-09 05:59:49 +0000 |
commit | f2b175ef08066649a13b6a42f0a59d9bee503638 (patch) | |
tree | 084ef2d6e2c67358b85d62179aee98eaa838d25c /OpenSim/Region/Communications | |
parent | added more packet handling stubs (diff) | |
download | opensim-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.
Diffstat (limited to '')
3 files changed, 134 insertions, 0 deletions
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 |