* okay.. Now you can do border crossings with the security 'fixed' client.. with EventQueue enabled.

* You occasionally loose the event queue if you cross back and forth between the same regions many multiples of times. 
* But Don't try to teleport!
0.6.0-stable
Teravus Ovares 2008-09-28 02:57:53 +00:00
parent 6a863311f7
commit 25a998feb4
3 changed files with 173 additions and 87 deletions

View File

@ -68,6 +68,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
private Dictionary<UUID, BlockingLLSDQueue> queues = new Dictionary<UUID, BlockingLLSDQueue>();
#region IRegionModule methods
public void Initialise(Scene scene, IConfigSource config)
@ -171,6 +172,14 @@ namespace OpenSim.Region.Environment.Modules.Framework
private void MakeChildAgent(ScenePresence avatar)
{
m_log.DebugFormat("[EVENTQUEUE]: Make Child agent {0}.", avatar.UUID);
lock (m_ids)
{
if (m_ids.ContainsKey(avatar.UUID))
{
// close the event queue.
m_ids[avatar.UUID] = -1;
}
}
}
public void OnRegisterCaps(UUID agentID, Caps caps)
@ -209,18 +218,35 @@ namespace OpenSim.Region.Environment.Modules.Framework
debug += key.ToString() + "=" + request[key].ToString() + " ";
}
m_log.DebugFormat(debug, agentID, m_scene.RegionInfo.RegionName);
Hashtable responsedata = new Hashtable();
if (element == null) // didn't have an event in 15s
{
// Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
element = EventQueueHelper.KeepAliveEvent();
ScenePresence avatar;
m_scene.TryGetAvatar(agentID, out avatar);
//ScenePresence avatar;
//m_scene.TryGetAvatar(agentID, out avatar);
LLSDArray array = new LLSDArray();
array.Add(element);
int thisID = m_ids[agentID];
int thisID = 0;
lock (m_ids)
thisID = m_ids[agentID];
if (thisID == -1)
{
responsedata = new Hashtable();
responsedata["int_response_code"] = 502;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "";
return responsedata;
}
while (queue.Count() > 0)
{
array.Add(queue.Dequeue(1));
@ -234,7 +260,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
{
m_ids[agentID] = thisID + 1;
}
Hashtable responsedata = new Hashtable();
responsedata = new Hashtable();
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "application/llsd+xml";
responsedata["keepalive"] = true;
@ -264,7 +290,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
{
m_ids[agentID] = thisID + 1;
}
Hashtable responsedata = new Hashtable();
responsedata = new Hashtable();
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "application/llsd+xml";
responsedata["keepalive"] = true;
@ -273,27 +299,6 @@ namespace OpenSim.Region.Environment.Modules.Framework
return responsedata;
}
/*
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "application/xml";
responsedata["keepalive"] = true;
responsedata["str_response_string"] = @"<llsd><map><key>events</key><array><map><key>body</key><map><key>AgentData</key><map><key>AgentID</key>
<uuid>0fd0e798-a54f-40b1-0000-000000000000</uuid><key>SessionID</key><uuid>cc91f1fe-9d52-435d-0000-000000000000
</uuid></map><key>Info</key><map><key>LookAt</key><array><real>0.9869639873504638671875</real><real>
-0.1609439998865127563476562</real><real>0</real></array><key>Position</key><array><real>1.43747997283935546875
</real><real>95.30560302734375</real><real>57.3480987548828125</real></array></map><key>RegionData</key><map>
<key>RegionHandle</key><binary encoding=" + "\"base64\"" + @">AAPnAAAD8AA=</binary><key>SeedCapability</key><string>
https://sim7.aditi.lindenlab.com:12043/cap/64015fb3-6fee-9205-0000-000000000000</string><key>SimIP</key><binary
encoding=" + "\"base64\"" + @">yA8FSA==</binary><key>SimPort</key><integer>13005</integer></map></map><key>message</key>
<string>CrossedRegion</string></map></array><key>id</key><integer>1</integer></map></llsd>";
*/
//string requestbody = (string)request["requestbody"];
//LLSD llsdRequest = LLSDParser.DeserializeXml(request);
//System.Console.WriteLine(requestbody);
}
}
}

View File

@ -1,44 +1,44 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Net;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Region.Environment
{
public class EventQueueHelper
{
private EventQueueHelper() {} // no construction possible, it's an utility class
public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint)
{
LLSDMap llsdSimInfo = new LLSDMap(3);
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Region.Environment
{
public class EventQueueHelper
{
private EventQueueHelper() {} // no construction possible, it's an utility class
public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint)
{
LLSDMap llsdSimInfo = new LLSDMap(3);
byte[] regionhandle = new byte[8];
int i = 0;
@ -49,24 +49,89 @@ namespace OpenSim.Region.Environment
regionhandle[i++] = (byte)((Handle >> 32) % 256);
regionhandle[i++] = (byte)((Handle >> 24) % 256);
regionhandle[i++] = (byte)((Handle >> 16) % 256);
regionhandle[i++] = (byte)((Handle >> 8) % 256);
regionhandle[i++] = (byte)((Handle >> 8) % 256);
regionhandle[i++] = (byte)(Handle % 256);
llsdSimInfo.Add("Handle", new LLSDBinary(regionhandle));
llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes()));
llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port));
LLSDArray arr = new LLSDArray(1);
arr.Add(llsdSimInfo);
LLSDMap llsdBody = new LLSDMap(1);
llsdBody.Add("SimulatorInfo", arr);
LLSDMap llsdMessage = new LLSDMap(2);
llsdMessage.Add("message", new LLSDString("EnableSimulator"));
llsdMessage.Add("body", llsdBody);
return llsdMessage;
llsdSimInfo.Add("Handle", new LLSDBinary(regionhandle));
llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes()));
llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port));
LLSDArray arr = new LLSDArray(1);
arr.Add(llsdSimInfo);
LLSDMap llsdBody = new LLSDMap(1);
llsdBody.Add("SimulatorInfo", arr);
LLSDMap llsdMessage = new LLSDMap(2);
llsdMessage.Add("message", new LLSDString("EnableSimulator"));
llsdMessage.Add("body", llsdBody);
return llsdMessage;
}
public static LLSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt,
IPEndPoint newRegionExternalEndPoint,
string capsURL, UUID AgentID, UUID SessionID)
{
LLSDArray LookAtArr = new LLSDArray(3);
LookAtArr.Add(LLSD.FromReal(lookAt.X));
LookAtArr.Add(LLSD.FromReal(lookAt.Y));
LookAtArr.Add(LLSD.FromReal(lookAt.Z));
LLSDArray PositionArr = new LLSDArray(3);
PositionArr.Add(LLSD.FromReal(pos.X));
PositionArr.Add(LLSD.FromReal(pos.Y));
PositionArr.Add(LLSD.FromReal(pos.Z));
LLSDMap InfoMap = new LLSDMap(2);
InfoMap.Add("LookAt", LookAtArr);
InfoMap.Add("Position", PositionArr);
LLSDArray InfoArr = new LLSDArray(1);
InfoArr.Add(InfoMap);
LLSDMap AgentDataMap = new LLSDMap(2);
AgentDataMap.Add("AgentID", LLSD.FromUUID(AgentID));
AgentDataMap.Add("SessionID", LLSD.FromUUID(SessionID));
LLSDArray AgentDataArr = new LLSDArray(1);
AgentDataArr.Add(AgentDataMap);
LLSDMap RegionDataMap = new LLSDMap(4);
byte[] regionhandle = new byte[8];
{
int i = 0;
regionhandle[i++] = (byte)((Handle >> 56) % 256);
regionhandle[i++] = (byte)((Handle >> 48) % 256);
regionhandle[i++] = (byte)((Handle >> 40) % 256);
regionhandle[i++] = (byte)((Handle >> 32) % 256);
regionhandle[i++] = (byte)((Handle >> 24) % 256);
regionhandle[i++] = (byte)((Handle >> 16) % 256);
regionhandle[i++] = (byte)((Handle >> 8) % 256);
regionhandle[i++] = (byte)(Handle % 256);
}
RegionDataMap.Add("RegionHandle", LLSD.FromBinary(regionhandle));
RegionDataMap.Add("SeedCapability", LLSD.FromString(capsURL));
RegionDataMap.Add("SimIP", LLSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes()));
RegionDataMap.Add("SimPort", LLSD.FromInteger(newRegionExternalEndPoint.Port));
LLSDArray RegionDataArr = new LLSDArray(1);
RegionDataArr.Add(RegionDataMap);
LLSDMap llsdBody = new LLSDMap(3);
llsdBody.Add("Info", InfoArr);
llsdBody.Add("AgentData", AgentDataArr);
llsdBody.Add("RegionData", RegionDataArr);
LLSDMap llsdMessage = new LLSDMap(2);
llsdMessage.Add("message", new LLSDString("CrossedRegion"));
llsdMessage.Add("body", llsdBody);
return llsdMessage;
}
public static LLSD KeepAliveEvent()
{
@ -76,6 +141,6 @@ namespace OpenSim.Region.Environment
llsdMessage.Add("body", llsdSimInfo);
return llsdMessage;
}
}
}
}
}
}

View File

@ -37,7 +37,9 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Types;
using OpenSim.Region.Interfaces;
using OpenSim.Region.Physics.Manager;
using LLSD = OpenMetaverse.StructuredData.LLSD;
namespace OpenSim.Region.Environment.Scenes
@ -2018,8 +2020,22 @@ namespace OpenSim.Region.Environment.Scenes
m_log.DebugFormat(
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, m_uuid);
m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
IEventQueue eq = m_scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
LLSD Item = EventQueueHelper.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
capsPath, UUID, ControllingClient.SessionId);
eq.Enqueue(Item, UUID);
}
else
{
m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint,
capsPath);
}
MakeChildAgent();
// now we have a child agent in this region. Request all interesting data about other (root) agents
SendInitialFullUpdateToAllClients();