From a8901a40f4526720f68049706cabd34cf9717172 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 31 Dec 2009 09:25:16 -0800 Subject: Simulation handlers (agents & objects) completed. --- .../Server/Handlers/Simulation/AgentHandlers.cs | 244 ++++++++++++++++++++- 1 file changed, 243 insertions(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 3da72c7..4966f66 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections; using System.IO; using System.Reflection; using System.Net; @@ -45,6 +46,247 @@ using log4net; namespace OpenSim.Server.Handlers.Simulation { + public class AgentHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private ISimulationService m_SimulationService; + + public AgentHandler(ISimulationService sim) + { + m_SimulationService = sim; + } + + public Hashtable Handler(Hashtable request) + { + //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); + + m_log.Debug("---------------------------"); + m_log.Debug(" >> uri=" + request["uri"]); + m_log.Debug(" >> content-type=" + request["content-type"]); + m_log.Debug(" >> http-method=" + request["http-method"]); + m_log.Debug("---------------------------\n"); + + Hashtable responsedata = new Hashtable(); + responsedata["content_type"] = "text/html"; + responsedata["keepalive"] = false; + + + UUID agentID; + string action; + ulong regionHandle; + if (!Utils.GetParams((string)request["uri"], out agentID, out regionHandle, out action)) + { + m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", request["uri"]); + responsedata["int_response_code"] = 404; + responsedata["str_response_string"] = "false"; + + return responsedata; + } + + // Next, let's parse the verb + string method = (string)request["http-method"]; + if (method.Equals("PUT")) + { + DoAgentPut(request, responsedata); + return responsedata; + } + else if (method.Equals("POST")) + { + DoAgentPost(request, responsedata, agentID); + return responsedata; + } + else if (method.Equals("GET")) + { + DoAgentGet(request, responsedata, agentID, regionHandle); + return responsedata; + } + else if (method.Equals("DELETE")) + { + DoAgentDelete(request, responsedata, agentID, action, regionHandle); + return responsedata; + } + else + { + m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method); + responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed; + responsedata["str_response_string"] = "Method not allowed"; + + return responsedata; + } + + } + + protected virtual void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) + { + OSDMap args = Utils.GetOSDMap((string)request["body"]); + if (args == null) + { + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + // retrieve the regionhandle + ulong regionhandle = 0; + if (args["destination_handle"] != null) + UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); + + AgentCircuitData aCircuit = new AgentCircuitData(); + try + { + aCircuit.UnpackAgentCircuitData(args); + } + catch (Exception ex) + { + m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message); + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + OSDMap resp = new OSDMap(2); + string reason = String.Empty; + uint teleportFlags = 0; + if (args.ContainsKey("teleport_flags")) + { + teleportFlags = args["teleport_flags"].AsUInteger(); + } + + // This is the meaning of POST agent + //m_regionClient.AdjustUserInformation(aCircuit); + bool result = m_SimulationService.CreateAgent(regionhandle, aCircuit, teleportFlags, out reason); + + resp["reason"] = OSD.FromString(reason); + resp["success"] = OSD.FromBoolean(result); + + // TODO: add reason if not String.Empty? + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); + } + + protected virtual void DoAgentPut(Hashtable request, Hashtable responsedata) + { + OSDMap args = Utils.GetOSDMap((string)request["body"]); + if (args == null) + { + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + // retrieve the regionhandle + ulong regionhandle = 0; + if (args["destination_handle"] != null) + UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); + + string messageType; + if (args["message_type"] != null) + messageType = args["message_type"].AsString(); + else + { + m_log.Warn("[AGENT HANDLER]: Agent Put Message Type not found. "); + messageType = "AgentData"; + } + + bool result = true; + if ("AgentData".Equals(messageType)) + { + AgentData agent = new AgentData(); + try + { + agent.Unpack(args); + } + catch (Exception ex) + { + m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); + responsedata["int_response_code"] = HttpStatusCode.BadRequest; + responsedata["str_response_string"] = "Bad request"; + return; + } + + //agent.Dump(); + // This is one of the meanings of PUT agent + result = m_SimulationService.UpdateAgent(regionhandle, agent); + + } + else if ("AgentPosition".Equals(messageType)) + { + AgentPosition agent = new AgentPosition(); + try + { + agent.Unpack(args); + } + catch (Exception ex) + { + m_log.InfoFormat("[AGENT HANDLER]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); + return; + } + //agent.Dump(); + // This is one of the meanings of PUT agent + result = m_SimulationService.UpdateAgent(regionhandle, agent); + + } + + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = result.ToString(); + //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead + } + + protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, ulong regionHandle) + { + IAgentData agent = null; + bool result = m_SimulationService.RetrieveAgent(regionHandle, id, out agent); + OSDMap map = null; + if (result) + { + if (agent != null) // just to make sure + { + map = agent.Pack(); + string strBuffer = ""; + try + { + strBuffer = OSDParser.SerializeJsonString(map); + } + catch (Exception e) + { + m_log.WarnFormat("[AGENT HANDLER]: Exception thrown on serialization of DoAgentGet: {0}", e.Message); + responsedata["int_response_code"] = HttpStatusCode.InternalServerError; + // ignore. buffer will be empty, caller should check. + } + + responsedata["content_type"] = "application/json"; + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = strBuffer; + } + else + { + responsedata["int_response_code"] = HttpStatusCode.InternalServerError; + responsedata["str_response_string"] = "Internal error"; + } + } + else + { + responsedata["int_response_code"] = HttpStatusCode.NotFound; + responsedata["str_response_string"] = "Not Found"; + } + } + + protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, ulong regionHandle) + { + //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle); + + if (action.Equals("release")) + m_SimulationService.ReleaseAgent(regionHandle, id, ""); + else + m_SimulationService.CloseAgent(regionHandle, id); + + responsedata["int_response_code"] = HttpStatusCode.OK; + responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); + + m_log.Debug("[AGENT HANDLER]: Agent Deleted."); + } + } + public class AgentGetHandler : BaseStreamHandler { // TODO: unused: private ISimulationService m_SimulationService; @@ -153,7 +395,7 @@ namespace OpenSim.Server.Handlers.Simulation // m_regionClient.AdjustUserInformation(aCircuit); // Finally! - bool success = m_SimulationService.CreateAgent(regionhandle, aCircuit, out reason); + bool success = m_SimulationService.CreateAgent(regionhandle, aCircuit, /*!!!*/0, out reason); OSDMap resp = new OSDMap(1); -- cgit v1.1 From c268e342d19b6cc5969b1c1d94f20a3f4eb844ef Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 3 Jan 2010 09:35:12 -0800 Subject: * Changed ISimulation interface to take a GridRegion as input arg instead of a regionHandle. * Added the RemoteSimulationConnectorModule, which is the replacement for RESTComms. Scenes is not using this yet, only (standalone) Login uses these region modules for now. * Completed SimulationServiceConnector and corresponding handlers. --- .../Server/Handlers/Simulation/AgentHandlers.cs | 244 +++++---------------- 1 file changed, 58 insertions(+), 186 deletions(-) (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 4966f66..f4f3eea 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -35,6 +35,7 @@ using System.Text; using OpenSim.Server.Base; using OpenSim.Server.Handlers.Base; using OpenSim.Services.Interfaces; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; @@ -72,9 +73,9 @@ namespace OpenSim.Server.Handlers.Simulation UUID agentID; + UUID regionID; string action; - ulong regionHandle; - if (!Utils.GetParams((string)request["uri"], out agentID, out regionHandle, out action)) + if (!Utils.GetParams((string)request["uri"], out agentID, out regionID, out action)) { m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", request["uri"]); responsedata["int_response_code"] = 404; @@ -97,12 +98,12 @@ namespace OpenSim.Server.Handlers.Simulation } else if (method.Equals("GET")) { - DoAgentGet(request, responsedata, agentID, regionHandle); + DoAgentGet(request, responsedata, agentID, regionID); return responsedata; } else if (method.Equals("DELETE")) { - DoAgentDelete(request, responsedata, agentID, action, regionHandle); + DoAgentDelete(request, responsedata, agentID, action, regionID); return responsedata; } else @@ -126,10 +127,27 @@ namespace OpenSim.Server.Handlers.Simulation return; } - // retrieve the regionhandle - ulong regionhandle = 0; - if (args["destination_handle"] != null) - UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); + // retrieve the input arguments + int x = 0, y = 0; + UUID uuid = UUID.Zero; + string regionname = string.Empty; + uint teleportFlags = 0; + if (args.ContainsKey("destination_x") && args["destination_x"] != null) + Int32.TryParse(args["destination_x"].AsString(), out x); + if (args.ContainsKey("destination_y") && args["destination_y"] != null) + Int32.TryParse(args["destination_y"].AsString(), out y); + if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) + UUID.TryParse(args["destination_uuid"].AsString(), out uuid); + if (args.ContainsKey("destination_name") && args["destination_name"] != null) + regionname = args["destination_name"].ToString(); + if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) + teleportFlags = args["teleport_flags"].AsUInteger(); + + GridRegion destination = new GridRegion(); + destination.RegionID = uuid; + destination.RegionLocX = x; + destination.RegionLocY = y; + destination.RegionName = regionname; AgentCircuitData aCircuit = new AgentCircuitData(); try @@ -146,15 +164,10 @@ namespace OpenSim.Server.Handlers.Simulation OSDMap resp = new OSDMap(2); string reason = String.Empty; - uint teleportFlags = 0; - if (args.ContainsKey("teleport_flags")) - { - teleportFlags = args["teleport_flags"].AsUInteger(); - } // This is the meaning of POST agent //m_regionClient.AdjustUserInformation(aCircuit); - bool result = m_SimulationService.CreateAgent(regionhandle, aCircuit, teleportFlags, out reason); + bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); @@ -174,10 +187,24 @@ namespace OpenSim.Server.Handlers.Simulation return; } - // retrieve the regionhandle - ulong regionhandle = 0; - if (args["destination_handle"] != null) - UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); + // retrieve the input arguments + int x = 0, y = 0; + UUID uuid = UUID.Zero; + string regionname = string.Empty; + if (args.ContainsKey("destination_x") && args["destination_x"] != null) + Int32.TryParse(args["destination_x"].AsString(), out x); + if (args.ContainsKey("destination_y") && args["destination_y"] != null) + Int32.TryParse(args["destination_y"].AsString(), out y); + if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) + UUID.TryParse(args["destination_uuid"].AsString(), out uuid); + if (args.ContainsKey("destination_name") && args["destination_name"] != null) + regionname = args["destination_name"].ToString(); + + GridRegion destination = new GridRegion(); + destination.RegionID = uuid; + destination.RegionLocX = x; + destination.RegionLocY = y; + destination.RegionName = regionname; string messageType; if (args["message_type"] != null) @@ -206,7 +233,7 @@ namespace OpenSim.Server.Handlers.Simulation //agent.Dump(); // This is one of the meanings of PUT agent - result = m_SimulationService.UpdateAgent(regionhandle, agent); + result = m_SimulationService.UpdateAgent(destination, agent); } else if ("AgentPosition".Equals(messageType)) @@ -223,7 +250,7 @@ namespace OpenSim.Server.Handlers.Simulation } //agent.Dump(); // This is one of the meanings of PUT agent - result = m_SimulationService.UpdateAgent(regionhandle, agent); + result = m_SimulationService.UpdateAgent(destination, agent); } @@ -232,10 +259,13 @@ namespace OpenSim.Server.Handlers.Simulation //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead } - protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, ulong regionHandle) + protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) { + GridRegion destination = new GridRegion(); + destination.RegionID = regionID; + IAgentData agent = null; - bool result = m_SimulationService.RetrieveAgent(regionHandle, id, out agent); + bool result = m_SimulationService.RetrieveAgent(destination, id, out agent); OSDMap map = null; if (result) { @@ -271,14 +301,17 @@ namespace OpenSim.Server.Handlers.Simulation } } - protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, ulong regionHandle) + protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) { //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle); + GridRegion destination = new GridRegion(); + destination.RegionID = regionID; + if (action.Equals("release")) - m_SimulationService.ReleaseAgent(regionHandle, id, ""); + m_SimulationService.ReleaseAgent(destination, id, ""); else - m_SimulationService.CloseAgent(regionHandle, id); + m_SimulationService.CloseAgent(destination, id); responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); @@ -287,165 +320,4 @@ namespace OpenSim.Server.Handlers.Simulation } } - public class AgentGetHandler : BaseStreamHandler - { - // TODO: unused: private ISimulationService m_SimulationService; - // TODO: unused: private IAuthenticationService m_AuthenticationService; - - public AgentGetHandler(ISimulationService service, IAuthenticationService authentication) : - base("GET", "/agent") - { - // TODO: unused: m_SimulationService = service; - // TODO: unused: m_AuthenticationService = authentication; - } - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - // Not implemented yet - httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; - return new byte[] { }; - } - } - - public class AgentPostHandler : BaseStreamHandler - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private ISimulationService m_SimulationService; - private IAuthenticationService m_AuthenticationService; - // TODO: unused: private bool m_AllowForeignGuests; - - public AgentPostHandler(ISimulationService service, IAuthenticationService authentication, bool foreignGuests) : - base("POST", "/agent") - { - m_SimulationService = service; - m_AuthenticationService = authentication; - // TODO: unused: m_AllowForeignGuests = foreignGuests; - } - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - byte[] result = new byte[0]; - - UUID agentID; - string action; - ulong regionHandle; - if (!RestHandlerUtils.GetParams(path, out agentID, out regionHandle, out action)) - { - m_log.InfoFormat("[AgentPostHandler]: Invalid parameters for agent message {0}", path); - httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; - httpResponse.StatusDescription = "Invalid parameters for agent message " + path; - - return result; - } - - if (m_AuthenticationService != null) - { - // Authentication - string authority = string.Empty; - string authToken = string.Empty; - if (!RestHandlerUtils.GetAuthentication(httpRequest, out authority, out authToken)) - { - m_log.InfoFormat("[AgentPostHandler]: Authentication failed for agent message {0}", path); - httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized; - return result; - } - // TODO: Rethink this - //if (!m_AuthenticationService.VerifyKey(agentID, authToken)) - //{ - // m_log.InfoFormat("[AgentPostHandler]: Authentication failed for agent message {0}", path); - // httpResponse.StatusCode = (int)HttpStatusCode.Forbidden; - // return result; - //} - m_log.DebugFormat("[AgentPostHandler]: Authentication succeeded for {0}", agentID); - } - - OSDMap args = Util.GetOSDMap(request, (int)httpRequest.ContentLength); - if (args == null) - { - httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; - httpResponse.StatusDescription = "Unable to retrieve data"; - m_log.DebugFormat("[AgentPostHandler]: Unable to retrieve data for post {0}", path); - return result; - } - - // retrieve the regionhandle - ulong regionhandle = 0; - if (args["destination_handle"] != null) - UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); - - AgentCircuitData aCircuit = new AgentCircuitData(); - try - { - aCircuit.UnpackAgentCircuitData(args); - } - catch (Exception ex) - { - m_log.InfoFormat("[AgentPostHandler]: exception on unpacking CreateAgent message {0}", ex.Message); - httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; - httpResponse.StatusDescription = "Problems with data deserialization"; - return result; - } - - string reason = string.Empty; - - // We need to clean up a few things in the user service before I can do this - //if (m_AllowForeignGuests) - // m_regionClient.AdjustUserInformation(aCircuit); - - // Finally! - bool success = m_SimulationService.CreateAgent(regionhandle, aCircuit, /*!!!*/0, out reason); - - OSDMap resp = new OSDMap(1); - - resp["success"] = OSD.FromBoolean(success); - - httpResponse.StatusCode = (int)HttpStatusCode.OK; - - return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(resp)); - } - } - - public class AgentPutHandler : BaseStreamHandler - { - // TODO: unused: private ISimulationService m_SimulationService; - // TODO: unused: private IAuthenticationService m_AuthenticationService; - - public AgentPutHandler(ISimulationService service, IAuthenticationService authentication) : - base("PUT", "/agent") - { - // TODO: unused: m_SimulationService = service; - // TODO: unused: m_AuthenticationService = authentication; - } - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - // Not implemented yet - httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; - return new byte[] { }; - } - } - - public class AgentDeleteHandler : BaseStreamHandler - { - // TODO: unused: private ISimulationService m_SimulationService; - // TODO: unused: private IAuthenticationService m_AuthenticationService; - - public AgentDeleteHandler(ISimulationService service, IAuthenticationService authentication) : - base("DELETE", "/agent") - { - // TODO: unused: m_SimulationService = service; - // TODO: unused: m_AuthenticationService = authentication; - } - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - // Not implemented yet - httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; - return new byte[] { }; - } - } } -- cgit v1.1 From 99efa99585639c94fdb484681663ac7b6f03538e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 3 Jan 2010 11:44:57 -0800 Subject: Successfully logged into a grid. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index f4f3eea..ccb4c70 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -134,8 +134,12 @@ namespace OpenSim.Server.Handlers.Simulation uint teleportFlags = 0; if (args.ContainsKey("destination_x") && args["destination_x"] != null) Int32.TryParse(args["destination_x"].AsString(), out x); + else + m_log.WarnFormat(" -- request didn't have destination_x"); if (args.ContainsKey("destination_y") && args["destination_y"] != null) Int32.TryParse(args["destination_y"].AsString(), out y); + else + m_log.WarnFormat(" -- request didn't have destination_y"); if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) UUID.TryParse(args["destination_uuid"].AsString(), out uuid); if (args.ContainsKey("destination_name") && args["destination_name"] != null) -- cgit v1.1 From f11a97f12d328af8bb39b92fec5cb5780983b66a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 7 Jan 2010 15:53:55 -0800 Subject: * Finished SimulationServiceConnector * Started rerouting calls to UserService. * Compiles. May run. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index ccb4c70..782034b 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -313,7 +313,7 @@ namespace OpenSim.Server.Handlers.Simulation destination.RegionID = regionID; if (action.Equals("release")) - m_SimulationService.ReleaseAgent(destination, id, ""); + m_SimulationService.ReleaseAgent(regionID, id, ""); else m_SimulationService.CloseAgent(destination, id); -- cgit v1.1 From 7356860b487febd12c2e0de2f009a6df9ea0aeec Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 13 Jan 2010 09:17:30 -0800 Subject: Several more buglets removed. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 782034b..da9c015 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -61,11 +61,11 @@ namespace OpenSim.Server.Handlers.Simulation { //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); - m_log.Debug("---------------------------"); - m_log.Debug(" >> uri=" + request["uri"]); - m_log.Debug(" >> content-type=" + request["content-type"]); - m_log.Debug(" >> http-method=" + request["http-method"]); - m_log.Debug("---------------------------\n"); + //m_log.Debug("---------------------------"); + //m_log.Debug(" >> uri=" + request["uri"]); + //m_log.Debug(" >> content-type=" + request["content-type"]); + //m_log.Debug(" >> http-method=" + request["http-method"]); + //m_log.Debug("---------------------------\n"); Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; @@ -320,7 +320,7 @@ namespace OpenSim.Server.Handlers.Simulation responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); - m_log.Debug("[AGENT HANDLER]: Agent Deleted."); + m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted."); } } -- cgit v1.1 From e90a5895ada61aab7fc27ab6f67b13a20676e07b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 13 Jan 2010 21:32:48 -0800 Subject: Bug fix in releasing agent. In Scene, always use SimulatonService, and not m_SimulationService, because it may be null... --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index da9c015..0c098d9 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -59,13 +59,13 @@ namespace OpenSim.Server.Handlers.Simulation public Hashtable Handler(Hashtable request) { - //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); + m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); - //m_log.Debug("---------------------------"); - //m_log.Debug(" >> uri=" + request["uri"]); - //m_log.Debug(" >> content-type=" + request["content-type"]); - //m_log.Debug(" >> http-method=" + request["http-method"]); - //m_log.Debug("---------------------------\n"); + m_log.Debug("---------------------------"); + m_log.Debug(" >> uri=" + request["uri"]); + m_log.Debug(" >> content-type=" + request["content-type"]); + m_log.Debug(" >> http-method=" + request["http-method"]); + m_log.Debug("---------------------------\n"); Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; @@ -307,7 +307,7 @@ namespace OpenSim.Server.Handlers.Simulation protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) { - //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle); + m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); GridRegion destination = new GridRegion(); destination.RegionID = regionID; -- cgit v1.1 From 369e57beee4464c8d54c8982da535d747f3ad338 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 13 Jan 2010 21:34:29 -0800 Subject: Take the verbose debug messages in AgentHandler out again. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 0c098d9..45e88ce 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -59,13 +59,13 @@ namespace OpenSim.Server.Handlers.Simulation public Hashtable Handler(Hashtable request) { - m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); + //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); - m_log.Debug("---------------------------"); - m_log.Debug(" >> uri=" + request["uri"]); - m_log.Debug(" >> content-type=" + request["content-type"]); - m_log.Debug(" >> http-method=" + request["http-method"]); - m_log.Debug("---------------------------\n"); + //m_log.Debug("---------------------------"); + //m_log.Debug(" >> uri=" + request["uri"]); + //m_log.Debug(" >> content-type=" + request["content-type"]); + //m_log.Debug(" >> http-method=" + request["http-method"]); + //m_log.Debug("---------------------------\n"); Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; -- cgit v1.1 From f276ba57bf5bd732fbc6a255213c9bb7f5f5f148 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 17 Jan 2010 11:33:47 -0800 Subject: HG agent transfers are starting to work. Gatekeeper handlers are missing. --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 45e88ce..0c098d9 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -59,13 +59,13 @@ namespace OpenSim.Server.Handlers.Simulation public Hashtable Handler(Hashtable request) { - //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); + m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); - //m_log.Debug("---------------------------"); - //m_log.Debug(" >> uri=" + request["uri"]); - //m_log.Debug(" >> content-type=" + request["content-type"]); - //m_log.Debug(" >> http-method=" + request["http-method"]); - //m_log.Debug("---------------------------\n"); + m_log.Debug("---------------------------"); + m_log.Debug(" >> uri=" + request["uri"]); + m_log.Debug(" >> content-type=" + request["content-type"]); + m_log.Debug(" >> http-method=" + request["http-method"]); + m_log.Debug("---------------------------\n"); Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; -- cgit v1.1 From b2e6ec9e12ad07eb08496ebe8ca0476b793017d5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 17 Jan 2010 18:04:55 -0800 Subject: Agent gets there through the Gatekeeper, but still a few quirks to fix. --- .../Server/Handlers/Simulation/AgentHandlers.cs | 32 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'OpenSim/Server/Handlers/Simulation/AgentHandlers.cs') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 0c098d9..ab3250d 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private ISimulationService m_SimulationService; + public AgentHandler() { } + public AgentHandler(ISimulationService sim) { m_SimulationService = sim; @@ -117,7 +119,7 @@ namespace OpenSim.Server.Handlers.Simulation } - protected virtual void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) + protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) { OSDMap args = Utils.GetOSDMap((string)request["body"]); if (args == null) @@ -171,7 +173,8 @@ namespace OpenSim.Server.Handlers.Simulation // This is the meaning of POST agent //m_regionClient.AdjustUserInformation(aCircuit); - bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); @@ -181,7 +184,13 @@ namespace OpenSim.Server.Handlers.Simulation responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); } - protected virtual void DoAgentPut(Hashtable request, Hashtable responsedata) + // subclasses can override this + protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) + { + return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); + } + + protected void DoAgentPut(Hashtable request, Hashtable responsedata) { OSDMap args = Utils.GetOSDMap((string)request["body"]); if (args == null) @@ -237,7 +246,7 @@ namespace OpenSim.Server.Handlers.Simulation //agent.Dump(); // This is one of the meanings of PUT agent - result = m_SimulationService.UpdateAgent(destination, agent); + result = UpdateAgent(destination, agent); } else if ("AgentPosition".Equals(messageType)) @@ -263,6 +272,12 @@ namespace OpenSim.Server.Handlers.Simulation //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead } + // subclasses cab override this + protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) + { + return m_SimulationService.UpdateAgent(destination, agent); + } + protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) { GridRegion destination = new GridRegion(); @@ -305,7 +320,7 @@ namespace OpenSim.Server.Handlers.Simulation } } - protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) + protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) { m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); @@ -313,7 +328,7 @@ namespace OpenSim.Server.Handlers.Simulation destination.RegionID = regionID; if (action.Equals("release")) - m_SimulationService.ReleaseAgent(regionID, id, ""); + ReleaseAgent(regionID, id); else m_SimulationService.CloseAgent(destination, id); @@ -322,6 +337,11 @@ namespace OpenSim.Server.Handlers.Simulation m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted."); } + + protected virtual void ReleaseAgent(UUID regionID, UUID id) + { + m_SimulationService.ReleaseAgent(regionID, id, ""); + } } } -- cgit v1.1