From 387e9f7a7faeb412054383080afc3507a1522746 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 2 Oct 2009 18:31:08 -0700 Subject: * Creates Util.UTF8 and switches some references of Encoding.UTF8 to Util.UTF8 (not all references were switched since not all OpenSim libraries reference OpenSim.Framework) * Shrinks the largest in-memory object, the LLRAW.HeightmapLookupValue struct (only used for exporting to LLRAW terrain files), to the minimum possible size. This seems to have the odd side effect of cutting the size of the two double[256,256] terrain objects in half. Possibly an alignment optimization? --- OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Client') diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 180f5e0..603ef57 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -886,7 +886,7 @@ namespace OpenSim.Client.MXP.ClientStack chatActionEvent.ActionFragment.SourceObjectId = fromAgentID.Guid; chatActionEvent.ActionFragment.ObservationRadius = 180.0f; chatActionEvent.ActionFragment.ExtensionDialect = "TEXT"; - chatActionEvent.SetPayloadData(Encoding.UTF8.GetBytes(message)); + chatActionEvent.SetPayloadData(Util.UTF8.GetBytes(message)); Session.Send(chatActionEvent); } -- cgit v1.1 From b2cdee5a14bb7c474a2126cadeefcab442f0ac8b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 3 Oct 2009 19:08:56 -0700 Subject: Better error handling to diagnose login problems. --- OpenSim/Client/Linden/LLProxyLoginModule.cs | 180 ++++++++++++++++------------ 1 file changed, 101 insertions(+), 79 deletions(-) (limited to 'OpenSim/Client') diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs index ccd38d4..195feaf 100644 --- a/OpenSim/Client/Linden/LLProxyLoginModule.cs +++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs @@ -182,104 +182,126 @@ namespace OpenSim.Client.Linden /// public XmlRpcResponse ExpectUser(XmlRpcRequest request, IPEndPoint remoteClient) { - Hashtable requestData = (Hashtable)request.Params[0]; - AgentCircuitData agentData = new AgentCircuitData(); - agentData.SessionID = new UUID((string)requestData["session_id"]); - agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); - agentData.firstname = (string)requestData["firstname"]; - agentData.lastname = (string)requestData["lastname"]; - agentData.AgentID = new UUID((string)requestData["agent_id"]); - agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); - agentData.CapsPath = (string)requestData["caps_path"]; - ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); - - // Appearance - if (requestData["appearance"] != null) - agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]); - - m_log.DebugFormat( - "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}", - agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode); - - if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) - { - //m_log.Debug("[CLIENT]: Child agent detected"); - agentData.child = true; - } - else - { - //m_log.Debug("[CLIENT]: Main agent detected"); - agentData.startpos = - new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), - (float)Convert.ToDecimal((string)requestData["startpos_y"]), - (float)Convert.ToDecimal((string)requestData["startpos_z"])); - agentData.child = false; - } - XmlRpcResponse resp = new XmlRpcResponse(); - if (!RegionLoginsEnabled) + try { - m_log.InfoFormat( - "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled", - agentData.firstname, agentData.lastname); + ulong regionHandle = 0; + Hashtable requestData = (Hashtable)request.Params[0]; + AgentCircuitData agentData = new AgentCircuitData(); + if (requestData.ContainsKey("session_id")) + agentData.SessionID = new UUID((string)requestData["session_id"]); + if (requestData.ContainsKey("secure_session_id")) + agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); + if (requestData.ContainsKey("firstname")) + agentData.firstname = (string)requestData["firstname"]; + if (requestData.ContainsKey("lastname")) + agentData.lastname = (string)requestData["lastname"]; + if (requestData.ContainsKey("agent_id")) + agentData.AgentID = new UUID((string)requestData["agent_id"]); + if (requestData.ContainsKey("circuit_code")) + agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); + if (requestData.ContainsKey("caps_path")) + agentData.CapsPath = (string)requestData["caps_path"]; + if (requestData.ContainsKey("regionhandle")) + regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); + else + m_log.Warn("[CLIENT]: request from login server did not contain regionhandle"); - Hashtable respdata = new Hashtable(); - respdata["success"] = "FALSE"; - respdata["reason"] = "region login currently disabled"; - resp.Value = respdata; - } - else - { - bool success = false; - string denyMess = ""; + // Appearance + if (requestData.ContainsKey("appearance")) + agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]); - Scene scene; - if (TryGetRegion(regionHandle, out scene)) - { - if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID)) - { - denyMess = "User is banned from this region"; - m_log.InfoFormat( - "[CLIENT]: Denying access for user {0} {1} because user is banned", - agentData.firstname, agentData.lastname); - } - else - { - string reason; - if (scene.NewUserConnection(agentData, out reason)) - { - success = true; - } - else - { - denyMess = String.Format("Login refused by region: {0}", reason); - m_log.InfoFormat( - "[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region", - agentData.firstname, agentData.lastname); - } - } + m_log.DebugFormat( + "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}", + agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode); + if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) + { + //m_log.Debug("[CLIENT]: Child agent detected"); + agentData.child = true; } else { - denyMess = "Region not found"; + //m_log.Debug("[CLIENT]: Main agent detected"); + agentData.startpos = + new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), + (float)Convert.ToDecimal((string)requestData["startpos_y"]), + (float)Convert.ToDecimal((string)requestData["startpos_z"])); + agentData.child = false; } - if (success) + if (!RegionLoginsEnabled) { + m_log.InfoFormat( + "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled", + agentData.firstname, agentData.lastname); + Hashtable respdata = new Hashtable(); - respdata["success"] = "TRUE"; + respdata["success"] = "FALSE"; + respdata["reason"] = "region login currently disabled"; resp.Value = respdata; } else { - Hashtable respdata = new Hashtable(); - respdata["success"] = "FALSE"; - respdata["reason"] = denyMess; - resp.Value = respdata; + bool success = false; + string denyMess = ""; + + Scene scene; + if (TryGetRegion(regionHandle, out scene)) + { + if (scene.RegionInfo.EstateSettings.IsBanned(agentData.AgentID)) + { + denyMess = "User is banned from this region"; + m_log.InfoFormat( + "[CLIENT]: Denying access for user {0} {1} because user is banned", + agentData.firstname, agentData.lastname); + } + else + { + string reason; + if (scene.NewUserConnection(agentData, out reason)) + { + success = true; + } + else + { + denyMess = String.Format("Login refused by region: {0}", reason); + m_log.InfoFormat( + "[CLIENT]: Denying access for user {0} {1} because user connection was refused by the region", + agentData.firstname, agentData.lastname); + } + } + + } + else + { + denyMess = "Region not found"; + } + + if (success) + { + Hashtable respdata = new Hashtable(); + respdata["success"] = "TRUE"; + resp.Value = respdata; + } + else + { + Hashtable respdata = new Hashtable(); + respdata["success"] = "FALSE"; + respdata["reason"] = denyMess; + resp.Value = respdata; + } } } + catch (Exception e) + { + m_log.WarnFormat("[CLIENT]: Unable to receive user. Reason: {0}", e); + Hashtable respdata = new Hashtable(); + respdata["success"] = "FALSE"; + respdata["reason"] = "Exception occurred"; + resp.Value = respdata; + } return resp; } -- cgit v1.1 From 29a4614529bbda02b9c690d2d1812be1d1e7bbae Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sun, 4 Oct 2009 13:57:51 -0700 Subject: * MySQL data tests now pass by fixing a bad fix for a bad cast on the asset Local member in MySQLAssetData * First pass at applying the using(){} pattern to IDisposable objects. Always use the using pattern on IDisposable objects whenever possible, do not manually call .Close() or .Dispose() unless there is no other way to write the code. This pass mostly covers OpenSim.Data.MySQL, and should have no functional change (tests still pass) --- OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'OpenSim/Client') diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 8c9eb5f..c649c5a 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -95,16 +95,15 @@ namespace OpenSim.Client.VWoHTTP.ClientStack ManagedImage tmp; Image imgData; + byte[] jpegdata; OpenJPEG.DecodeToImage(asset.Data, out tmp, out imgData); - - MemoryStream ms = new MemoryStream(); - imgData.Save(ms, ImageFormat.Jpeg); - - byte[] jpegdata = ms.GetBuffer(); - - ms.Close(); + using (MemoryStream ms = new MemoryStream()) + { + imgData.Save(ms, ImageFormat.Jpeg); + jpegdata = ms.GetBuffer(); + } resp.ContentType = "image/jpeg"; resp.ContentLength = jpegdata.Length; -- cgit v1.1 From 362e94a0229d0b450001b8b089a472b550b530f3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 4 Oct 2009 16:30:12 -0700 Subject: * KeepAlive set to false in expect_user and log_off. * Check for null SP in PermissionsModule. --- OpenSim/Client/Linden/LLProxyLoginModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Client') diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs index 195feaf..f9cb3a9 100644 --- a/OpenSim/Client/Linden/LLProxyLoginModule.cs +++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs @@ -148,8 +148,8 @@ namespace OpenSim.Client.Linden protected void AddHttpHandlers() { //we will add our handlers to the first scene we received, as all scenes share a http server. But will this ever change? - MainServer.Instance.AddXmlRPCHandler("expect_user", ExpectUser); - MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser); + MainServer.Instance.AddXmlRPCHandler("expect_user", ExpectUser, false); + MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser, false); } protected void AddScene(Scene scene) -- cgit v1.1