* 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
parent
6a863311f7
commit
25a998feb4
|
@ -68,6 +68,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
|
||||||
private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
|
private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
|
||||||
|
|
||||||
private Dictionary<UUID, BlockingLLSDQueue> queues = new Dictionary<UUID, BlockingLLSDQueue>();
|
private Dictionary<UUID, BlockingLLSDQueue> queues = new Dictionary<UUID, BlockingLLSDQueue>();
|
||||||
|
|
||||||
|
|
||||||
#region IRegionModule methods
|
#region IRegionModule methods
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
|
@ -171,6 +172,14 @@ namespace OpenSim.Region.Environment.Modules.Framework
|
||||||
private void MakeChildAgent(ScenePresence avatar)
|
private void MakeChildAgent(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[EVENTQUEUE]: Make Child agent {0}.", avatar.UUID);
|
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)
|
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||||
|
@ -209,18 +218,35 @@ namespace OpenSim.Region.Environment.Modules.Framework
|
||||||
debug += key.ToString() + "=" + request[key].ToString() + " ";
|
debug += key.ToString() + "=" + request[key].ToString() + " ";
|
||||||
}
|
}
|
||||||
m_log.DebugFormat(debug, agentID, m_scene.RegionInfo.RegionName);
|
m_log.DebugFormat(debug, agentID, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
Hashtable responsedata = new Hashtable();
|
||||||
|
|
||||||
if (element == null) // didn't have an event in 15s
|
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!
|
// Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
|
||||||
element = EventQueueHelper.KeepAliveEvent();
|
element = EventQueueHelper.KeepAliveEvent();
|
||||||
|
|
||||||
ScenePresence avatar;
|
//ScenePresence avatar;
|
||||||
m_scene.TryGetAvatar(agentID, out avatar);
|
//m_scene.TryGetAvatar(agentID, out avatar);
|
||||||
|
|
||||||
LLSDArray array = new LLSDArray();
|
LLSDArray array = new LLSDArray();
|
||||||
array.Add(element);
|
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)
|
while (queue.Count() > 0)
|
||||||
{
|
{
|
||||||
array.Add(queue.Dequeue(1));
|
array.Add(queue.Dequeue(1));
|
||||||
|
@ -234,7 +260,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
|
||||||
{
|
{
|
||||||
m_ids[agentID] = thisID + 1;
|
m_ids[agentID] = thisID + 1;
|
||||||
}
|
}
|
||||||
Hashtable responsedata = new Hashtable();
|
responsedata = new Hashtable();
|
||||||
responsedata["int_response_code"] = 200;
|
responsedata["int_response_code"] = 200;
|
||||||
responsedata["content_type"] = "application/llsd+xml";
|
responsedata["content_type"] = "application/llsd+xml";
|
||||||
responsedata["keepalive"] = true;
|
responsedata["keepalive"] = true;
|
||||||
|
@ -264,7 +290,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
|
||||||
{
|
{
|
||||||
m_ids[agentID] = thisID + 1;
|
m_ids[agentID] = thisID + 1;
|
||||||
}
|
}
|
||||||
Hashtable responsedata = new Hashtable();
|
responsedata = new Hashtable();
|
||||||
responsedata["int_response_code"] = 200;
|
responsedata["int_response_code"] = 200;
|
||||||
responsedata["content_type"] = "application/llsd+xml";
|
responsedata["content_type"] = "application/llsd+xml";
|
||||||
responsedata["keepalive"] = true;
|
responsedata["keepalive"] = true;
|
||||||
|
@ -273,27 +299,6 @@ namespace OpenSim.Region.Environment.Modules.Framework
|
||||||
|
|
||||||
return responsedata;
|
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment
|
namespace OpenSim.Region.Environment
|
||||||
{
|
{
|
||||||
public class EventQueueHelper
|
public class EventQueueHelper
|
||||||
{
|
{
|
||||||
private EventQueueHelper() {} // no construction possible, it's an utility class
|
private EventQueueHelper() {} // no construction possible, it's an utility class
|
||||||
|
|
||||||
public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint)
|
public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint)
|
||||||
{
|
{
|
||||||
LLSDMap llsdSimInfo = new LLSDMap(3);
|
LLSDMap llsdSimInfo = new LLSDMap(3);
|
||||||
byte[] regionhandle = new byte[8];
|
byte[] regionhandle = new byte[8];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -49,24 +49,89 @@ namespace OpenSim.Region.Environment
|
||||||
regionhandle[i++] = (byte)((Handle >> 32) % 256);
|
regionhandle[i++] = (byte)((Handle >> 32) % 256);
|
||||||
regionhandle[i++] = (byte)((Handle >> 24) % 256);
|
regionhandle[i++] = (byte)((Handle >> 24) % 256);
|
||||||
regionhandle[i++] = (byte)((Handle >> 16) % 256);
|
regionhandle[i++] = (byte)((Handle >> 16) % 256);
|
||||||
regionhandle[i++] = (byte)((Handle >> 8) % 256);
|
regionhandle[i++] = (byte)((Handle >> 8) % 256);
|
||||||
regionhandle[i++] = (byte)(Handle % 256);
|
regionhandle[i++] = (byte)(Handle % 256);
|
||||||
|
|
||||||
llsdSimInfo.Add("Handle", new LLSDBinary(regionhandle));
|
llsdSimInfo.Add("Handle", new LLSDBinary(regionhandle));
|
||||||
llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes()));
|
llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes()));
|
||||||
llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port));
|
llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port));
|
||||||
|
|
||||||
LLSDArray arr = new LLSDArray(1);
|
LLSDArray arr = new LLSDArray(1);
|
||||||
arr.Add(llsdSimInfo);
|
arr.Add(llsdSimInfo);
|
||||||
|
|
||||||
LLSDMap llsdBody = new LLSDMap(1);
|
LLSDMap llsdBody = new LLSDMap(1);
|
||||||
llsdBody.Add("SimulatorInfo", arr);
|
llsdBody.Add("SimulatorInfo", arr);
|
||||||
|
|
||||||
LLSDMap llsdMessage = new LLSDMap(2);
|
LLSDMap llsdMessage = new LLSDMap(2);
|
||||||
llsdMessage.Add("message", new LLSDString("EnableSimulator"));
|
llsdMessage.Add("message", new LLSDString("EnableSimulator"));
|
||||||
llsdMessage.Add("body", llsdBody);
|
llsdMessage.Add("body", llsdBody);
|
||||||
|
|
||||||
return llsdMessage;
|
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()
|
public static LLSD KeepAliveEvent()
|
||||||
{
|
{
|
||||||
|
@ -76,6 +141,6 @@ namespace OpenSim.Region.Environment
|
||||||
llsdMessage.Add("body", llsdSimInfo);
|
llsdMessage.Add("body", llsdSimInfo);
|
||||||
|
|
||||||
return llsdMessage;
|
return llsdMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,9 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Types;
|
using OpenSim.Region.Environment.Types;
|
||||||
|
using OpenSim.Region.Interfaces;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
using LLSD = OpenMetaverse.StructuredData.LLSD;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Scenes
|
namespace OpenSim.Region.Environment.Scenes
|
||||||
|
@ -2018,8 +2020,22 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, m_uuid);
|
"[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);
|
capsPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MakeChildAgent();
|
MakeChildAgent();
|
||||||
// now we have a child agent in this region. Request all interesting data about other (root) agents
|
// now we have a child agent in this region. Request all interesting data about other (root) agents
|
||||||
SendInitialFullUpdateToAllClients();
|
SendInitialFullUpdateToAllClients();
|
||||||
|
|
Loading…
Reference in New Issue