diff options
author | John Hurliman | 2009-09-30 15:28:23 -0700 |
---|---|---|
committer | John Hurliman | 2009-09-30 15:28:23 -0700 |
commit | acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009 (patch) | |
tree | 305349e1bd0a5849fd7f96483e24d5e07b24b8f4 /OpenSim/Region/CoreModules/Framework | |
parent | * Adding Scale to EntityBase * Fixing the incorrect initialization of EntityB... (diff) | |
parent | Formatting cleanup. (diff) | |
download | opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.zip opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.tar.gz opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.tar.bz2 opensim-SC_OLD-acfe2d9f4e5a55d38b16cac7d0d0a25b64b6b009.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs | 208 |
2 files changed, 11 insertions, 214 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs index 34d46a0..1b23d92 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs | |||
@@ -316,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
316 | 316 | ||
317 | // This will persist this beyond the expiry of the caps handlers | 317 | // This will persist this beyond the expiry of the caps handlers |
318 | MainServer.Instance.AddPollServiceHTTPHandler( | 318 | MainServer.Instance.AddPollServiceHTTPHandler( |
319 | capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePath2, new PollServiceEventArgs(HasEvents, GetEvents, NoEvents, agentID)); | 319 | capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePoll, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); |
320 | 320 | ||
321 | Random rnd = new Random(Environment.TickCount); | 321 | Random rnd = new Random(Environment.TickCount); |
322 | lock (m_ids) | 322 | lock (m_ids) |
@@ -326,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | public bool HasEvents(UUID agentID) | 329 | public bool HasEvents(UUID requestID, UUID agentID) |
330 | { | 330 | { |
331 | // Don't use this, because of race conditions at agent closing time | 331 | // Don't use this, because of race conditions at agent closing time |
332 | //Queue<OSD> queue = TryGetQueue(agentID); | 332 | //Queue<OSD> queue = TryGetQueue(agentID); |
@@ -343,14 +343,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
343 | return false; | 343 | return false; |
344 | } | 344 | } |
345 | 345 | ||
346 | public Hashtable GetEvents(UUID pAgentId, string request) | 346 | public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request) |
347 | { | 347 | { |
348 | Queue<OSD> queue = TryGetQueue(pAgentId); | 348 | Queue<OSD> queue = TryGetQueue(pAgentId); |
349 | OSD element; | 349 | OSD element; |
350 | lock (queue) | 350 | lock (queue) |
351 | { | 351 | { |
352 | if (queue.Count == 0) | 352 | if (queue.Count == 0) |
353 | return NoEvents(); | 353 | return NoEvents(requestID, pAgentId); |
354 | element = queue.Dequeue(); // 15s timeout | 354 | element = queue.Dequeue(); // 15s timeout |
355 | } | 355 | } |
356 | 356 | ||
@@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
398 | //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]); | 398 | //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]); |
399 | } | 399 | } |
400 | 400 | ||
401 | public Hashtable NoEvents() | 401 | public Hashtable NoEvents(UUID requestID, UUID agentID) |
402 | { | 402 | { |
403 | Hashtable responsedata = new Hashtable(); | 403 | Hashtable responsedata = new Hashtable(); |
404 | responsedata["int_response_code"] = 502; | 404 | responsedata["int_response_code"] = 502; |
@@ -454,7 +454,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
454 | responsedata["error_status_text"] = "Upstream error:"; | 454 | responsedata["error_status_text"] = "Upstream error:"; |
455 | responsedata["http_protocol_version"] = "HTTP/1.0"; | 455 | responsedata["http_protocol_version"] = "HTTP/1.0"; |
456 | return responsedata; | 456 | return responsedata; |
457 | } | 457 | } |
458 | 458 | ||
459 | OSDArray array = new OSDArray(); | 459 | OSDArray array = new OSDArray(); |
460 | if (element == null) // didn't have an event in 15s | 460 | if (element == null) // didn't have an event in 15s |
@@ -491,6 +491,11 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue | |||
491 | return responsedata; | 491 | return responsedata; |
492 | } | 492 | } |
493 | 493 | ||
494 | public Hashtable EventQueuePoll(Hashtable request) | ||
495 | { | ||
496 | return new Hashtable(); | ||
497 | } | ||
498 | |||
494 | public Hashtable EventQueuePath2(Hashtable request) | 499 | public Hashtable EventQueuePath2(Hashtable request) |
495 | { | 500 | { |
496 | string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/",""); | 501 | string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/",""); |
diff --git a/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs b/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs deleted file mode 100644 index 8c92727..0000000 --- a/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs +++ /dev/null | |||
@@ -1,208 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using log4net; | ||
34 | using Nini.Config; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Data; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Communications; | ||
39 | using OpenSim.Framework.Communications.Cache; | ||
40 | using OpenSim.Framework.Servers.HttpServer; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | |||
44 | using Nwc.XmlRpc; | ||
45 | |||
46 | |||
47 | namespace OpenSim.Region.CoreModules.Framework.Services | ||
48 | { | ||
49 | public class RegionMapService : IRegionModule | ||
50 | { | ||
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | private static bool initialized = false; | ||
53 | private static bool enabled = false; | ||
54 | |||
55 | Scene m_scene; | ||
56 | //AssetService m_assetService; | ||
57 | |||
58 | #region IRegionModule interface | ||
59 | |||
60 | public void Initialise(Scene scene, IConfigSource config) | ||
61 | { | ||
62 | if (!initialized) | ||
63 | { | ||
64 | initialized = true; | ||
65 | m_scene = scene; | ||
66 | |||
67 | // This module is only on for hypergrid mode | ||
68 | enabled = config.Configs["Startup"].GetBoolean("hypergrid", false); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | public void PostInitialise() | ||
73 | { | ||
74 | if (enabled) | ||
75 | { | ||
76 | m_log.Info("[RegionMapService]: Starting..."); | ||
77 | |||
78 | //m_assetService = new AssetService(m_scene); | ||
79 | new GridService(m_scene); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | public void Close() | ||
84 | { | ||
85 | } | ||
86 | |||
87 | public string Name | ||
88 | { | ||
89 | get { return "RegionMapService"; } | ||
90 | } | ||
91 | |||
92 | public bool IsSharedModule | ||
93 | { | ||
94 | get { return true; } | ||
95 | } | ||
96 | |||
97 | #endregion | ||
98 | |||
99 | } | ||
100 | |||
101 | public class GridService | ||
102 | { | ||
103 | // private IUserService m_userService; | ||
104 | private IGridServices m_gridService; | ||
105 | private bool m_doLookup = false; | ||
106 | |||
107 | public bool DoLookup | ||
108 | { | ||
109 | get { return m_doLookup; } | ||
110 | set { m_doLookup = value; } | ||
111 | } | ||
112 | private static readonly ILog m_log | ||
113 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
114 | |||
115 | public GridService(Scene m_scene) | ||
116 | { | ||
117 | AddHandlers(m_scene); | ||
118 | // m_userService = m_scene.CommsManager.UserService; | ||
119 | m_gridService = m_scene.CommsManager.GridService; | ||
120 | } | ||
121 | |||
122 | protected void AddHandlers(Scene m_scene) | ||
123 | { | ||
124 | // IAssetDataPlugin m_assetProvider | ||
125 | // = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; | ||
126 | |||
127 | IHttpServer httpServer = MainServer.Instance; | ||
128 | httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod); | ||
129 | //m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod); | ||
130 | //m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod); | ||
131 | |||
132 | } | ||
133 | |||
134 | /// <summary> | ||
135 | /// Returns an XML RPC response to a simulator profile request | ||
136 | /// </summary> | ||
137 | /// <param name="request"></param> | ||
138 | /// <returns></returns> | ||
139 | public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request, IPEndPoint remoteClient) | ||
140 | { | ||
141 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
142 | Hashtable responseData = new Hashtable(); | ||
143 | RegionInfo simData = null; | ||
144 | if (requestData.ContainsKey("region_UUID")) | ||
145 | { | ||
146 | UUID regionID = new UUID((string)requestData["region_UUID"]); | ||
147 | simData = m_gridService.RequestNeighbourInfo(regionID); //.GetRegion(regionID); | ||
148 | if (simData == null) | ||
149 | { | ||
150 | m_log.WarnFormat("[HGGridService] didn't find region for regionID {0} from {1}", | ||
151 | regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); | ||
152 | } | ||
153 | } | ||
154 | else if (requestData.ContainsKey("region_handle")) | ||
155 | { | ||
156 | //CFK: The if/else below this makes this message redundant. | ||
157 | //CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]); | ||
158 | ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]); | ||
159 | simData = m_gridService.RequestNeighbourInfo(regionHandle); //m_gridDBService.GetRegion(regionHandle); | ||
160 | if (simData == null) | ||
161 | { | ||
162 | m_log.WarnFormat("[HGGridService] didn't find region for regionHandle {0} from {1}", | ||
163 | regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); | ||
164 | } | ||
165 | } | ||
166 | else if (requestData.ContainsKey("region_name_search")) | ||
167 | { | ||
168 | string regionName = (string)requestData["region_name_search"]; | ||
169 | List<RegionInfo> regInfos = m_gridService.RequestNamedRegions(regionName, 1);//m_gridDBService.GetRegion(regionName); | ||
170 | if (regInfos != null) | ||
171 | simData = regInfos[0]; | ||
172 | |||
173 | if (simData == null) | ||
174 | { | ||
175 | m_log.WarnFormat("[HGGridService] didn't find region for regionName {0} from {1}", | ||
176 | regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); | ||
177 | } | ||
178 | } | ||
179 | else m_log.Warn("[HGGridService] regionlookup without regionID, regionHandle or regionHame"); | ||
180 | |||
181 | if (simData == null) | ||
182 | { | ||
183 | //Sim does not exist | ||
184 | responseData["error"] = "Sim does not exist"; | ||
185 | } | ||
186 | else | ||
187 | { | ||
188 | m_log.Debug("[HGGridService]: found " + (string)simData.RegionName + " regionHandle = " + | ||
189 | (string)requestData["region_handle"]); | ||
190 | responseData["sim_ip"] = simData.ExternalEndPoint.Address.ToString(); | ||
191 | responseData["sim_port"] = simData.ExternalEndPoint.Port.ToString(); | ||
192 | //responseData["server_uri"] = simData.serverURI; | ||
193 | responseData["http_port"] = simData.HttpPort.ToString(); | ||
194 | //responseData["remoting_port"] = simData.remotingPort.ToString(); | ||
195 | responseData["region_locx"] = simData.RegionLocX.ToString(); | ||
196 | responseData["region_locy"] = simData.RegionLocY.ToString(); | ||
197 | responseData["region_UUID"] = simData.RegionID.ToString(); | ||
198 | responseData["region_name"] = simData.RegionName; | ||
199 | responseData["region_secret"] = simData.regionSecret; | ||
200 | } | ||
201 | |||
202 | XmlRpcResponse response = new XmlRpcResponse(); | ||
203 | response.Value = responseData; | ||
204 | return response; | ||
205 | } | ||
206 | |||
207 | } | ||
208 | } | ||