aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs82
1 files changed, 45 insertions, 37 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
index 9e23831..595ac09 100644
--- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -169,6 +169,17 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
169 // once we reach here... 169 // once we reach here...
170 //avatar.Scene.RemoveCapsHandler(avatar.UUID); 170 //avatar.Scene.RemoveCapsHandler(avatar.UUID);
171 171
172 // Let's close some agents
173 if (isHyperLink) // close them all except this one
174 {
175 List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles);
176 regions.Remove(avatar.Scene.RegionInfo.RegionHandle);
177 SendCloseChildAgentConnections(avatar.UUID, regions);
178 }
179 else // close just a few
180 avatar.CloseChildAgents(newRegionX, newRegionY);
181
182 string capsPath = String.Empty;
172 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); 183 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
173 agent.BaseFolder = UUID.Zero; 184 agent.BaseFolder = UUID.Zero;
174 agent.InventoryFolder = UUID.Zero; 185 agent.InventoryFolder = UUID.Zero;
@@ -178,38 +189,39 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
178 { 189 {
179 // brand new agent 190 // brand new agent
180 agent.CapsPath = Util.GetRandomCapsPath(); 191 agent.CapsPath = Util.GetRandomCapsPath();
192 if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent))
193 {
194 avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
195 return;
196 }
197
198 // TODO Should construct this behind a method
199 capsPath =
200 "http://" + reg.ExternalHostName + ":" + reg.HttpPort
201 + "/CAPS/" + agent.CapsPath + "0000/";
202
203 if (eq != null)
204 {
205 OSD Item = EventQueueHelper.EnableSimulator(realHandle, reg.ExternalEndPoint);
206 eq.Enqueue(Item, avatar.UUID);
207
208 Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath);
209 eq.Enqueue(Item, avatar.UUID);
210 }
211 else
212 {
213 avatar.ControllingClient.InformClientOfNeighbour(realHandle, reg.ExternalEndPoint);
214 // TODO: make Event Queue disablable!
215 }
181 } 216 }
182 else 217 else
183 { 218 {
184 // child agent already there 219 // child agent already there
185 agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); 220 agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle);
221 capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
222 + "/CAPS/" + agent.CapsPath + "0000/";
186 } 223 }
187 224
188 if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent))
189 {
190 avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
191 return;
192 }
193
194 // TODO Should construct this behind a method
195 string capsPath =
196 "http://" + reg.ExternalHostName + ":" + reg.HttpPort
197 + "/CAPS/" + agent.CapsPath + "0000/";
198
199 if (eq != null)
200 {
201 OSD Item = EventQueueHelper.EnableSimulator(realHandle, reg.ExternalEndPoint);
202 eq.Enqueue(Item, avatar.UUID);
203
204 Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath);
205 eq.Enqueue(Item, avatar.UUID);
206 }
207 else
208 {
209 avatar.ControllingClient.InformClientOfNeighbour(realHandle, reg.ExternalEndPoint);
210 // TODO: make Event Queue disablable!
211 }
212
213 m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, 225 m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
214 position, false); 226 position, false);
215 227
@@ -258,28 +270,24 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
258 } 270 }
259 271
260 272
261 // Let's close some children agents
262 if (isHyperLink) // close them all
263 SendCloseChildAgentConnections(avatar.UUID, avatar.KnownChildRegionHandles);
264 else // close just a few
265 avatar.CloseChildAgents(newRegionX, newRegionY);
266
267 //avatar.Close(); 273 //avatar.Close();
268 274
269 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 275 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
270 /// 276 ///
271 /// Hypergrid mod: extra check for isHyperLink 277 /// Hypergrid mod: extra check for isHyperLink
272 /// 278 ///
273 //if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) 279 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink)
274 //{ 280 {
275 // CloseConnection(avatar.UUID); 281 CloseConnection(avatar.UUID);
276 //} 282 }
277 // if (teleport success) // seems to be always success here 283 // if (teleport success) // seems to be always success here
278 // the user may change their profile information in other region, 284 // the user may change their profile information in other region,
279 // so the userinfo in UserProfileCache is not reliable any more, delete it 285 // so the userinfo in UserProfileCache is not reliable any more, delete it
280 if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) 286 if (avatar.Scene.NeedSceneCacheClear(avatar.UUID))
287 {
281 m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID); 288 m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID);
282 m_log.InfoFormat("[HGSceneCommService]: User {0} is going to another region, profile cache removed", avatar.UUID); 289 m_log.InfoFormat("[HGSceneCommService]: User {0} is going to another region, profile cache removed", avatar.UUID);
290 }
283 } 291 }
284 else 292 else
285 { 293 {