diff options
author | Teravus Ovares | 2008-09-28 02:57:53 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-09-28 02:57:53 +0000 |
commit | 25a998feb41057f5ad8a6190eae8f14426db1aa8 (patch) | |
tree | 83895af3727370c72873a726b3512a52953f719d /OpenSim/Region/Environment/Modules/Framework | |
parent | Mantis#2287. Thank you kindly, Idb for a patch that solves: (diff) | |
download | opensim-SC_OLD-25a998feb41057f5ad8a6190eae8f14426db1aa8.zip opensim-SC_OLD-25a998feb41057f5ad8a6190eae8f14426db1aa8.tar.gz opensim-SC_OLD-25a998feb41057f5ad8a6190eae8f14426db1aa8.tar.bz2 opensim-SC_OLD-25a998feb41057f5ad8a6190eae8f14426db1aa8.tar.xz |
* 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!
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs | 57 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs | 185 |
2 files changed, 156 insertions, 86 deletions
diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs index f77a7c0..95cdaed 100644 --- a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs +++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs | |||
@@ -68,6 +68,7 @@ namespace OpenSim.Region.Environment.Modules.Framework | |||
68 | private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); | 68 | private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); |
69 | 69 | ||
70 | private Dictionary<UUID, BlockingLLSDQueue> queues = new Dictionary<UUID, BlockingLLSDQueue>(); | 70 | private Dictionary<UUID, BlockingLLSDQueue> queues = new Dictionary<UUID, BlockingLLSDQueue>(); |
71 | |||
71 | 72 | ||
72 | #region IRegionModule methods | 73 | #region IRegionModule methods |
73 | public void Initialise(Scene scene, IConfigSource config) | 74 | public void Initialise(Scene scene, IConfigSource config) |
@@ -171,6 +172,14 @@ namespace OpenSim.Region.Environment.Modules.Framework | |||
171 | private void MakeChildAgent(ScenePresence avatar) | 172 | private void MakeChildAgent(ScenePresence avatar) |
172 | { | 173 | { |
173 | m_log.DebugFormat("[EVENTQUEUE]: Make Child agent {0}.", avatar.UUID); | 174 | m_log.DebugFormat("[EVENTQUEUE]: Make Child agent {0}.", avatar.UUID); |
175 | lock (m_ids) | ||
176 | { | ||
177 | if (m_ids.ContainsKey(avatar.UUID)) | ||
178 | { | ||
179 | // close the event queue. | ||
180 | m_ids[avatar.UUID] = -1; | ||
181 | } | ||
182 | } | ||
174 | } | 183 | } |
175 | 184 | ||
176 | public void OnRegisterCaps(UUID agentID, Caps caps) | 185 | public void OnRegisterCaps(UUID agentID, Caps caps) |
@@ -209,18 +218,35 @@ namespace OpenSim.Region.Environment.Modules.Framework | |||
209 | debug += key.ToString() + "=" + request[key].ToString() + " "; | 218 | debug += key.ToString() + "=" + request[key].ToString() + " "; |
210 | } | 219 | } |
211 | m_log.DebugFormat(debug, agentID, m_scene.RegionInfo.RegionName); | 220 | m_log.DebugFormat(debug, agentID, m_scene.RegionInfo.RegionName); |
221 | |||
222 | Hashtable responsedata = new Hashtable(); | ||
212 | 223 | ||
213 | if (element == null) // didn't have an event in 15s | 224 | if (element == null) // didn't have an event in 15s |
214 | { | 225 | { |
215 | // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! | 226 | // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! |
216 | element = EventQueueHelper.KeepAliveEvent(); | 227 | element = EventQueueHelper.KeepAliveEvent(); |
217 | 228 | ||
218 | ScenePresence avatar; | 229 | //ScenePresence avatar; |
219 | m_scene.TryGetAvatar(agentID, out avatar); | 230 | //m_scene.TryGetAvatar(agentID, out avatar); |
220 | 231 | ||
221 | LLSDArray array = new LLSDArray(); | 232 | LLSDArray array = new LLSDArray(); |
222 | array.Add(element); | 233 | array.Add(element); |
223 | int thisID = m_ids[agentID]; | 234 | int thisID = 0; |
235 | lock (m_ids) | ||
236 | thisID = m_ids[agentID]; | ||
237 | |||
238 | |||
239 | |||
240 | if (thisID == -1) | ||
241 | { | ||
242 | responsedata = new Hashtable(); | ||
243 | responsedata["int_response_code"] = 502; | ||
244 | responsedata["content_type"] = "text/plain"; | ||
245 | responsedata["keepalive"] = false; | ||
246 | responsedata["str_response_string"] = ""; | ||
247 | return responsedata; | ||
248 | } | ||
249 | |||
224 | while (queue.Count() > 0) | 250 | while (queue.Count() > 0) |
225 | { | 251 | { |
226 | array.Add(queue.Dequeue(1)); | 252 | array.Add(queue.Dequeue(1)); |
@@ -234,7 +260,7 @@ namespace OpenSim.Region.Environment.Modules.Framework | |||
234 | { | 260 | { |
235 | m_ids[agentID] = thisID + 1; | 261 | m_ids[agentID] = thisID + 1; |
236 | } | 262 | } |
237 | Hashtable responsedata = new Hashtable(); | 263 | responsedata = new Hashtable(); |
238 | responsedata["int_response_code"] = 200; | 264 | responsedata["int_response_code"] = 200; |
239 | responsedata["content_type"] = "application/llsd+xml"; | 265 | responsedata["content_type"] = "application/llsd+xml"; |
240 | responsedata["keepalive"] = true; | 266 | responsedata["keepalive"] = true; |
@@ -264,7 +290,7 @@ namespace OpenSim.Region.Environment.Modules.Framework | |||
264 | { | 290 | { |
265 | m_ids[agentID] = thisID + 1; | 291 | m_ids[agentID] = thisID + 1; |
266 | } | 292 | } |
267 | Hashtable responsedata = new Hashtable(); | 293 | responsedata = new Hashtable(); |
268 | responsedata["int_response_code"] = 200; | 294 | responsedata["int_response_code"] = 200; |
269 | responsedata["content_type"] = "application/llsd+xml"; | 295 | responsedata["content_type"] = "application/llsd+xml"; |
270 | responsedata["keepalive"] = true; | 296 | responsedata["keepalive"] = true; |
@@ -273,27 +299,6 @@ namespace OpenSim.Region.Environment.Modules.Framework | |||
273 | 299 | ||
274 | return responsedata; | 300 | return responsedata; |
275 | } | 301 | } |
276 | |||
277 | /* | ||
278 | responsedata["int_response_code"] = 200; | ||
279 | responsedata["content_type"] = "application/xml"; | ||
280 | responsedata["keepalive"] = true; | ||
281 | |||
282 | responsedata["str_response_string"] = @"<llsd><map><key>events</key><array><map><key>body</key><map><key>AgentData</key><map><key>AgentID</key> | ||
283 | <uuid>0fd0e798-a54f-40b1-0000-000000000000</uuid><key>SessionID</key><uuid>cc91f1fe-9d52-435d-0000-000000000000 | ||
284 | </uuid></map><key>Info</key><map><key>LookAt</key><array><real>0.9869639873504638671875</real><real> | ||
285 | -0.1609439998865127563476562</real><real>0</real></array><key>Position</key><array><real>1.43747997283935546875 | ||
286 | </real><real>95.30560302734375</real><real>57.3480987548828125</real></array></map><key>RegionData</key><map> | ||
287 | <key>RegionHandle</key><binary encoding=" + "\"base64\"" + @">AAPnAAAD8AA=</binary><key>SeedCapability</key><string> | ||
288 | https://sim7.aditi.lindenlab.com:12043/cap/64015fb3-6fee-9205-0000-000000000000</string><key>SimIP</key><binary | ||
289 | encoding=" + "\"base64\"" + @">yA8FSA==</binary><key>SimPort</key><integer>13005</integer></map></map><key>message</key> | ||
290 | <string>CrossedRegion</string></map></array><key>id</key><integer>1</integer></map></llsd>"; | ||
291 | |||
292 | */ | ||
293 | //string requestbody = (string)request["requestbody"]; | ||
294 | //LLSD llsdRequest = LLSDParser.DeserializeXml(request); | ||
295 | //System.Console.WriteLine(requestbody); | ||
296 | |||
297 | } | 302 | } |
298 | } | 303 | } |
299 | } | 304 | } |
diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs index 43f1782..cfa0a25 100644 --- a/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs +++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueHelper.cs | |||
@@ -1,44 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Net; | 29 | using System.Net; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenMetaverse.StructuredData; | 31 | using OpenMetaverse.StructuredData; |
32 | 32 | ||
33 | namespace OpenSim.Region.Environment | 33 | namespace OpenSim.Region.Environment |
34 | { | 34 | { |
35 | public class EventQueueHelper | 35 | public class EventQueueHelper |
36 | { | 36 | { |
37 | private EventQueueHelper() {} // no construction possible, it's an utility class | 37 | private EventQueueHelper() {} // no construction possible, it's an utility class |
38 | 38 | ||
39 | public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint) | 39 | public static LLSD EnableSimulator(ulong Handle, IPEndPoint endPoint) |
40 | { | 40 | { |
41 | LLSDMap llsdSimInfo = new LLSDMap(3); | 41 | LLSDMap llsdSimInfo = new LLSDMap(3); |
42 | byte[] regionhandle = new byte[8]; | 42 | byte[] regionhandle = new byte[8]; |
43 | int i = 0; | 43 | int i = 0; |
44 | 44 | ||
@@ -49,24 +49,89 @@ namespace OpenSim.Region.Environment | |||
49 | regionhandle[i++] = (byte)((Handle >> 32) % 256); | 49 | regionhandle[i++] = (byte)((Handle >> 32) % 256); |
50 | regionhandle[i++] = (byte)((Handle >> 24) % 256); | 50 | regionhandle[i++] = (byte)((Handle >> 24) % 256); |
51 | regionhandle[i++] = (byte)((Handle >> 16) % 256); | 51 | regionhandle[i++] = (byte)((Handle >> 16) % 256); |
52 | regionhandle[i++] = (byte)((Handle >> 8) % 256); | 52 | regionhandle[i++] = (byte)((Handle >> 8) % 256); |
53 | regionhandle[i++] = (byte)(Handle % 256); | 53 | regionhandle[i++] = (byte)(Handle % 256); |
54 | 54 | ||
55 | llsdSimInfo.Add("Handle", new LLSDBinary(regionhandle)); | 55 | llsdSimInfo.Add("Handle", new LLSDBinary(regionhandle)); |
56 | llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes())); | 56 | llsdSimInfo.Add("IP", new LLSDBinary(endPoint.Address.GetAddressBytes())); |
57 | llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port)); | 57 | llsdSimInfo.Add("Port", new LLSDInteger(endPoint.Port)); |
58 | 58 | ||
59 | LLSDArray arr = new LLSDArray(1); | 59 | LLSDArray arr = new LLSDArray(1); |
60 | arr.Add(llsdSimInfo); | 60 | arr.Add(llsdSimInfo); |
61 | 61 | ||
62 | LLSDMap llsdBody = new LLSDMap(1); | 62 | LLSDMap llsdBody = new LLSDMap(1); |
63 | llsdBody.Add("SimulatorInfo", arr); | 63 | llsdBody.Add("SimulatorInfo", arr); |
64 | 64 | ||
65 | LLSDMap llsdMessage = new LLSDMap(2); | 65 | LLSDMap llsdMessage = new LLSDMap(2); |
66 | llsdMessage.Add("message", new LLSDString("EnableSimulator")); | 66 | llsdMessage.Add("message", new LLSDString("EnableSimulator")); |
67 | llsdMessage.Add("body", llsdBody); | 67 | llsdMessage.Add("body", llsdBody); |
68 | 68 | ||
69 | return llsdMessage; | 69 | return llsdMessage; |
70 | } | ||
71 | public static LLSD CrossRegion(ulong Handle, Vector3 pos, Vector3 lookAt, | ||
72 | IPEndPoint newRegionExternalEndPoint, | ||
73 | string capsURL, UUID AgentID, UUID SessionID) | ||
74 | { | ||
75 | LLSDArray LookAtArr = new LLSDArray(3); | ||
76 | LookAtArr.Add(LLSD.FromReal(lookAt.X)); | ||
77 | LookAtArr.Add(LLSD.FromReal(lookAt.Y)); | ||
78 | LookAtArr.Add(LLSD.FromReal(lookAt.Z)); | ||
79 | |||
80 | LLSDArray PositionArr = new LLSDArray(3); | ||
81 | PositionArr.Add(LLSD.FromReal(pos.X)); | ||
82 | PositionArr.Add(LLSD.FromReal(pos.Y)); | ||
83 | PositionArr.Add(LLSD.FromReal(pos.Z)); | ||
84 | |||
85 | LLSDMap InfoMap = new LLSDMap(2); | ||
86 | InfoMap.Add("LookAt", LookAtArr); | ||
87 | InfoMap.Add("Position", PositionArr); | ||
88 | |||
89 | LLSDArray InfoArr = new LLSDArray(1); | ||
90 | InfoArr.Add(InfoMap); | ||
91 | |||
92 | LLSDMap AgentDataMap = new LLSDMap(2); | ||
93 | AgentDataMap.Add("AgentID", LLSD.FromUUID(AgentID)); | ||
94 | AgentDataMap.Add("SessionID", LLSD.FromUUID(SessionID)); | ||
95 | |||
96 | LLSDArray AgentDataArr = new LLSDArray(1); | ||
97 | AgentDataArr.Add(AgentDataMap); | ||
98 | |||
99 | LLSDMap RegionDataMap = new LLSDMap(4); | ||
100 | byte[] regionhandle = new byte[8]; | ||
101 | |||
102 | { | ||
103 | int i = 0; | ||
104 | regionhandle[i++] = (byte)((Handle >> 56) % 256); | ||
105 | regionhandle[i++] = (byte)((Handle >> 48) % 256); | ||
106 | regionhandle[i++] = (byte)((Handle >> 40) % 256); | ||
107 | regionhandle[i++] = (byte)((Handle >> 32) % 256); | ||
108 | regionhandle[i++] = (byte)((Handle >> 24) % 256); | ||
109 | regionhandle[i++] = (byte)((Handle >> 16) % 256); | ||
110 | regionhandle[i++] = (byte)((Handle >> 8) % 256); | ||
111 | regionhandle[i++] = (byte)(Handle % 256); | ||
112 | } | ||
113 | |||
114 | RegionDataMap.Add("RegionHandle", LLSD.FromBinary(regionhandle)); | ||
115 | RegionDataMap.Add("SeedCapability", LLSD.FromString(capsURL)); | ||
116 | RegionDataMap.Add("SimIP", LLSD.FromBinary(newRegionExternalEndPoint.Address.GetAddressBytes())); | ||
117 | RegionDataMap.Add("SimPort", LLSD.FromInteger(newRegionExternalEndPoint.Port)); | ||
118 | |||
119 | LLSDArray RegionDataArr = new LLSDArray(1); | ||
120 | RegionDataArr.Add(RegionDataMap); | ||
121 | |||
122 | |||
123 | |||
124 | |||
125 | LLSDMap llsdBody = new LLSDMap(3); | ||
126 | llsdBody.Add("Info", InfoArr); | ||
127 | llsdBody.Add("AgentData", AgentDataArr); | ||
128 | llsdBody.Add("RegionData", RegionDataArr); | ||
129 | |||
130 | LLSDMap llsdMessage = new LLSDMap(2); | ||
131 | llsdMessage.Add("message", new LLSDString("CrossedRegion")); | ||
132 | llsdMessage.Add("body", llsdBody); | ||
133 | |||
134 | return llsdMessage; | ||
70 | } | 135 | } |
71 | public static LLSD KeepAliveEvent() | 136 | public static LLSD KeepAliveEvent() |
72 | { | 137 | { |
@@ -76,6 +141,6 @@ namespace OpenSim.Region.Environment | |||
76 | llsdMessage.Add("body", llsdSimInfo); | 141 | llsdMessage.Add("body", llsdSimInfo); |
77 | 142 | ||
78 | return llsdMessage; | 143 | return llsdMessage; |
79 | } | 144 | } |
80 | } | 145 | } |
81 | } | 146 | } |