* 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

@ -69,6 +69,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
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)
@ -210,17 +219,34 @@ namespace OpenSim.Region.Environment.Modules.Framework
}
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

@ -68,6 +68,71 @@ namespace OpenSim.Region.Environment
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()
{
LLSDMap llsdSimInfo = new LLSDMap();

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);
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();