aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-12-09 01:55:32 +0000
committerMelanie2010-12-09 01:55:32 +0000
commit4df1d25d23d76ee3ae8c7da155462b57735f6418 (patch)
tree3d03a3cf9fb54f6992b67a6e2b23d5ea8def084d /OpenSim
parentAdded an exception handler on CreateObject handler, just in case there's an e... (diff)
downloadopensim-SC_OLD-4df1d25d23d76ee3ae8c7da155462b57735f6418.zip
opensim-SC_OLD-4df1d25d23d76ee3ae8c7da155462b57735f6418.tar.gz
opensim-SC_OLD-4df1d25d23d76ee3ae8c7da155462b57735f6418.tar.bz2
opensim-SC_OLD-4df1d25d23d76ee3ae8c7da155462b57735f6418.tar.xz
Plumb a code path for the entity transfer module to ask a destination scene
whether or not an agent is allowed there as a root agent.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs17
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs11
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs26
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs59
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs2
6 files changed, 132 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index e32dbb3..37b403e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -257,6 +257,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
257 return false; 257 return false;
258 } 258 }
259 259
260 public bool QueryAccess(GridRegion destination, UUID id)
261 {
262 if (destination == null)
263 return false;
264
265 foreach (Scene s in m_sceneList)
266 {
267 if (s.RegionInfo.RegionHandle == destination.RegionHandle)
268 {
269 //m_log.Debug("[LOCAL COMMS]: Found region to send QueryAccess");
270 return s.QueryAccess(id);
271 }
272 }
273 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
274 return false;
275 }
276
260 public bool ReleaseAgent(UUID origin, UUID id, string uri) 277 public bool ReleaseAgent(UUID origin, UUID id, string uri)
261 { 278 {
262 foreach (Scene s in m_sceneList) 279 foreach (Scene s in m_sceneList)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 3f577f2..387a9b8 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -239,6 +239,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
239 239
240 } 240 }
241 241
242 public bool QueryAccess(GridRegion destination, UUID id)
243 {
244 if (destination == null)
245 return false;
246
247 // Try local first
248 if (m_localBackend.QueryAccess(destination, id))
249 return true;
250
251 // else do the remote thing
252 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
253 return m_remoteConnector.QueryAccess(destination, id);
254
255 return false;
256
257 }
258
242 public bool ReleaseAgent(UUID origin, UUID id, string uri) 259 public bool ReleaseAgent(UUID origin, UUID id, string uri)
243 { 260 {
244 // Try local first 261 // Try local first
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 6d72154..de75375 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4953,5 +4953,16 @@ namespace OpenSim.Region.Framework.Scenes
4953 DeleteSceneObject(grp, true); 4953 DeleteSceneObject(grp, true);
4954 } 4954 }
4955 } 4955 }
4956
4957 // This method is called across the simulation connector to
4958 // determine if a given agent is allowed in this region
4959 // AS A ROOT AGENT. Returning false here will prevent them
4960 // from logging into the region, teleporting into the region
4961 // or corssing the broder walking, but will NOT prevent
4962 // child agent creation, thereby emulating the SL behavior.
4963 public bool QueryAccess(UUID agentID)
4964 {
4965 return true;
4966 }
4956 } 4967 }
4957} 4968}
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 1f7e502..24ae81f 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -110,6 +110,11 @@ namespace OpenSim.Server.Handlers.Simulation
110 DoAgentDelete(request, responsedata, agentID, action, regionID); 110 DoAgentDelete(request, responsedata, agentID, action, regionID);
111 return responsedata; 111 return responsedata;
112 } 112 }
113 else if (method.Equals("QUERYACCESSS"))
114 {
115 DoQueryAccess(request, responsedata, agentID, regionID);
116 return responsedata;
117 }
113 else 118 else
114 { 119 {
115 m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method); 120 m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method);
@@ -300,6 +305,27 @@ namespace OpenSim.Server.Handlers.Simulation
300 return m_SimulationService.UpdateAgent(destination, agent); 305 return m_SimulationService.UpdateAgent(destination, agent);
301 } 306 }
302 307
308 protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
309 {
310 if (m_SimulationService == null)
311 {
312 m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless.");
313 responsedata["content_type"] = "application/json";
314 responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
315 responsedata["str_response_string"] = string.Empty;
316
317 return;
318 }
319
320 GridRegion destination = new GridRegion();
321 destination.RegionID = regionID;
322
323 bool result = m_SimulationService.QueryAccess(destination, id);
324
325 responsedata["int_response_code"] = HttpStatusCode.OK;
326 responsedata["str_response_string"] = result.ToString();
327 }
328
303 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) 329 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
304 { 330 {
305 if (m_SimulationService == null) 331 if (m_SimulationService == null)
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 3b907c1..e2032d9 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -409,6 +409,65 @@ namespace OpenSim.Services.Connectors.Simulation
409 return false; 409 return false;
410 } 410 }
411 411
412 public bool QueryAccess(GridRegion destination, UUID id)
413 {
414 IPEndPoint ext = destination.ExternalEndPoint;
415 if (ext == null) return false;
416 // Eventually, we want to use a caps url instead of the agentID
417 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
418
419 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
420 request.Method = "QUERYACCESS";
421 request.Timeout = 10000;
422 //request.Headers.Add("authorization", ""); // coming soon
423
424 HttpWebResponse webResponse = null;
425 string reply = string.Empty;
426 StreamReader sr = null;
427 try
428 {
429 webResponse = (HttpWebResponse)request.GetResponse();
430 if (webResponse == null)
431 {
432 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent query ");
433 }
434
435 sr = new StreamReader(webResponse.GetResponseStream());
436 reply = sr.ReadToEnd().Trim();
437
438
439 }
440 catch (WebException ex)
441 {
442 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent query {0}", ex.Message);
443 // ignore, really
444 return false;
445 }
446 finally
447 {
448 if (sr != null)
449 sr.Close();
450 }
451
452 if (webResponse.StatusCode == HttpStatusCode.OK)
453 {
454 try
455 {
456 bool result;
457
458 result = bool.Parse(reply);
459
460 return result;
461 }
462 catch
463 {
464 return false;
465 }
466 }
467
468 return false;
469 }
470
412 public bool ReleaseAgent(UUID origin, UUID id, string uri) 471 public bool ReleaseAgent(UUID origin, UUID id, string uri)
413 { 472 {
414 WebRequest request = WebRequest.Create(uri); 473 WebRequest request = WebRequest.Create(uri);
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 67d7cbe..12e8982 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -60,6 +60,8 @@ namespace OpenSim.Services.Interfaces
60 60
61 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); 61 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
62 62
63 bool QueryAccess(GridRegion destination, UUID id);
64
63 /// <summary> 65 /// <summary>
64 /// Message from receiving region to departing region, telling it got contacted by the client. 66 /// Message from receiving region to departing region, telling it got contacted by the client.
65 /// When sent over REST, it invokes the opaque uri. 67 /// When sent over REST, it invokes the opaque uri.