aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGGridServices.cs23
1 files changed, 15 insertions, 8 deletions
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
index fa29460..691cd4a 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
@@ -113,6 +113,8 @@ namespace OpenSim.Region.Communications.Hypergrid
113 set { m_userProfileCache = value; } 113 set { m_userProfileCache = value; }
114 } 114 }
115 115
116 private Random random;
117
116 /// <summary> 118 /// <summary>
117 /// Contructor. Adds "expect_hg_user" and "check" xmlrpc method handlers 119 /// Contructor. Adds "expect_hg_user" and "check" xmlrpc method handlers
118 /// </summary> 120 /// </summary>
@@ -125,6 +127,8 @@ namespace OpenSim.Region.Communications.Hypergrid
125 m_assetcache = asscache; 127 m_assetcache = asscache;
126 m_sceneman = sman; 128 m_sceneman = sman;
127 129
130 random = new Random();
131
128 httpServer.AddXmlRPCHandler("link_region", LinkRegionRequest); 132 httpServer.AddXmlRPCHandler("link_region", LinkRegionRequest);
129 httpServer.AddXmlRPCHandler("expect_hg_user", ExpectHGUser); 133 httpServer.AddXmlRPCHandler("expect_hg_user", ExpectHGUser);
130 134
@@ -243,7 +247,7 @@ namespace OpenSim.Region.Communications.Hypergrid
243 /// <returns></returns> 247 /// <returns></returns>
244 public virtual RegionInfo RequestNeighbourInfo(ulong regionHandle) 248 public virtual RegionInfo RequestNeighbourInfo(ulong regionHandle)
245 { 249 {
246 //Console.WriteLine("RequestNeighbourInfo for " + regionHandle); 250 //Console.WriteLine(" >> RequestNeighbourInfo for " + regionHandle);
247 foreach (RegionInfo info in m_hyperlinkRegions) 251 foreach (RegionInfo info in m_hyperlinkRegions)
248 { 252 {
249 //Console.WriteLine(" .. " + info.RegionHandle); 253 //Console.WriteLine(" .. " + info.RegionHandle);
@@ -254,7 +258,7 @@ namespace OpenSim.Region.Communications.Hypergrid
254 { 258 {
255 if (info.RegionHandle == regionHandle) 259 if (info.RegionHandle == regionHandle)
256 { 260 {
257 //Console.WriteLine("XXX------ Found known region " + info.RegionHandle); 261 //Console.WriteLine("XXX------ known region " + info.RegionHandle);
258 return info; 262 return info;
259 } 263 }
260 } 264 }
@@ -762,6 +766,12 @@ namespace OpenSim.Region.Communications.Hypergrid
762 // 1 - Preload the user data 766 // 1 - Preload the user data
763 m_userProfileCache.PreloadUserCache(userData.ID, userData); 767 m_userProfileCache.PreloadUserCache(userData.ID, userData);
764 768
769 if (m_knownRegions.ContainsKey(userData.ID))
770 {
771 // This was left here when the user departed
772 m_knownRegions.Remove(userData.ID);
773 }
774
765 // 2 - Load the region info into list of known regions 775 // 2 - Load the region info into list of known regions
766 RegionInfo rinfo = new RegionInfo(); 776 RegionInfo rinfo = new RegionInfo();
767 rinfo.RegionID = userData.HomeRegionID; 777 rinfo.RegionID = userData.HomeRegionID;
@@ -771,7 +781,7 @@ namespace OpenSim.Region.Communications.Hypergrid
771 rinfo.RegionID = userData.HomeRegionID; 781 rinfo.RegionID = userData.HomeRegionID;
772 // X=0 on the map 782 // X=0 on the map
773 rinfo.RegionLocX = 0; 783 rinfo.RegionLocX = 0;
774 rinfo.RegionLocY = (uint)m_knownRegions.Count; 784 rinfo.RegionLocY = (uint)(random.Next(0, Int32.MaxValue)); //(uint)m_knownRegions.Count;
775 rinfo.regionSecret = userRegionHandle.ToString(); 785 rinfo.regionSecret = userRegionHandle.ToString();
776 //Console.WriteLine("XXX--- Here: handle = " + rinfo.regionSecret); 786 //Console.WriteLine("XXX--- Here: handle = " + rinfo.regionSecret);
777 try 787 try
@@ -792,9 +802,6 @@ namespace OpenSim.Region.Communications.Hypergrid
792 802
793 if (!m_knownRegions.ContainsKey(userData.ID)) 803 if (!m_knownRegions.ContainsKey(userData.ID))
794 m_knownRegions.Add(userData.ID, rinfo); 804 m_knownRegions.Add(userData.ID, rinfo);
795 else
796 // just update it. The previous one was left there when the user departed
797 m_knownRegions[userData.ID] = rinfo;
798 805
799 // 3 - Send the reply 806 // 3 - Send the reply
800 Hashtable respdata = new Hashtable(); 807 Hashtable respdata = new Hashtable();
@@ -950,8 +957,8 @@ namespace OpenSim.Region.Communications.Hypergrid
950 retValue.ToString()); 957 retValue.ToString());
951 958
952 // Remove the info from this region 959 // Remove the info from this region
953 if (m_knownRegions.ContainsKey(uinfo.UserProfile.ID)) 960 //if (m_knownRegions.ContainsKey(uinfo.UserProfile.ID))
954 m_knownRegions.Remove(uinfo.UserProfile.ID); 961 // m_knownRegions.Remove(uinfo.UserProfile.ID);
955 962
956 return retValue; 963 return retValue;
957 } 964 }