diff --git a/OpenSim/ConsoleClient/Requester.cs b/OpenSim/ConsoleClient/Requester.cs index aabb02cbb3..0a213288da 100644 --- a/OpenSim/ConsoleClient/Requester.cs +++ b/OpenSim/ConsoleClient/Requester.cs @@ -44,7 +44,6 @@ namespace OpenSim.ConsoleClient ReplyDelegate action) { WebRequest request = WebRequest.Create(requestUrl); - WebResponse response = null; request.Method = "POST"; @@ -64,16 +63,18 @@ namespace OpenSim.ConsoleClient { string reply = String.Empty; - response = request.EndGetResponse(ar); - - try + using (WebResponse response = request.EndGetResponse(ar)) { - StreamReader r = new StreamReader(response.GetResponseStream()); - reply = r.ReadToEnd(); + try + { + using (Stream s = response.GetResponseStream()) + using (StreamReader r = new StreamReader(s)) + reply = r.ReadToEnd(); - } - catch (System.InvalidOperationException) - { + } + catch (System.InvalidOperationException) + { + } } action(requestUrl, data, reply); diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index 3dce578193..6681c37bc5 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs @@ -65,23 +65,27 @@ namespace OpenSim.Framework.Configuration.HTTP byte[] buf = new byte[8192]; HttpWebRequest request = (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); - HttpWebResponse response = (HttpWebResponse) request.GetResponse(); - - Stream resStream = response.GetResponseStream(); - - string tempString = null; - int count = 0; - - do + using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { - count = resStream.Read(buf, 0, buf.Length); - if (count != 0) + using (Stream resStream = response.GetResponseStream()) { - tempString = Util.UTF8.GetString(buf, 0, count); - sb.Append(tempString); + string tempString = null; + int count = 0; + + do + { + count = resStream.Read(buf, 0, buf.Length); + if (count != 0) + { + tempString = Util.UTF8.GetString(buf, 0, count); + sb.Append(tempString); + } + } + while (count > 0); + + LoadDataFromString(sb.ToString()); } - } while (count > 0); - LoadDataFromString(sb.ToString()); + } } catch (WebException) { diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 19c03a8e1a..edcd134cae 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -101,20 +101,11 @@ namespace OpenSim.Framework.Servers.HttpServer using (WebResponse resp = request.GetResponse()) { XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); - Stream respStream = null; - try - { - respStream = resp.GetResponseStream(); + + using (Stream respStream = resp.GetResponseStream()) deserial = (TResponse)deserializer.Deserialize(respStream); - } - catch { } - finally - { - if (respStream != null) - respStream.Close(); - resp.Close(); - } } + return deserial; } } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index b85d93d53a..bf57fd422d 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -228,8 +228,8 @@ namespace OpenSim.Framework errorMessage = we.Message; if (we.Status == WebExceptionStatus.ProtocolError) { - HttpWebResponse webResponse = (HttpWebResponse)we.Response; - errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription); + using (HttpWebResponse webResponse = (HttpWebResponse)we.Response) + errorMessage = String.Format("[{0}] {1}", webResponse.StatusCode, webResponse.StatusDescription); } } catch (Exception ex) @@ -388,8 +388,8 @@ namespace OpenSim.Framework errorMessage = we.Message; if (we.Status == WebExceptionStatus.ProtocolError) { - HttpWebResponse webResponse = (HttpWebResponse)we.Response; - errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription); + using (HttpWebResponse webResponse = (HttpWebResponse)we.Response) + errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription); } } catch (Exception ex) @@ -837,15 +837,16 @@ namespace OpenSim.Framework { if (e.Response is HttpWebResponse) { - HttpWebResponse httpResponse = (HttpWebResponse)e.Response; - - if (httpResponse.StatusCode != HttpStatusCode.NotFound) - { - // We don't appear to be handling any other status codes, so log these feailures to that - // people don't spend unnecessary hours hunting phantom bugs. - m_log.DebugFormat( - "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", - verb, requestUrl, httpResponse.StatusCode); + using (HttpWebResponse httpResponse = (HttpWebResponse)e.Response) + { + if (httpResponse.StatusCode != HttpStatusCode.NotFound) + { + // We don't appear to be handling any other status codes, so log these feailures to that + // people don't spend unnecessary hours hunting phantom bugs. + m_log.DebugFormat( + "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", + verb, requestUrl, httpResponse.StatusCode); + } } } } @@ -995,11 +996,9 @@ namespace OpenSim.Framework Stream respStream = null; try { - respStream = resp.GetResponseStream(); - using (StreamReader reader = new StreamReader(respStream)) - { - respstring = reader.ReadToEnd(); - } + using (respStream = resp.GetResponseStream()) + using (StreamReader reader = new StreamReader(respStream)) + respstring = reader.ReadToEnd(); } catch (Exception e) { @@ -1142,10 +1141,11 @@ namespace OpenSim.Framework { if (resp.ContentLength != 0) { - Stream respStream = resp.GetResponseStream(); - XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); - deserial = (TResponse)deserializer.Deserialize(respStream); - respStream.Close(); + using (Stream respStream = resp.GetResponseStream()) + { + XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); + deserial = (TResponse)deserializer.Deserialize(respStream); + } } else { @@ -1157,14 +1157,15 @@ namespace OpenSim.Framework } catch (WebException e) { - HttpWebResponse hwr = (HttpWebResponse)e.Response; - - if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) - return deserial; - else - m_log.ErrorFormat( - "[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}", - verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); + using (HttpWebResponse hwr = (HttpWebResponse)e.Response) + { + if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) + return deserial; + else + m_log.ErrorFormat( + "[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}", + verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); + } } catch (System.InvalidOperationException) { diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 60b7190c8a..b9c373b51f 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -88,15 +88,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp /// private int m_TotalUrls = 15000; - private uint https_port = 0; + private uint m_HttpsPort = 0; private IHttpServer m_HttpServer = null; private IHttpServer m_HttpsServer = null; - private string m_ExternalHostNameForLSL = ""; - public string ExternalHostNameForLSL - { - get { return m_ExternalHostNameForLSL; } - } + public string ExternalHostNameForLSL { get; private set; } public Type ReplaceableInterface { @@ -110,13 +106,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp public void Initialise(IConfigSource config) { - m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); - bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false); - if (ssl_enabled) + IConfig networkConfig = config.Configs["Network"]; + + if (networkConfig != null) { - https_port = (uint) config.Configs["Network"].GetInt("https_port",0); + ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null); + + bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false); + + if (ssl_enabled) + m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort); } + if (ExternalHostNameForLSL == null) + ExternalHostNameForLSL = System.Environment.MachineName; + IConfig llFunctionsConfig = config.Configs["LL-Functions"]; if (llFunctionsConfig != null) @@ -136,9 +140,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp m_HttpServer = MainServer.Instance; // // We can use the https if it is enabled - if (https_port > 0) + if (m_HttpsPort > 0) { - m_HttpsServer = MainServer.GetHttpServer(https_port); + m_HttpsServer = MainServer.GetHttpServer(m_HttpsPort); } } @@ -176,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); return urlcode; } - string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); + string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); UrlData urlData = new UrlData(); urlData.hostID = host.UUID; @@ -221,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); return urlcode; } - string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString(); + string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString(); UrlData urlData = new UrlData(); urlData.hostID = host.UUID; @@ -542,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp { Hashtable headers = (Hashtable)request["headers"]; -// string uri_full = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; +// string uri_full = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri;// "/lslhttp/" + urlcode.ToString() + "/"; int pos1 = uri.IndexOf("/");// /lslhttp int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ @@ -558,10 +562,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp UrlData url = null; string urlkey; if (!is_ssl) - urlkey = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; + urlkey = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; //m_UrlMap[]; else - urlkey = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; + urlkey = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; if (m_UrlMap.ContainsKey(urlkey)) { diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index f395441dce..14304a77ea 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -838,13 +838,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender try { WebRequest request = HttpWebRequest.Create(url); -//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. -//Ckrinke Stream str = null; - HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); - if (response.StatusCode == HttpStatusCode.OK) + + using (HttpWebResponse response = (HttpWebResponse)(request).GetResponse()) { - Bitmap image = new Bitmap(response.GetResponseStream()); - return image; + if (response.StatusCode == HttpStatusCode.OK) + { + using (Stream s = response.GetResponseStream()) + { + Bitmap image = new Bitmap(s); + return image; + } + } } } catch { } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index c868ee435b..bf186165b4 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (Util.GetConfigVarFromSections( config, "WorldMapModule", configSections, "WorldMap") == "WorldMap") m_Enabled = true; - + blacklistTimeout = Util.GetConfigVarFromSections(config, "BlacklistTimeout", configSections, 10 * 60) * 1000; } diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 143af48d99..ced4e91e6d 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs @@ -52,7 +52,18 @@ namespace OpenSim.Region.Framework.Interfaces string GetXMLState(UUID itemID); bool SetXMLState(UUID itemID, string xml); + /// + /// Post a script event to a single script. + /// + /// true if the post suceeded, false if it did not + /// The item ID of the script. + /// The name of the event. + /// + /// The arguments of the event. These are in the order in which they appear. + /// e.g. for http_request this will be an object array of key request_id, string method, string body + /// bool PostScriptEvent(UUID itemID, string name, Object[] args); + bool PostObjectEvent(UUID itemID, string name, Object[] args); /// diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index f292a75625..0cec959961 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -551,13 +551,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice reqStream.Close(); } - HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse(); - Encoding encoding = Util.UTF8; - StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding); - fwdresponsestr = fwdresponsestream.ReadToEnd(); - fwdresponsecontenttype = fwdrsp.ContentType; - fwdresponsecode = (int)fwdrsp.StatusCode; - fwdresponsestream.Close(); + using (HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse()) + { + Encoding encoding = Util.UTF8; + + using (Stream s = fwdrsp.GetResponseStream()) + { + using (StreamReader fwdresponsestream = new StreamReader(s)) + { + fwdresponsestr = fwdresponsestream.ReadToEnd(); + fwdresponsecontenttype = fwdrsp.ContentType; + fwdresponsecode = (int)fwdrsp.StatusCode; + } + } + } response["content_type"] = fwdresponsecontenttype; response["str_response_string"] = fwdresponsestr; diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 7da1de64bb..e756c70052 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs @@ -1123,18 +1123,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice // Otherwise prepare the request // m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); - HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); - HttpWebResponse rsp = null; + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); // We are sending just parameters, no content req.ContentLength = 0; // Send request and retrieve the response - rsp = (HttpWebResponse)req.GetResponse(); - - XmlTextReader rdr = new XmlTextReader(rsp.GetResponseStream()); - doc.Load(rdr); - rdr.Close(); + using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse()) + using (Stream s = rsp.GetResponseStream()) + using (XmlTextReader rdr = new XmlTextReader(s)) + doc.Load(rdr); } catch (Exception e) { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 1101851900..71b24aca8c 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -1146,28 +1146,38 @@ namespace Nwc.XmlRpc request.AllowWriteStreamBuffering = true; request.KeepAlive = !_disableKeepAlive; - Stream stream = request.GetRequestStream(); - XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII); - _serializer.Serialize(xml, this); - xml.Flush(); - xml.Close(); + using (Stream stream = request.GetRequestStream()) + { + using (XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII)) + { + _serializer.Serialize(xml, this); + xml.Flush(); + } + } - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - StreamReader input = new StreamReader(response.GetResponseStream()); - - string inputXml = input.ReadToEnd(); XmlRpcResponse resp; - try + + using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { - resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); + using (Stream s = response.GetResponseStream()) + { + using (StreamReader input = new StreamReader(s)) + { + string inputXml = input.ReadToEnd(); + + try + { + resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); + } + catch (Exception e) + { + RequestResponse = inputXml; + throw e; + } + } + } } - catch (Exception e) - { - RequestResponse = inputXml; - throw e; - } - input.Close(); - response.Close(); + return resp; } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 4dff9278f1..8f660c4be5 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -470,7 +470,7 @@ public class BSPrim : BSPhysObject // Note that this does not change _mass! public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) { - if (PhysBody.HasPhysicalBody) + if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape) { if (IsStatic) { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 49718c4e0f..4dc16f4fce 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt @@ -1,5 +1,12 @@ CURRENT PRIORITIES ================================================= +Use the HACD convex hull routine in Bullet rather than the C# version. + Speed up hullifying large meshes. +Enable vehicle border crossings (at least as poorly as ODE) + Terrain skirts + Avatar created in previous region and not new region when crossing border + Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) +Lock axis Deleting a linkset while standing on the root will leave the physical shape of the root behind. Not sure if it is because standing on it. Done with large prim linksets. Vehicle angular vertical attraction @@ -7,16 +14,11 @@ vehicle angular banking Center-of-gravity Vehicle angular deflection Preferred orientation angular correction fix -Enable vehicle border crossings (at least as poorly as ODE) - Terrain skirts - Avatar created in previous region and not new region when crossing border - Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) when should angular and linear motor targets be zeroed? when selected? Need a vehicle.clear()? Or an 'else' in prestep if not physical. Teravus llMoveToTarget script debug Mixing of hover, buoyancy/gravity, moveToTarget, into one force Setting hover height to zero disables hover even if hover flags are on (from SL wiki) -Nebadon vehicles turning funny in arena limitMotorUp calibration (more down?) llRotLookAt llLookAt @@ -66,6 +68,8 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation GENERAL TODO LIST: ================================================= +Resitution of a prim works on another prim but not on terrain. + The dropped prim doesn't bounce properly on the terrain. Add a sanity check for PIDTarget location. Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. Is much saved with lower LODs? At the moment, all set to 32. @@ -163,7 +167,6 @@ Create tests for different interface components Have test objects/scripts measure themselves and turn color if correct/bad Test functions in SL and calibrate correctness there Create auto rezzer and tracker to run through the tests -Use the HACD convex hull routine in Bullet rather than the C# version. Do we need to do convex hulls all the time? Can complex meshes be left meshes? There is some problem with meshes and collisions Hulls are not as detailed as meshes. Hulled vehicles insides are different shape. @@ -334,4 +337,5 @@ Child movement in linkset (don't rebuild linkset) (DONE 20130122)) Avatar standing on a moving object should start to move with the object. (DONE 20130125) Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. Verify that angular motion specified around Z moves in the vehicle coordinates. - DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. \ No newline at end of file + DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. +Nebadon vehicles turning funny in arena (DONE) \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4c6950df63..b67db2008e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10201,6 +10201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero.ToString(); } } + public LSL_String llRequestURL() { m_host.AddScriptLPS(1); diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs index 5c509360d8..5004d99431 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs @@ -73,7 +73,6 @@ namespace OpenSim.Services.Connectors } } - public virtual string Helo() { HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); @@ -82,10 +81,12 @@ namespace OpenSim.Services.Connectors try { - WebResponse response = req.GetResponse(); - if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null - return string.Empty; - return response.Headers.Get("X-Handlers-Provided"); + using (WebResponse response = req.GetResponse()) + { + if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null + return string.Empty; + return response.Headers.Get("X-Handlers-Provided"); + } } catch (Exception e) { @@ -95,6 +96,5 @@ namespace OpenSim.Services.Connectors // fail return string.Empty; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index c542c29f1a..d7e38f1e2f 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -169,41 +169,45 @@ namespace OpenSim.Services.Connectors.Hypergrid // Let's wait for the response //m_log.Info("[USER AGENT CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall"); - WebResponse webResponse = null; - StreamReader sr = null; try { - webResponse = AgentCreateRequest.GetResponse(); - if (webResponse == null) + using (WebResponse webResponse = AgentCreateRequest.GetResponse()) { - m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post"); - } - else - { - - sr = new StreamReader(webResponse.GetResponseStream()); - string response = sr.ReadToEnd().Trim(); - m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); - - if (!String.IsNullOrEmpty(response)) + if (webResponse == null) { - try + m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post"); + } + else + { + using (Stream s = webResponse.GetResponseStream()) { - // we assume we got an OSDMap back - OSDMap r = Util.GetOSDMap(response); - bool success = r["success"].AsBoolean(); - reason = r["reason"].AsString(); - return success; - } - catch (NullReferenceException e) - { - m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message); + using (StreamReader sr = new StreamReader(s)) + { + string response = sr.ReadToEnd().Trim(); + m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); - // check for old style response - if (response.ToLower().StartsWith("true")) - return true; + if (!String.IsNullOrEmpty(response)) + { + try + { + // we assume we got an OSDMap back + OSDMap r = Util.GetOSDMap(response); + bool success = r["success"].AsBoolean(); + reason = r["reason"].AsString(); + return success; + } + catch (NullReferenceException e) + { + m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message); - return false; + // check for old style response + if (response.ToLower().StartsWith("true")) + return true; + + return false; + } + } + } } } } @@ -214,11 +218,6 @@ namespace OpenSim.Services.Connectors.Hypergrid reason = "Destination did not reply"; return false; } - finally - { - if (sr != null) - sr.Close(); - } return true; diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 7688e0fb3a..b36fa23899 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs @@ -168,22 +168,27 @@ namespace OpenSim.Services.Connectors // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); - StreamReader sr = null; try { - WebResponse webResponse = helloNeighbourRequest.GetResponse(); - if (webResponse == null) + using (WebResponse webResponse = helloNeighbourRequest.GetResponse()) { - m_log.DebugFormat( - "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}", - thisRegion.RegionName, region.RegionName); + if (webResponse == null) + { + m_log.DebugFormat( + "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}", + thisRegion.RegionName, region.RegionName); + } + + using (Stream s = webResponse.GetResponseStream()) + { + using (StreamReader sr = new StreamReader(s)) + { + //reply = sr.ReadToEnd().Trim(); + sr.ReadToEnd().Trim(); + //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); + } + } } - - sr = new StreamReader(webResponse.GetResponseStream()); - //reply = sr.ReadToEnd().Trim(); - sr.ReadToEnd().Trim(); - //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); - } catch (Exception e) { @@ -193,11 +198,6 @@ namespace OpenSim.Services.Connectors return false; } - finally - { - if (sr != null) - sr.Close(); - } return true; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 63a32e749a..74b980c17e 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -339,36 +339,38 @@ namespace OpenSim.Services.Connectors.SimianGrid // Simian does not require the asset ID to be in the URL because it's in the post data. // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); - - HttpWebResponse response = MultipartForm.Post(request, postParameters); - using (Stream responseStream = response.GetResponseStream()) - { - string responseStr = null; - try + using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) + { + using (Stream responseStream = response.GetResponseStream()) { - responseStr = responseStream.GetStreamString(); - OSD responseOSD = OSDParser.Deserialize(responseStr); - if (responseOSD.Type == OSDType.Map) + string responseStr = null; + + try { - OSDMap responseMap = (OSDMap)responseOSD; - if (responseMap["Success"].AsBoolean()) - return asset.ID; + responseStr = responseStream.GetStreamString(); + OSD responseOSD = OSDParser.Deserialize(responseStr); + if (responseOSD.Type == OSDType.Map) + { + OSDMap responseMap = (OSDMap)responseOSD; + if (responseMap["Success"].AsBoolean()) + return asset.ID; + else + errorMessage = "Upload failed: " + responseMap["Message"].AsString(); + } else - errorMessage = "Upload failed: " + responseMap["Message"].AsString(); + { + errorMessage = "Response format was invalid:\n" + responseStr; + } } - else + catch (Exception ex) { - errorMessage = "Response format was invalid:\n" + responseStr; + if (!String.IsNullOrEmpty(responseStr)) + errorMessage = "Failed to parse the response:\n" + responseStr; + else + errorMessage = "Failed to retrieve the response: " + ex.Message; } } - catch (Exception ex) - { - if (!String.IsNullOrEmpty(responseStr)) - errorMessage = "Failed to parse the response:\n" + responseStr; - else - errorMessage = "Failed to retrieve the response: " + ex.Message; - } } } catch (WebException ex) @@ -378,6 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); + return null; } diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs index 78bab5b8fe..6a53fe7810 100644 --- a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs +++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs @@ -40,10 +40,33 @@ namespace OpenSim.Tests.Common { public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine { + public IConfigSource ConfigSource { get; private set; } + + public IConfig Config { get; private set; } + private Scene m_scene; + /// + /// Expose posted events to tests. + /// + public Dictionary> PostedEvents { get; private set; } + + /// + /// A very primitive way of hooking text cose to a posed event. + /// + /// + /// May be replaced with something that uses more original code in the future. + /// + public event Action PostEventHook; + public void Initialise(IConfigSource source) { + ConfigSource = source; + + // Can set later on if required + Config = new IniConfig("MockScriptEngine", ConfigSource); + + PostedEvents = new Dictionary>(); } public void Close() @@ -85,7 +108,28 @@ namespace OpenSim.Tests.Common public bool PostScriptEvent(UUID itemID, string name, object[] args) { - return false; +// Console.WriteLine("Posting event {0} for {1}", name, itemID); + + EventParams evParams = new EventParams(name, args, null); + + List eventsForItem; + + if (!PostedEvents.ContainsKey(itemID)) + { + eventsForItem = new List(); + PostedEvents.Add(itemID, eventsForItem); + } + else + { + eventsForItem = PostedEvents[itemID]; + } + + eventsForItem.Add(evParams); + + if (PostEventHook != null) + PostEventHook(itemID, evParams); + + return true; } public bool PostObjectEvent(UUID itemID, string name, object[] args) @@ -195,11 +239,7 @@ namespace OpenSim.Tests.Common public Scene World { get { return m_scene; } } - public IScriptModule ScriptModule { get { throw new System.NotImplementedException(); } } - - public IConfig Config { get { throw new System.NotImplementedException (); } } - - public IConfigSource ConfigSource { get { throw new System.NotImplementedException (); } } + public IScriptModule ScriptModule { get { return this; } } public string ScriptEnginePath { get { throw new System.NotImplementedException (); }} @@ -210,5 +250,10 @@ namespace OpenSim.Tests.Common public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } } public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } } + + public void ClearPostedEvents() + { + PostedEvents.Clear(); + } } } \ No newline at end of file diff --git a/OpenSim/Tests/ConfigurationLoaderTest.cs b/OpenSim/Tests/ConfigurationLoaderTest.cs index e5186ae517..9d63324ff9 100644 --- a/OpenSim/Tests/ConfigurationLoaderTest.cs +++ b/OpenSim/Tests/ConfigurationLoaderTest.cs @@ -47,6 +47,8 @@ namespace OpenSim.Tests [SetUp] public void SetUp() { + base.SetUp(); + m_basePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); string path = Path.Combine(m_basePath, m_testSubdirectory); Directory.CreateDirectory(path); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index cf8b3e1157..9de3862329 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -335,12 +335,19 @@ [Map] ;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true - ;; Map tile options. You can choose to generate normal maptiles or nominate an uploaded texture to - ;; be the map tile using the MaptileStaticUUID parameter in this section or for individual regions in - ;; the regions config file(s). If you do not want to upload map tiles at all, then you will need - ;; to disable the MapImageServiceModule entirely. + ;; Map tile options. + ;; If true, then maptiles are generated using the MapImageModule below. + ;; If false then the texture referenced by MaptileStaticUUID is used instead, which can also be overriden + ;; in individual region config file(s). If you do not want to upload map tiles at all, then you will need + ;; both to set this to false and comment out the [Modules] MapImageServiceModule setting in config-include/ ; GenerateMaptiles = true + ;# {MapImageModule} [] {The map image module to use} {MapImageModule Warp3DImageModule} MapImageModule + ;; The module to use in order to generate map images. + ;; MapImageModule is the default. Warp3DImageModule is an alternative experimental module that can + ;; generate better images. + ;MapImageModule = "MapImageModule" + ;# {MaptileRefresh} {GenerateMaptiles} {Maptile refresh period?} {} 0 ;; If desired, a running region can update the map tiles periodically ;; to reflect building activity. This names no sense of you don't have diff --git a/prebuild.xml b/prebuild.xml index 8296daa37a..cbaa454be6 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2321,7 +2321,6 @@ ../../../../bin/ - @@ -3517,6 +3516,8 @@ + +