aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Hypergrid
diff options
context:
space:
mode:
authorCharles Krinke2008-12-14 02:17:12 +0000
committerCharles Krinke2008-12-14 02:17:12 +0000
commite6eb571c1d19972fe7eb4c3f7de113b1b91f5e02 (patch)
tree2140979c8cf3f4d4d2b60a355be65abd659508b9 /OpenSim/Region/Environment/Scenes/Hypergrid
parentMantis#2811. Thank you kindly, Diva for a patch that resolves (diff)
downloadopensim-SC_OLD-e6eb571c1d19972fe7eb4c3f7de113b1b91f5e02.zip
opensim-SC_OLD-e6eb571c1d19972fe7eb4c3f7de113b1b91f5e02.tar.gz
opensim-SC_OLD-e6eb571c1d19972fe7eb4c3f7de113b1b91f5e02.tar.bz2
opensim-SC_OLD-e6eb571c1d19972fe7eb4c3f7de113b1b91f5e02.tar.xz
Mantis#2725. Thank you kindly, Diva, for a patch that:
Adds missing protocol pieces for EstablishAgentCommunication event which allows the client to activate CAPS and the EQ for child agents.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Hypergrid')
-rw-r--r--OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs87
1 files changed, 56 insertions, 31 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
index 7505c75..4e94c52 100644
--- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -108,6 +108,12 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
108 RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle); 108 RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle);
109 if (reg != null) 109 if (reg != null)
110 { 110 {
111
112 uint newRegionX = (uint)(reg.RegionHandle >> 40);
113 uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
114 uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40);
115 uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
116
111 /// 117 ///
112 /// Hypergrid mod start 118 /// Hypergrid mod start
113 /// 119 ///
@@ -130,11 +136,6 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
130 if (eq == null) 136 if (eq == null)
131 avatar.ControllingClient.SendTeleportLocationStart(); 137 avatar.ControllingClient.SendTeleportLocationStart();
132 138
133 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
134 agent.BaseFolder = UUID.Zero;
135 agent.InventoryFolder = UUID.Zero;
136 agent.startpos = position;
137 agent.child = true;
138 139
139 if (reg.RemotingAddress != "" && reg.RemotingPort != 0) 140 if (reg.RemotingAddress != "" && reg.RemotingPort != 0)
140 { 141 {
@@ -166,14 +167,42 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
166 // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport 167 // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport
167 // failure at this point (unlike a border crossing failure). So perhaps this can never fail 168 // failure at this point (unlike a border crossing failure). So perhaps this can never fail
168 // once we reach here... 169 // once we reach here...
169 avatar.Scene.RemoveCapsHandler(avatar.UUID); 170 //avatar.Scene.RemoveCapsHandler(avatar.UUID);
170 agent.child = false; 171
171 m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent); 172 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
173 agent.BaseFolder = UUID.Zero;
174 agent.InventoryFolder = UUID.Zero;
175 agent.startpos = position;
176 agent.child = true;
177 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
178 {
179 // brand new agent
180 agent.CapsPath = Util.GetRandomCapsPath();
181 }
182 else
183 {
184 // child agent already there
185 agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle);
186 }
187
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/";
172 198
173 if (eq != null) 199 if (eq != null)
174 { 200 {
175 OSD Item = EventQueueHelper.EnableSimulator(realHandle, reg.ExternalEndPoint); 201 OSD Item = EventQueueHelper.EnableSimulator(realHandle, reg.ExternalEndPoint);
176 eq.Enqueue(Item, avatar.UUID); 202 eq.Enqueue(Item, avatar.UUID);
203
204 Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath);
205 eq.Enqueue(Item, avatar.UUID);
177 } 206 }
178 else 207 else
179 { 208 {
@@ -181,18 +210,21 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
181 // TODO: make Event Queue disablable! 210 // TODO: make Event Queue disablable!
182 } 211 }
183 212
184 m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, 213 if (!m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
185 position, false); 214 position, false))
186 Thread.Sleep(2000); 215 {
187 AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); 216 avatar.ControllingClient.SendTeleportFailed("Problem with destination.");
217 // We should close that agent we just created over at destination...
218 List<ulong> lst = new List<ulong>();
219 lst.Add(reg.RegionHandle);
220 SendCloseChildAgentAsync(avatar.UUID, lst);
221 return;
222 }
188 223
189 // TODO Should construct this behind a method 224 Thread.Sleep(2000);
190 string capsPath =
191 "http://" + reg.ExternalHostName + ":" + reg.HttpPort
192 + "/CAPS/" + circuitdata.CapsPath + "0000/";
193 225
194 m_log.DebugFormat( 226 m_log.DebugFormat(
195 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); 227 "[CAPS]: Sending new CAPS seed url {0} to client {1}", agent.CapsPath, avatar.UUID);
196 228
197 229
198 /// 230 ///
@@ -215,7 +247,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
215 /// 247 ///
216 248
217 avatar.MakeChildAgent(); 249 avatar.MakeChildAgent();
218 Thread.Sleep(7000); 250 Thread.Sleep(5000);
219 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); 251 avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
220 if (KiPrimitive != null) 252 if (KiPrimitive != null)
221 { 253 {
@@ -223,29 +255,22 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
223 } 255 }
224 256
225 257
226 uint newRegionX = (uint)(reg.RegionHandle >> 40);
227 uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
228 uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40);
229 uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
230
231 // Let's close some children agents 258 // Let's close some children agents
232 if (isHyperLink) // close them all 259 if (isHyperLink) // close them all
233 SendCloseChildAgentConnections(avatar.UUID, avatar.GetKnownRegionList()); 260 SendCloseChildAgentConnections(avatar.UUID, avatar.KnownChildRegionHandles);
234 else // close just a few 261 else // close just a few
235 avatar.CloseChildAgents(newRegionX, newRegionY); 262 avatar.CloseChildAgents(newRegionX, newRegionY);
236 263
237 avatar.Close(); 264 //avatar.Close();
238 265
239 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 266 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
240 /// 267 ///
241 /// Hypergrid mod: extra check for isHyperLink 268 /// Hypergrid mod: extra check for isHyperLink
242 /// 269 ///
243 //if ((Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 1) || isHyperLink) 270 //if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
244 //if (((int)Math.Abs((int)(newRegionX - oldRegionX)) > 1) || ((int)Math.Abs((int)(newRegionY - oldRegionY)) > 1) || isHyperLink) 271 //{
245 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) 272 // CloseConnection(avatar.UUID);
246 { 273 //}
247 CloseConnection(avatar.UUID);
248 }
249 // if (teleport success) // seems to be always success here 274 // if (teleport success) // seems to be always success here
250 // the user may change their profile information in other region, 275 // the user may change their profile information in other region,
251 // so the userinfo in UserProfileCache is not reliable any more, delete it 276 // so the userinfo in UserProfileCache is not reliable any more, delete it