mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 18:55:58 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs OpenSim/Region/Framework/Scenes/Scene.cs OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs OpenSim/Region/Framework/Scenes/SceneObjectPart.cs OpenSim/Region/Framework/Scenes/ScenePresence.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs OpenSim/Server/Handlers/Simulation/AgentHandlers.cs OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs OpenSim/Services/HypergridService/UserAgentService.cs
This commit is contained in:
@@ -171,9 +171,10 @@ namespace OpenSim.Framework
|
||||
/// Soon to be decommissioned
|
||||
/// </summary>
|
||||
/// <param name="cAgent"></param>
|
||||
public void CopyFrom(ChildAgentDataUpdate cAgent)
|
||||
public void CopyFrom(ChildAgentDataUpdate cAgent, UUID sid)
|
||||
{
|
||||
AgentID = new UUID(cAgent.AgentID);
|
||||
SessionID = sid;
|
||||
|
||||
// next: ???
|
||||
Size = new Vector3();
|
||||
|
||||
@@ -33,12 +33,13 @@ namespace OpenSim.Framework
|
||||
{
|
||||
public class ClientInfo
|
||||
{
|
||||
public AgentCircuitData agentcircuit;
|
||||
public readonly DateTime StartedTime = DateTime.Now;
|
||||
public AgentCircuitData agentcircuit = null;
|
||||
|
||||
public Dictionary<uint, byte[]> needAck;
|
||||
|
||||
public List<byte[]> out_packets;
|
||||
public Dictionary<uint, uint> pendingAcks;
|
||||
public List<byte[]> out_packets = new List<byte[]>();
|
||||
public Dictionary<uint, uint> pendingAcks = new Dictionary<uint,uint>();
|
||||
public EndPoint proxyEP;
|
||||
|
||||
public uint sequence;
|
||||
@@ -53,5 +54,9 @@ namespace OpenSim.Framework
|
||||
public int assetThrottle;
|
||||
public int textureThrottle;
|
||||
public int totalThrottle;
|
||||
|
||||
public Dictionary<string, int> SyncRequests = new Dictionary<string,int>();
|
||||
public Dictionary<string, int> AsyncRequests = new Dictionary<string,int>();
|
||||
public Dictionary<string, int> GenericRequests = new Dictionary<string,int>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,10 +132,6 @@ namespace OpenSim.Framework
|
||||
{
|
||||
List<string> keysToRemove = null;
|
||||
|
||||
// Hard-coded special case that needs to be removed in the future. Normally, modules themselves should
|
||||
// handle reading data from old locations
|
||||
bool osMaterialsMigrationRequired = false;
|
||||
|
||||
OSDMap namespacesMap = daMap.m_map;
|
||||
|
||||
foreach (string key in namespacesMap.Keys)
|
||||
|
||||
@@ -224,5 +224,26 @@ public class CounterStat : Stat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CounterStat is a basic stat plus histograms
|
||||
public override OSDMap ToOSDMap()
|
||||
{
|
||||
// Get the foundational instance
|
||||
OSDMap map = base.ToOSDMap();
|
||||
|
||||
map["StatType"] = "CounterStat";
|
||||
|
||||
// If there are any histograms, add a new field that is an array of histograms as OSDMaps
|
||||
if (m_histograms.Count > 0)
|
||||
{
|
||||
OSDArray histos = new OSDArray();
|
||||
foreach (EventHistogram histo in m_histograms.Values)
|
||||
{
|
||||
histos.Add(histo.GetHistogramAsOSDMap());
|
||||
}
|
||||
map.Add("Histograms", histos);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +242,7 @@ namespace OpenSim.Framework.Monitoring
|
||||
ret.Add("Description", OSD.FromString(Description));
|
||||
ret.Add("UnitName", OSD.FromString(UnitName));
|
||||
ret.Add("Value", OSD.FromReal(Value));
|
||||
ret.Add("StatType", "Stat"); // used by overloading classes to denote type of stat
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
/// <summary>
|
||||
@@ -168,6 +170,70 @@ namespace OpenSim.Framework.Monitoring
|
||||
}
|
||||
}
|
||||
|
||||
// Creates an OSDMap of the format:
|
||||
// { categoryName: {
|
||||
// containerName: {
|
||||
// statName: {
|
||||
// "Name": name,
|
||||
// "ShortName": shortName,
|
||||
// ...
|
||||
// },
|
||||
// statName: {
|
||||
// "Name": name,
|
||||
// "ShortName": shortName,
|
||||
// ...
|
||||
// },
|
||||
// ...
|
||||
// },
|
||||
// containerName: {
|
||||
// ...
|
||||
// },
|
||||
// ...
|
||||
// },
|
||||
// categoryName: {
|
||||
// ...
|
||||
// },
|
||||
// ...
|
||||
// }
|
||||
// The passed in parameters will filter the categories, containers and stats returned. If any of the
|
||||
// parameters are either EmptyOrNull or the AllSubCommand value, all of that type will be returned.
|
||||
// Case matters.
|
||||
public static OSDMap GetStatsAsOSDMap(string pCategoryName, string pContainerName, string pStatName)
|
||||
{
|
||||
OSDMap map = new OSDMap();
|
||||
|
||||
foreach (string catName in RegisteredStats.Keys)
|
||||
{
|
||||
// Do this category if null spec, "all" subcommand or category name matches passed parameter.
|
||||
// Skip category if none of the above.
|
||||
if (!(String.IsNullOrEmpty(pCategoryName) || pCategoryName == AllSubCommand || pCategoryName == catName))
|
||||
continue;
|
||||
|
||||
OSDMap contMap = new OSDMap();
|
||||
foreach (string contName in RegisteredStats[catName].Keys)
|
||||
{
|
||||
if (!(string.IsNullOrEmpty(pContainerName) || pContainerName == AllSubCommand || pContainerName == contName))
|
||||
continue;
|
||||
|
||||
OSDMap statMap = new OSDMap();
|
||||
|
||||
SortedDictionary<string, Stat> theStats = RegisteredStats[catName][contName];
|
||||
foreach (string statName in theStats.Keys)
|
||||
{
|
||||
if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName))
|
||||
continue;
|
||||
|
||||
statMap.Add(statName, theStats[statName].ToOSDMap());
|
||||
}
|
||||
|
||||
contMap.Add(contName, statMap);
|
||||
}
|
||||
map.Add(catName, contMap);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// Start collecting statistics related to assets.
|
||||
// /// Should only be called once.
|
||||
|
||||
@@ -689,7 +689,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
if (buffer != null)
|
||||
{
|
||||
if (!response.SendChunked)
|
||||
if (!response.SendChunked && response.ContentLength64 <= 0)
|
||||
response.ContentLength64 = buffer.LongLength;
|
||||
|
||||
response.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Base handler for writing to an output stream
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Inheriting classes should override ProcessRequest() rather than Handle()
|
||||
/// </remarks>
|
||||
public abstract class BaseOutputStreamHandler : BaseRequestHandler, IRequestHandler
|
||||
{
|
||||
protected BaseOutputStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {}
|
||||
|
||||
protected BaseOutputStreamHandler(string httpMethod, string path, string name, string description)
|
||||
: base(httpMethod, path, name, description) {}
|
||||
|
||||
public virtual void Handle(
|
||||
string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
RequestsReceived++;
|
||||
|
||||
ProcessRequest(path, request, response, httpRequest, httpResponse);
|
||||
|
||||
RequestsHandled++;
|
||||
}
|
||||
|
||||
protected virtual void ProcessRequest(
|
||||
string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public abstract class BaseRequestHandler
|
||||
{
|
||||
public int RequestsReceived { get; protected set; }
|
||||
|
||||
public int RequestsHandled { get; protected set; }
|
||||
|
||||
public virtual string ContentType
|
||||
{
|
||||
get { return "application/xml"; }
|
||||
|
||||
@@ -29,14 +29,35 @@ using System.IO;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Base streamed request handler.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Inheriting classes should override ProcessRequest() rather than Handle()
|
||||
/// </remarks>
|
||||
public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler
|
||||
{
|
||||
public abstract byte[] Handle(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {}
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path, string name, string description)
|
||||
: base(httpMethod, path, name, description) {}
|
||||
|
||||
public virtual byte[] Handle(
|
||||
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
RequestsReceived++;
|
||||
|
||||
byte[] result = ProcessRequest(path, request, httpRequest, httpResponse);
|
||||
|
||||
RequestsHandled++;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected virtual byte[] ProcessRequest(
|
||||
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
m_method = binaryMethod;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
byte[] data = ReadFully(request);
|
||||
string param = GetParam(path);
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public interface IRequestHandler
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Name for this handler.
|
||||
/// </summary>
|
||||
@@ -59,6 +58,19 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
// Return path
|
||||
string Path { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of requests received by this handler
|
||||
/// </summary>
|
||||
int RequestsReceived { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of requests handled.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Should be equal to RequestsReceived unless requested are being handled slowly or there is deadlock.
|
||||
/// </remarks>
|
||||
int RequestsHandled { get; }
|
||||
}
|
||||
|
||||
public interface IStreamedRequestHandler : IRequestHandler
|
||||
@@ -69,7 +81,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
public interface IStreamHandler : IRequestHandler
|
||||
{
|
||||
// Handle request stream, return byte array
|
||||
void Handle(string path, Stream request, Stream response, IOSHttpRequest httpReqbuest, IOSHttpResponse httpResponse);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public delegate TResponse RestDeserialiseMethod<TRequest, TResponse>(TRequest request);
|
||||
|
||||
public class RestDeserialiseHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler
|
||||
public class RestDeserialiseHandler<TRequest, TResponse> : BaseOutputStreamHandler, IStreamHandler
|
||||
where TRequest : new()
|
||||
{
|
||||
private RestDeserialiseMethod<TRequest, TResponse> m_method;
|
||||
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
m_method = method;
|
||||
}
|
||||
|
||||
public void Handle(string path, Stream request, Stream responseStream,
|
||||
protected override void ProcessRequest(string path, Stream request, Stream responseStream,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
TRequest deserial;
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
public delegate bool CheckIdentityMethod(string sid, string aid);
|
||||
|
||||
public class RestDeserialiseSecureHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler
|
||||
public class RestDeserialiseSecureHandler<TRequest, TResponse> : BaseOutputStreamHandler, IStreamHandler
|
||||
where TRequest : new()
|
||||
{
|
||||
private static readonly ILog m_log
|
||||
@@ -201,7 +201,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
m_method = method;
|
||||
}
|
||||
|
||||
public void Handle(string path, Stream request, Stream responseStream,
|
||||
protected override void ProcessRequest(string path, Stream request, Stream responseStream,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
RestSessionObject<TRequest> deserial = default(RestSessionObject<TRequest>);
|
||||
@@ -237,7 +237,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
public delegate bool CheckTrustedSourceMethod(IPEndPoint peer);
|
||||
|
||||
public class RestDeserialiseTrustedHandler<TRequest, TResponse> : BaseRequestHandler, IStreamHandler
|
||||
public class RestDeserialiseTrustedHandler<TRequest, TResponse> : BaseOutputStreamHandler, IStreamHandler
|
||||
where TRequest : new()
|
||||
{
|
||||
private static readonly ILog m_log
|
||||
@@ -260,7 +260,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
m_method = method;
|
||||
}
|
||||
|
||||
public void Handle(string path, Stream request, Stream responseStream,
|
||||
protected override void ProcessRequest(string path, Stream request, Stream responseStream,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
TRequest deserial = default(TRequest);
|
||||
@@ -292,6 +292,5 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
serializer.Serialize(xmlWriter, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
m_restMethod = restMethod;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
Encoding encoding = Encoding.UTF8;
|
||||
StreamReader streamReader = new StreamReader(request, encoding);
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace OpenSim.Framework.Tests
|
||||
cadu.AVHeight = Size1.Z;
|
||||
|
||||
AgentPosition position2 = new AgentPosition();
|
||||
position2.CopyFrom(cadu);
|
||||
position2.CopyFrom(cadu, position1.SessionID);
|
||||
|
||||
Assert.IsTrue(
|
||||
position2.AgentID == position1.AgentID
|
||||
|
||||
@@ -141,6 +141,11 @@ namespace OpenSim.Framework
|
||||
public static FireAndForgetMethod DefaultFireAndForgetMethod = FireAndForgetMethod.SmartThreadPool;
|
||||
public static FireAndForgetMethod FireAndForgetMethod = DefaultFireAndForgetMethod;
|
||||
|
||||
public static bool IsPlatformMono
|
||||
{
|
||||
get { return Type.GetType("Mono.Runtime") != null; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the directory where the current running executable
|
||||
/// is located
|
||||
@@ -1338,7 +1343,7 @@ namespace OpenSim.Framework
|
||||
ru = "OSX/Mono";
|
||||
else
|
||||
{
|
||||
if (Type.GetType("Mono.Runtime") != null)
|
||||
if (IsPlatformMono)
|
||||
ru = "Win/Mono";
|
||||
else
|
||||
ru = "Win/.NET";
|
||||
|
||||
Reference in New Issue
Block a user