public SendInitialFullUpdateToAllClients ( ) : void | ||
리턴 | void |
/// <summary> /// This Closes child agents on neighboring regions /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// </summary> protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying) { m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury); Scene m_scene = agent.Scene; ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize); GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); if (neighbourRegion != null && agent.ValidateAttachments()) { pos = pos + (agent.Velocity); SetInTransit(agent.UUID); AgentData cAgent = new AgentData(); agent.CopyTo(cAgent); cAgent.Position = pos; if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) { // region doesn't take it ResetFromTransit(agent.UUID); return agent; } agent.ControllingClient.RequestClientInfo(); string agentcaps; if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) { m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", neighbourRegion.RegionHandle); return agent; } // TODO Should construct this behind a method string capsPath = "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); if (eq != null) { eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, capsPath, agent.UUID, agent.ControllingClient.SessionId); } else { agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, capsPath); } if (!WaitForCallback(agent.UUID)) { m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent"); ResetFromTransit(agent.UUID); // Yikes! We should just have a ref to scene here. //agent.Scene.InformClientOfNeighbours(agent); EnableChildAgents(agent); return agent; } // Next, let's close the child agent connections that are too far away. agent.CloseChildAgents(neighbourx, neighboury); agent.MakeChildAgent(); // now we have a child agent in this region. Request all interesting data about other (root) agents agent.SendInitialFullUpdateToAllClients(); CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); } //m_log.Debug("AFTER CROSS"); //Scene.DumpChildrenSeeds(UUID); //DumpKnownRegions(); return agent; }
/// <summary> /// This Closes child agents on neighboring regions /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// </summary> protected ScenePresence CrossAgentSittingToNewRegionAsync(ScenePresence agent, GridRegion neighbourRegion, SceneObjectGroup grp) { Scene m_scene = agent.Scene; if (agent.ValidateAttachments()) { AgentData cAgent = new AgentData(); agent.CopyTo(cAgent); cAgent.Position = grp.AbsolutePosition; cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) { // region doesn't take it ResetFromTransit(agent.UUID); return agent; } // Next, let's close the child agent connections that are too far away. agent.CloseChildAgents((uint)neighbourRegion.RegionLocX / 256, (uint)neighbourRegion.RegionLocY / 256); string agentcaps; if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) { m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", neighbourRegion.RegionHandle); return agent; } // TODO Should construct this behind a method string capsPath = "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); if (eq != null) { eq.CrossRegion(neighbourRegion.RegionHandle, agent.AbsolutePosition, agent.Velocity, neighbourRegion.ExternalEndPoint, capsPath, agent.UUID, agent.ControllingClient.SessionId); } else { agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, agent.AbsolutePosition, agent.Velocity, neighbourRegion.ExternalEndPoint, capsPath); } agent.MakeChildAgent(); // now we have a child agent in this region. Request all interesting data about other (root) agents agent.SendInitialFullUpdateToAllClients(); CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); } return agent; }
/// <summary> /// This Closes child agents on neighboring regions /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// </summary> protected ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, bool isFlying) { m_log.DebugFormat("[SCENE COMM]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury); ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize); GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); if (neighbourRegion != null && agent.ValidateAttachments()) { pos = pos + (agent.Velocity); //CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID); //if (userInfo != null) //{ // userInfo.DropInventory(); //} //else //{ // m_log.WarnFormat("[SCENE COMM]: No cached user info found for {0} {1} on leaving region {2}", // agent.Name, agent.UUID, agent.Scene.RegionInfo.RegionName); //} //bool crossingSuccessful = // CrossToNeighbouringRegion(neighbourHandle, agent.ControllingClient.AgentId, pos, //isFlying); SetInTransit(agent.UUID); AgentData cAgent = new AgentData(); agent.CopyTo(cAgent); cAgent.Position = pos; if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; cAgent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort + "/agent/" + agent.UUID.ToString() + "/" + agent.Scene.RegionInfo.RegionHandle.ToString() + "/release/"; m_interregionCommsOut.SendChildAgentUpdate(neighbourHandle, cAgent); // Next, let's close the child agent connections that are too far away. agent.CloseChildAgents(neighbourx, neighboury); //AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); agent.ControllingClient.RequestClientInfo(); //m_log.Debug("BEFORE CROSS"); //Scene.DumpChildrenSeeds(UUID); //DumpKnownRegions(); string agentcaps; if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) { m_log.ErrorFormat("[SCENE COMM]: No CAPS information for region handle {0}, exiting CrossToNewRegion.", neighbourRegion.RegionHandle); return agent; } // TODO Should construct this behind a method string capsPath = "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); if (eq != null) { eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, capsPath, agent.UUID, agent.ControllingClient.SessionId); } else { agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, capsPath); } if (!WaitForCallback(agent.UUID)) { ResetFromTransit(agent.UUID); // Yikes! We should just have a ref to scene here. agent.Scene.InformClientOfNeighbours(agent); return agent; } agent.MakeChildAgent(); // now we have a child agent in this region. Request all interesting data about other (root) agents agent.SendInitialFullUpdateToAllClients(); agent.CrossAttachmentsIntoNewRegion(neighbourHandle, true); // m_scene.SendKillObject(m_localId); agent.Scene.NotifyMyCoarseLocationChange(); // the user may change their profile information in other region, // so the userinfo in UserProfileCache is not reliable any more, delete it if (agent.Scene.NeedSceneCacheClear(agent.UUID)) { agent.Scene.CommsManager.UserProfileCacheService.RemoveUser(agent.UUID); m_log.DebugFormat( "[SCENE COMM]: User {0} is going to another region, profile cache removed", agent.UUID); } } //m_log.Debug("AFTER CROSS"); //Scene.DumpChildrenSeeds(UUID); //DumpKnownRegions(); return agent; }