From 57d60a95a2c3a61bfcff9760b36088f13fa4bbd5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Dec 2009 16:23:57 +0000 Subject: minor: make logging messages consistent in BaseHttpServer --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 75cdeb4..6f41714 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -465,11 +465,11 @@ namespace OpenSim.Framework.Servers.HttpServer catch (SocketException e) { // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); + m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); } catch (IOException e) { - m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message); + m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); } return; } @@ -548,7 +548,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (IOException e) { - m_log.ErrorFormat("[BASE HTTP SERVER] HandleRequest() threw ", e); + m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e); } catch (InvalidOperationException e) { @@ -763,7 +763,7 @@ namespace OpenSim.Framework.Servers.HttpServer byte[] buf = Encoding.UTF8.GetBytes("Not found"); response.KeepAlive = false; - m_log.ErrorFormat("[BASE HTTP SERVER] Handler not found for http request {0}", request.RawUrl); + m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl); response.SendChunked = false; response.ContentLength64 = buf.Length; @@ -775,7 +775,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception ex) { - m_log.Warn("[HTTPD]: Error - " + ex.Message); + m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message); } finally { @@ -787,11 +787,11 @@ namespace OpenSim.Framework.Servers.HttpServer catch (SocketException e) { // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); + m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); } catch (IOException e) { - m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message); + m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); } } return; @@ -812,7 +812,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception ex) { - m_log.Warn("[HTTPD]: Error - " + ex.Message); + m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message); } finally { @@ -824,11 +824,11 @@ namespace OpenSim.Framework.Servers.HttpServer catch (SocketException e) { // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); + m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); } catch (IOException e) { - m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message); + m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); } } } @@ -864,7 +864,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception ex) { - m_log.Warn("[HTTPD]: Error - " + ex.Message); + m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message); } if (llsdRequest != null)// && m_defaultLlsdHandler != null) @@ -925,7 +925,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception ex) { - m_log.Warn("[HTTPD]: Error - " + ex.Message); + m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message); } finally { @@ -939,12 +939,12 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (IOException e) { - m_log.DebugFormat("[BASE HTTP SERVER] LLSD IOException {0}.", e); + m_log.DebugFormat("[BASE HTTP SERVER]: LLSD IOException {0}.", e); } catch (SocketException e) { // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] LLSD issue {0}.\nNOTE: this may be spurious on Linux.", e); + m_log.WarnFormat("[BASE HTTP SERVER]: LLSD issue {0}.\nNOTE: this may be spurious on Linux.", e); } } } @@ -1482,11 +1482,11 @@ namespace OpenSim.Framework.Servers.HttpServer catch (SocketException e) { // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); + m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); } catch (IOException e) { - m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message); + m_log.Warn("[BASE HTTP SERVER]: XmlRpcRequest issue: " + e.Message); } } } @@ -1510,7 +1510,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception ex) { - m_log.Warn("[HTTPD]: Error - " + ex.Message); + m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message); } finally { @@ -1523,7 +1523,7 @@ namespace OpenSim.Framework.Servers.HttpServer catch (SocketException e) { // This has to be here to prevent a Linux/Mono crash - m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); + m_log.WarnFormat("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); } } } @@ -1546,7 +1546,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception ex) { - m_log.Warn("[HTTPD]: Error - " + ex.Message); + m_log.Warn("[BASE HTTP SERVER]: Error - " + ex.Message); } finally { @@ -1566,7 +1566,7 @@ namespace OpenSim.Framework.Servers.HttpServer public void Start() { - m_log.Info("[HTTPD]: Starting up HTTP Server"); + m_log.Info("[BASE HTTP SERVER]: Starting up HTTP Server"); StartHTTP(); } @@ -1574,7 +1574,7 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - m_log.Info("[HTTPD]: Spawned main thread OK"); + m_log.Debug("[BASE HTTP SERVER]: Spawned main thread OK"); //m_httpListener = new HttpListener(); NotSocketErrors = 0; if (!m_ssl) @@ -1614,8 +1614,8 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception e) { - m_log.Error("[HTTPD]: Error - " + e.Message); - m_log.Error("[HTTPD]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?"); + m_log.Error("[BASE HTTP SERVER]: Error - " + e.Message); + m_log.Error("[BASE HTTP SERVER]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?"); // We want this exception to halt the entire server since in current configurations we aren't too // useful without inbound HTTP. @@ -1636,7 +1636,7 @@ namespace OpenSim.Framework.Servers.HttpServer public void httpServerException(object source, Exception exception) { - m_log.ErrorFormat("[HTTPSERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); + m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); /* if (HTTPDRunning)// && NotSocketErrors > 5) { @@ -1662,7 +1662,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (NullReferenceException) { - m_log.Warn("[BASEHTTPSERVER]: Null Reference when stopping HttpServer."); + m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer."); } } -- cgit v1.1 From 87e9062862ad8bc906b51b41d11641e1bccc551c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Dec 2009 16:34:27 +0000 Subject: Make sure that we catch and display any exceptions that get right to the top of our incoming http request handling stack --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 98 ++++++++++++---------- 1 file changed, 52 insertions(+), 46 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 6f41714..08f1bec 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -253,60 +253,66 @@ namespace OpenSim.Framework.Servers.HttpServer private void OnRequest(object source, RequestEventArgs args) { - IHttpClientContext context = (IHttpClientContext)source; - IHttpRequest request = args.Request; - - PollServiceEventArgs psEvArgs; - - if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs)) + try { - PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request); - - if (psEvArgs.Request != null) + IHttpClientContext context = (IHttpClientContext)source; + IHttpRequest request = args.Request; + + PollServiceEventArgs psEvArgs; + + if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs)) { - OSHttpRequest req = new OSHttpRequest(context, request); - - Stream requestStream = req.InputStream; - - Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(requestStream, encoding); - - string requestBody = reader.ReadToEnd(); - - Hashtable keysvals = new Hashtable(); - Hashtable headervals = new Hashtable(); - - string[] querystringkeys = req.QueryString.AllKeys; - string[] rHeaders = req.Headers.AllKeys; - - keysvals.Add("body", requestBody); - keysvals.Add("uri", req.RawUrl); - keysvals.Add("content-type", req.ContentType); - keysvals.Add("http-method", req.HttpMethod); - - foreach (string queryname in querystringkeys) - { - keysvals.Add(queryname, req.QueryString[queryname]); - } - - foreach (string headername in rHeaders) + PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request); + + if (psEvArgs.Request != null) { - headervals[headername] = req.Headers[headername]; + OSHttpRequest req = new OSHttpRequest(context, request); + + Stream requestStream = req.InputStream; + + Encoding encoding = Encoding.UTF8; + StreamReader reader = new StreamReader(requestStream, encoding); + + string requestBody = reader.ReadToEnd(); + + Hashtable keysvals = new Hashtable(); + Hashtable headervals = new Hashtable(); + + string[] querystringkeys = req.QueryString.AllKeys; + string[] rHeaders = req.Headers.AllKeys; + + keysvals.Add("body", requestBody); + keysvals.Add("uri", req.RawUrl); + keysvals.Add("content-type", req.ContentType); + keysvals.Add("http-method", req.HttpMethod); + + foreach (string queryname in querystringkeys) + { + keysvals.Add(queryname, req.QueryString[queryname]); + } + + foreach (string headername in rHeaders) + { + headervals[headername] = req.Headers[headername]; + } + + keysvals.Add("headers",headervals); + keysvals.Add("querystringkeys", querystringkeys); + + psEvArgs.Request(psreq.RequestID, keysvals); } - - keysvals.Add("headers",headervals); - keysvals.Add("querystringkeys", querystringkeys); - - psEvArgs.Request(psreq.RequestID, keysvals); + + m_PollServiceManager.Enqueue(psreq); + } + else + { + OnHandleRequestIOThread(context, request); } - - m_PollServiceManager.Enqueue(psreq); } - else + catch (Exception e) { - OnHandleRequestIOThread(context, request); + m_log.ErrorFormat("[BASE HTTP SERVER]: OnRequest() failed with {0} {1}", e.Message, e.StackTrace); } - } public void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request) -- cgit v1.1 From 6bd087a8f96c5f6ec3720d14778c4d2abb8ec95b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Dec 2009 16:42:42 +0000 Subject: minor: remove some mono compiler warnings --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 +++--- OpenSim/Tests/Clients/Grid/GridClient.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2710cff..289ba47 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -124,7 +124,7 @@ namespace OpenSim.Region.Framework.Scenes private Vector3? m_forceToApply; private uint m_requestedSitTargetID; private UUID m_requestedSitTargetUUID; - private Vector3 m_requestedSitOffset; + private SendCourseLocationsMethod m_sendCourseLocationsMethod; private bool m_startAnimationSet; @@ -1777,7 +1777,7 @@ namespace OpenSim.Region.Framework.Scenes m_nextSitAnimation = part.SitAnimation; } m_requestedSitTargetID = part.LocalId; - m_requestedSitOffset = offset; + //m_requestedSitOffset = offset; m_requestedSitTargetUUID = targetID; m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset); @@ -2010,7 +2010,7 @@ namespace OpenSim.Region.Framework.Scenes if (part != null) { m_requestedSitTargetID = part.LocalId; - m_requestedSitOffset = offset; + //m_requestedSitOffset = offset; m_requestedSitTargetUUID = targetID; m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset); diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs index 8798c5e..972c0aa 100644 --- a/OpenSim/Tests/Clients/Grid/GridClient.cs +++ b/OpenSim/Tests/Clients/Grid/GridClient.cs @@ -44,9 +44,9 @@ namespace OpenSim.Tests.Clients.GridClient { public class GridClient { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = +// LogManager.GetLogger( +// MethodBase.GetCurrentMethod().DeclaringType); public static void Main(string[] args) { -- cgit v1.1 From 9485f17bf91632b566e884f8058adf7b7fe3533a Mon Sep 17 00:00:00 2001 From: dahlia Date: Tue, 15 Dec 2009 19:12:24 -0800 Subject: random drive-by minor math optimization. No need for concern, bitshed was within acceptable limits --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9a905f1..7f71d09 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4412,8 +4412,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api double x, y, z, s, t; - s = Math.Cos(angle / 2); - t = Math.Sin(angle / 2); // temp value to avoid 2 more sin() calcs + s = Math.Cos(angle * 0.5); + t = Math.Sin(angle * 0.5); // temp value to avoid 2 more sin() calcs x = axis.x * t; y = axis.y * t; z = axis.z * t; -- cgit v1.1 From 26e3a8ee4b63f67b7fd3957b9f8b94d874ed5627 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 19 Dec 2009 10:16:07 -0800 Subject: * Bug fix in HG: preserve the home region coordinates across multiple HG TPs. * Removed unnecessary debug messages. --- .../ServiceConnectorsOut/Grid/HGGridConnector.cs | 13 +++++++++++-- .../Interregion/LocalInterregionComms.cs | 4 +++- .../Services/Connectors/Grid/HypergridServiceConnector.cs | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs index 4d347cd..93cb60c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs @@ -405,6 +405,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (parts.Length >= 2) { portstr = parts[1]; + //m_log.Debug("-- port = " + portstr); if (!UInt32.TryParse(portstr, out port)) regionName = parts[1]; } @@ -620,8 +621,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid clonedRegion.RegionLocX = (int)x; clonedRegion.RegionLocY = (int)y; - // Get the user's home region information - GridRegion home = m_aScene.GridService.GetRegionByUUID(m_aScene.RegionInfo.ScopeID, uinfo.UserProfile.HomeRegionID); + // Get the user's home region information and adapt the region handle + GridRegion home = GetRegionByUUID(m_aScene.RegionInfo.ScopeID, uinfo.UserProfile.HomeRegionID); + if (m_HyperlinkHandles.ContainsKey(uinfo.UserProfile.HomeRegionID)) + { + ulong realHandle = m_HyperlinkHandles[uinfo.UserProfile.HomeRegionID]; + Utils.LongToUInts(realHandle, out x, out y); + m_log.DebugFormat("[HGrid]: Foreign user is going elsewhere. Adjusting home handle from {0}-{1} to {2}-{3}", home.RegionLocX, home.RegionLocY, x, y); + home.RegionLocX = (int)x; + home.RegionLocY = (int)y; + } // Get the user's service URLs string serverURI = ""; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs index d9f6e33..bdfe3b1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs @@ -157,7 +157,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion } // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); - reason = "Did not find region."; + uint x = 0, y = 0; + Utils.LongToUInts(regionHandle, out x, out y); + reason = "Did not find region " + x + "-" + y; return false; } diff --git a/OpenSim/Services/Connectors/Grid/HypergridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/HypergridServiceConnector.cs index 2f33bab..968a6d6 100644 --- a/OpenSim/Services/Connectors/Grid/HypergridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/HypergridServiceConnector.cs @@ -92,12 +92,12 @@ namespace OpenSim.Services.Connectors.Grid try { UUID.TryParse((string)hash["uuid"], out uuid); - m_log.Debug(">> HERE, uuid: " + uuid); + //m_log.Debug(">> HERE, uuid: " + uuid); info.RegionID = uuid; if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - m_log.Debug(">> HERE, realHandle: " + realHandle); + //m_log.Debug(">> HERE, realHandle: " + realHandle); } //if (hash["region_image"] != null) //{ -- cgit v1.1 From e38e8ae98759e403175016260edd27772b5c9e4c Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Sat, 19 Dec 2009 19:54:44 -0500 Subject: Fix mantis #10 & #14 --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 33 +++++++--------------- 2 files changed, 11 insertions(+), 24 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index d348c90..a7d34f5 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.9CM"; + private const string VERSION_NUMBER = "0.6.91CM"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 778e384..0eddbfd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -513,24 +513,11 @@ namespace OpenSim.Region.Framework.Scenes { // If this is a linkset, we don't want the physics engine mucking up our group position here. PhysicsActor actor = PhysActor; - if (actor != null && _parentID == 0) { m_groupPosition = actor.Position; - } -/* - if (actor != null) - { - if (_parentID == 0) - { - m_groupPosition = actor.Position; - } - else - { - m_groupPosition = ParentGroup.AbsolutePosition; // KF+Casper Update Child prims too! - } } -*/ + if (IsAttachment) { ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar); @@ -545,7 +532,6 @@ namespace OpenSim.Region.Framework.Scenes StoreUndoState(); m_groupPosition = value; - PhysicsActor actor = PhysActor; if (actor != null) { @@ -1755,16 +1741,17 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 GetWorldPosition() { Quaternion parentRot = ParentGroup.RootPart.RotationOffset; - Vector3 axPos = OffsetPosition; axPos *= parentRot; Vector3 translationOffsetPosition = axPos; - - int tx = (int)GroupPosition.X; - int ty = (int)GroupPosition.Y; - int tz = (int)GroupPosition.Z; - - return GroupPosition + translationOffsetPosition; + if(_parentID == 0) + { + return GroupPosition; + } + else + { + return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position + } } /// @@ -1775,7 +1762,7 @@ namespace OpenSim.Region.Framework.Scenes { Quaternion newRot; - if (this.LinkNum == 0) + if (this.LinkNum < 2) //KF Single or root prim { newRot = RotationOffset; } -- cgit v1.1 From 37b07aa9ec1d4bb9c84eebc5f9d99b4d70d6d05e Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 20 Dec 2009 16:44:31 +0000 Subject: Fix a case where an idle sim can eat 100% of a core --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index eb284c1..f79eb5d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1314,7 +1314,7 @@ namespace OpenSim.Region.Framework.Scenes maintc = Util.EnvironmentTickCountSubtract(maintc); maintc = (int)(m_timespan * 1000) - maintc; - if ((maintc < (m_timespan * 1000)) && maintc > 0) + if (maintc > 0) Thread.Sleep(maintc); // Tell the watchdog that this thread is still alive -- cgit v1.1 From f6ef48741303b6e19a5aa73de038b46e0ab409c5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 21 Dec 2009 06:29:23 +0000 Subject: Script State Fix: Step 1 Add Engine=xxx attribute and check for it's presence. Ignore state data written bby another engine --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 9030a5c..20dbbd4 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1266,6 +1266,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine XmlAttribute assetID = doc.CreateAttribute("", "Asset", ""); assetID.Value = instance.AssetID.ToString(); stateData.Attributes.Append(assetID); + XmlAttribute engineName = doc.CreateAttribute("", "Engine", ""); + engineName.Value = ScriptEngineName; + stateData.Attributes.Append(engineName); doc.AppendChild(stateData); // Add ... @@ -1388,6 +1391,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine XmlElement rootE = (XmlElement)rootL[0]; + if (rootE.GetAttribute("Engine") != ScriptEngineName) + return; + if (rootE.GetAttribute("UUID") != itemID.ToString()) return; -- cgit v1.1 From 83d8ba5775146da220b7e60d3779810db8a1eb5d Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 21 Dec 2009 06:41:10 +0000 Subject: Remove extra checking on the itemID of saved state, since it changes during rez from inventory. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 20dbbd4..082c99b 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1394,10 +1394,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (rootE.GetAttribute("Engine") != ScriptEngineName) return; - if (rootE.GetAttribute("UUID") != itemID.ToString()) - return; - -// string assetID = rootE.GetAttribute("Asset"); +// On rez from inventory, that ID will have changed. It was only +// advisory anyway. So we don't check it anymore. +// +// if (rootE.GetAttribute("UUID") != itemID.ToString()) +// return; XmlNodeList stateL = rootE.GetElementsByTagName("ScriptState"); -- cgit v1.1 From 27453890d5a5d09e47c638ccef92f45b1ce360b2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 21 Dec 2009 10:26:52 +0000 Subject: Script State Fix: Part 2 Change the reader to wrap old-style definitions in new style wrappers. Change importer to not check irrelevant data that can't be reconstructed This removes the last bit of knowledge of XEngine's .state files from core. --- .../Region/Framework/Interfaces/IScriptModule.cs | 2 +- .../Framework/Scenes/SceneObjectPartInventory.cs | 55 +++++++++++++++++++--- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 36 +++++++------- 3 files changed, 69 insertions(+), 24 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index f11e571..98efcbe 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs @@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces string ScriptEngineName { get; } string GetXMLState(UUID itemID); - void SetXMLState(UUID itemID, string xml); + bool SetXMLState(UUID itemID, string xml); bool PostScriptEvent(UUID itemID, string name, Object[] args); bool PostObjectEvent(UUID itemID, string name, Object[] args); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 22eedba..47e4ad0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -26,6 +26,7 @@ */ using System; +using System.Xml; using System.IO; using System.Collections.Generic; using System.Reflection; @@ -283,15 +284,55 @@ namespace OpenSim.Region.Framework.Scenes private void RestoreSavedScriptState(UUID oldID, UUID newID) { + IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); + if (engines == null) // No engine at all + return; + if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID)) { - string fpath = Path.Combine("ScriptEngines/"+m_part.ParentGroup.Scene.RegionInfo.RegionID.ToString(), - newID.ToString()+".state"); - FileStream fs = File.Create(fpath); - Byte[] buffer = enc.GetBytes(m_part.ParentGroup.m_savedScriptState[oldID]); - fs.Write(buffer,0,buffer.Length); - fs.Close(); - m_part.ParentGroup.m_savedScriptState.Remove(oldID); + XmlDocument doc = new XmlDocument(); + + doc.LoadXml(m_part.ParentGroup.m_savedScriptState[oldID]); + + ////////// CRUFT WARNING /////////////////////////////////// + // + // Old objects will have ... + // This format is XEngine ONLY + // + // New objects have ... + // This can be passed to any engine + // + XmlNode n = doc.SelectSingleNode("ScriptState"); + if (n != null) // Old format data + { + XmlDocument newDoc = new XmlDocument(); + + XmlElement rootN = newDoc.CreateElement("", "State", ""); + XmlAttribute uuidA = newDoc.CreateAttribute("", "UUID", ""); + uuidA.Value = oldID.ToString(); + rootN.Attributes.Append(uuidA); + XmlAttribute engineA = newDoc.CreateAttribute("", "Engine", ""); + engineA.Value = "XEngine"; + rootN.Attributes.Append(engineA); + + newDoc.AppendChild(rootN); + + XmlNode stateN = newDoc.ImportNode(n, true); + rootN.AppendChild(stateN); + + // This created document has only the minimun data + // necessary for XEngine to parse it successfully + + m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml; + } + foreach (IScriptModule e in engines) + { + if (e != null) + { + if (e.SetXMLState(newID, m_part.ParentGroup.m_savedScriptState[oldID])) + break; + } + } } } diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 082c99b..25a4cd6 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1368,10 +1368,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine return false; } - public void SetXMLState(UUID itemID, string xml) + public bool SetXMLState(UUID itemID, string xml) { if (xml == String.Empty) - return; + return false; XmlDocument doc = new XmlDocument(); @@ -1382,17 +1382,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine catch (Exception) { m_log.Error("[XEngine]: Exception decoding XML data from region transfer"); - return; + return false; } XmlNodeList rootL = doc.GetElementsByTagName("State"); if (rootL.Count < 1) - return; + return false; XmlElement rootE = (XmlElement)rootL[0]; if (rootE.GetAttribute("Engine") != ScriptEngineName) - return; + return false; // On rez from inventory, that ID will have changed. It was only // advisory anyway. So we don't check it anymore. @@ -1403,7 +1403,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine XmlNodeList stateL = rootE.GetElementsByTagName("ScriptState"); if (stateL.Count != 1) - return; + return false; XmlElement stateE = (XmlElement)stateL[0]; @@ -1412,7 +1412,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine XmlNodeList assemL = rootE.GetElementsByTagName("Assembly"); if (assemL.Count != 1) - return; + return false; XmlElement assemE = (XmlElement)assemL[0]; @@ -1452,19 +1452,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine sfs.Close(); XmlNodeList mapL = rootE.GetElementsByTagName("LineMap"); - - XmlElement mapE = (XmlElement)mapL[0]; + if (mapL.Count > 0) + { + XmlElement mapE = (XmlElement)mapL[0]; - string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); - mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); + string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); + mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); - FileStream mfs = File.Create(mappath); - StreamWriter msw = new StreamWriter(mfs); + FileStream mfs = File.Create(mappath); + StreamWriter msw = new StreamWriter(mfs); - msw.Write(mapE.InnerText); + msw.Write(mapE.InnerText); - msw.Close(); - mfs.Close(); + msw.Close(); + mfs.Close(); + } + + return true; } } } -- cgit v1.1