Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

cpu-performance
Diva Canto 2013-07-09 14:13:51 -07:00
commit d0dfb744b2
62 changed files with 711 additions and 343 deletions

View File

@ -485,7 +485,7 @@ namespace OpenSim.Groups
return;
//// 16 bytes are the UUID. Maybe.
UUID folderID = new UUID(im.binaryBucket, 0);
// UUID folderID = new UUID(im.binaryBucket, 0);
UUID noticeID = new UUID(im.imSessionID);
GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteClient.AgentId.ToString(), noticeID);

View File

@ -543,7 +543,6 @@ namespace OpenSim.Groups
List<string> urls = new List<string>();
foreach (GroupMembersData m in members)
{
UUID userID = UUID.Zero;
if (!m_UserManagement.IsLocalGridUser(m.AgentID))
{
string gURL = m_UserManagement.GetUserServerURL(m.AgentID, "GroupsServerURI");

View File

@ -47,7 +47,6 @@ namespace OpenSim.Groups
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private HGGroupsService m_GroupsService;
private string m_HomeURI = string.Empty;
private string m_ConfigName = "Groups";
// Called by Robust shell
@ -113,7 +112,7 @@ namespace OpenSim.Groups
m_GroupsService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
@ -209,7 +208,6 @@ namespace OpenSim.Groups
UUID groupID = new UUID(request["GroupID"].ToString());
string agentID = request["AgentID"].ToString();
string token = request["AccessToken"].ToString();
string reason = string.Empty;
m_GroupsService.RemoveAgentFromGroup(agentID, agentID, groupID, token);
}

View File

@ -75,7 +75,7 @@ namespace OpenSim.Groups
m_GroupsService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
@ -269,7 +269,6 @@ namespace OpenSim.Groups
UUID groupID = new UUID(request["GroupID"].ToString());
string agentID = request["AgentID"].ToString();
string requestingAgentID = request["RequestingAgentID"].ToString();
string reason = string.Empty;
m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID);
}
@ -500,7 +499,6 @@ namespace OpenSim.Groups
else
{
string op = request["OP"].ToString();
string reason = string.Empty;
bool success = false;
if (op == "ADD")
@ -568,7 +566,6 @@ namespace OpenSim.Groups
else
{
string op = request["OP"].ToString();
string reason = string.Empty;
if (op == "GROUP")
{
@ -631,7 +628,6 @@ namespace OpenSim.Groups
else
{
string op = request["OP"].ToString();
string reason = string.Empty;
if (op == "ADD" && request.ContainsKey("GroupID") && request.ContainsKey("RoleID") && request.ContainsKey("AgentID"))
{

View File

@ -75,7 +75,7 @@ namespace OpenSim.OfflineIM
m_OfflineIMService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -143,8 +143,8 @@ namespace OpenSim.Framework.Capabilities
/// <param name="handler"></param>
public void RegisterHandler(string capName, IRequestHandler handler)
{
m_capsHandlers[capName] = handler;
//m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
m_capsHandlers[capName] = handler;
}
/// <summary>

View File

@ -39,7 +39,7 @@ namespace OpenSim.Framework.Capabilities
/// </summary>
public class CapsHandlers
{
private Dictionary <string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>();
private Dictionary<string, IRequestHandler> m_capsHandlers = new Dictionary<string, IRequestHandler>();
private IHttpServer m_httpListener;
private string m_httpListenerHostName;
private uint m_httpListenerPort;
@ -184,5 +184,17 @@ namespace OpenSim.Framework.Capabilities
return caps;
}
/// <summary>
/// Returns a copy of the dictionary of all the HTTP cap handlers
/// </summary>
/// <returns>
/// The dictionary copy. The key is the capability name, the value is the HTTP handler.
/// </returns>
public Dictionary<string, IRequestHandler> GetCapsHandlers()
{
lock (m_capsHandlers)
return new Dictionary<string, IRequestHandler>(m_capsHandlers);
}
}
}
}

View File

@ -56,7 +56,7 @@ namespace OpenSim.Capabilities.Handlers
m_PeopleService = peopleService;
}
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Try to parse the texture ID from the request URL
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);

View File

@ -64,7 +64,7 @@ namespace OpenSim.Capabilities.Handlers
m_assetService = assService;
}
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Try to parse the texture ID from the request URL
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);

View File

@ -48,7 +48,7 @@ namespace OpenSim.Framework.Capabilities
m_method = method;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
//Encoding encoding = Util.UTF8;

View File

@ -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)

View File

@ -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)
{
}
}
}

View File

@ -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"; }

View File

@ -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;
}
}
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}
}
}
}
}
}

View File

@ -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);

View File

@ -766,7 +766,7 @@ namespace OpenSim
{
public SimStatusHandler() : base("GET", "/simstatus", "SimStatus", "Simulator Status") {}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
return Util.UTF8.GetBytes("OK");
@ -792,7 +792,7 @@ namespace OpenSim
m_opensim = sim;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
@ -810,7 +810,7 @@ namespace OpenSim
/// If the request contains a key, "callback" the response will be wrappend in the
/// associated value for jsonp used with ajax/javascript
/// </summary>
public class UXSimStatusHandler : BaseStreamHandler
protected class UXSimStatusHandler : BaseStreamHandler
{
OpenSimBase m_opensim;
@ -820,7 +820,7 @@ namespace OpenSim
m_opensim = sim;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));

View File

@ -207,9 +207,15 @@ namespace OpenSim.Region.ClientStack.Linden
m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData);
IRequestHandler getObjectPhysicsDataHandler
= new RestStreamHandler(
"POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null);
m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler("POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation);
IRequestHandler UpdateAgentInformationHandler
= new RestStreamHandler(
"POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation, "UpdateAgentInformation", null);
m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler);
m_HostCapsObj.RegisterHandler(

View File

@ -366,7 +366,8 @@ namespace OpenSim.Region.ClientStack.Linden
// EventQueueGet when it receive capability information, but then we replace the rest handler immediately
// afterwards with the poll service. So for now, we'll pass a null instead to simplify code reading, but
// really it should be possible to directly register the poll handler as a capability.
caps.RegisterHandler("EventQueueGet", new RestHTTPHandler("POST", eventQueueGetPath, null));
caps.RegisterHandler(
"EventQueueGet", new RestHTTPHandler("POST", eventQueueGetPath, null, "EventQueueGet", null));
// delegate(Hashtable m_dhttpMethod)
// {
// return ProcessQueue(m_dhttpMethod, agentID, caps);

View File

@ -176,7 +176,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_isGod = m_scene.Permissions.IsGod(agentID);
}
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader reader = new StreamReader(request);
string message = reader.ReadToEnd();

View File

@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
m_FriendsModule = fmodule;
}
public override byte[] Handle(
protected override byte[] ProcessRequest(
string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -122,9 +122,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
{
string uri = "/CAPS/" + UUID.Random();
caps.RegisterHandler("UntrustedSimulatorMessage",
new RestStreamHandler("POST", uri,
HandleUntrustedSimulatorMessage));
caps.RegisterHandler(
"UntrustedSimulatorMessage",
new RestStreamHandler("POST", uri, HandleUntrustedSimulatorMessage, "UntrustedSimulatorMessage", null));
}
private string HandleUntrustedSimulatorMessage(string request,

View File

@ -304,7 +304,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
}
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(targetID, out serverURI);
// bool foreign = GetUserProfileServerURI(targetID, out serverURI);
UUID creatorId = UUID.Zero;
OSDMap parameters= new OSDMap();
@ -369,7 +369,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
}
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(target, out serverURI);
// bool foreign = GetUserProfileServerURI(target, out serverURI);
object Ad = (object)ad;
if(!JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString()))
@ -438,10 +438,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
Vector3 pos = remoteClient.SceneAgent.AbsolutePosition;
ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);
ScenePresence p = FindPresence(remoteClient.AgentId);
Vector3 avaPos = p.AbsolutePosition;
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
// bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
if (land == null)
{
@ -488,7 +487,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
public void ClassifiedDelete(UUID queryClassifiedID, IClientAPI remoteClient)
{
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
// bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
UUID classifiedId;
OSDMap parameters= new OSDMap();
@ -538,7 +537,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
}
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(targetId, out serverURI);
// bool foreign = GetUserProfileServerURI(targetId, out serverURI);
OSDMap parameters= new OSDMap();
parameters.Add("creatorId", OSD.FromUUID(targetId));
@ -589,7 +588,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
UUID targetID;
UUID.TryParse(args[0], out targetID);
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(targetID, out serverURI);
// bool foreign = GetUserProfileServerURI(targetID, out serverURI);
IClientAPI remoteClient = (IClientAPI)sender;
UserProfilePick pick = new UserProfilePick();
@ -657,7 +656,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString());
UserProfilePick pick = new UserProfilePick();
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
// bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
ScenePresence p = FindPresence(remoteClient.AgentId);
Vector3 avaPos = p.AbsolutePosition;
@ -717,7 +716,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
public void PickDelete(IClientAPI remoteClient, UUID queryPickID)
{
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
// bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
OSDMap parameters= new OSDMap();
parameters.Add("pickId", OSD.FromUUID(queryPickID));
@ -752,7 +751,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
IClientAPI remoteClient = (IClientAPI)sender;
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
// bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
note.TargetId = remoteClient.AgentId;
UUID.TryParse(args[0], out note.UserId);
@ -788,7 +787,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
note.Notes = queryNotes;
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
// bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
object Note = note;
if(!JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString()))
@ -833,7 +832,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
prop.Language = languages;
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
// bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
object Param = prop;
if(!JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString()))
@ -955,7 +954,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
prop.FirstLifeText = newProfile.FirstLifeAboutText;
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
// bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
object Prop = prop;
@ -994,7 +993,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
}
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(properties.UserId, out serverURI);
// bool foreign = GetUserProfileServerURI(properties.UserId, out serverURI);
// This is checking a friend on the home grid
// Not HG friend
@ -1247,7 +1246,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
return false;
}
byte[] buf = new byte[8192];
Stream rstream = webResponse.GetResponseStream();
OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream);
@ -1313,7 +1311,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
return false;
}
byte[] buf = new byte[8192];
Stream rstream = webResponse.GetResponseStream();
OSDMap response = new OSDMap();

View File

@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using log4net;
@ -37,6 +38,7 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using Caps=OpenSim.Framework.Capabilities.Caps;
@ -57,8 +59,9 @@ namespace OpenSim.Region.CoreModules.Framework
/// </summary>
protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>();
protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>();
protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds
protected Dictionary<UUID, string> m_capsPaths = new Dictionary<UUID, string>();
protected Dictionary<UUID, Dictionary<ulong, string>> m_childrenSeeds
= new Dictionary<UUID, Dictionary<ulong, string>>();
public void Initialise(IConfigSource source)
@ -70,9 +73,24 @@ namespace OpenSim.Region.CoreModules.Framework
m_scene = scene;
m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
MainConsole.Instance.Commands.AddCommand("Comms", false, "show caps",
"show caps",
"Shows all registered capabilities for users", HandleShowCapsCommand);
MainConsole.Instance.Commands.AddCommand(
"Comms", false, "show caps list",
"show caps list",
"Shows list of registered capabilities for users.", HandleShowCapsListCommand);
MainConsole.Instance.Commands.AddCommand(
"Comms", false, "show caps stats by user",
"show caps stats [<first-name> <last-name>]",
"Shows statistics on capabilities use by user.",
"If a user name is given, then prints a detailed breakdown of caps use ordered by number of requests received.",
HandleShowCapsStatsByUserCommand);
MainConsole.Instance.Commands.AddCommand(
"Comms", false, "show caps stats by cap",
"show caps stats by cap [<cap-name>]",
"Shows statistics on capabilities use by capability.",
"If a capability name is given, then prints a detailed breakdown of use by each user.",
HandleShowCapsStatsByCapCommand);
}
public void RegionLoaded(Scene scene)
@ -105,35 +123,42 @@ namespace OpenSim.Region.CoreModules.Framework
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId))
return;
Caps caps;
String capsObjectPath = GetCapsPath(agentId);
if (m_capsObjects.ContainsKey(agentId))
lock (m_capsObjects)
{
Caps oldCaps = m_capsObjects[agentId];
m_log.DebugFormat(
"[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ",
agentId, oldCaps.CapsObjectPath, capsObjectPath);
// This should not happen. The caller code is confused. We need to fix that.
// CAPs can never be reregistered, or the client will be confused.
// Hence this return here.
//return;
if (m_capsObjects.ContainsKey(agentId))
{
Caps oldCaps = m_capsObjects[agentId];
m_log.DebugFormat(
"[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ",
agentId, oldCaps.CapsObjectPath, capsObjectPath);
// This should not happen. The caller code is confused. We need to fix that.
// CAPs can never be reregistered, or the client will be confused.
// Hence this return here.
//return;
}
caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
(MainServer.Instance == null) ? 0: MainServer.Instance.Port,
capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
m_capsObjects[agentId] = caps;
}
Caps caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
(MainServer.Instance == null) ? 0: MainServer.Instance.Port,
capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
m_capsObjects[agentId] = caps;
m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
}
public void RemoveCaps(UUID agentId)
{
if (childrenSeeds.ContainsKey(agentId))
lock (m_childrenSeeds)
{
childrenSeeds.Remove(agentId);
if (m_childrenSeeds.ContainsKey(agentId))
{
m_childrenSeeds.Remove(agentId);
}
}
lock (m_capsObjects)
@ -168,16 +193,22 @@ namespace OpenSim.Region.CoreModules.Framework
public void SetAgentCapsSeeds(AgentCircuitData agent)
{
capsPaths[agent.AgentID] = agent.CapsPath;
childrenSeeds[agent.AgentID]
= ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
lock (m_capsPaths)
m_capsPaths[agent.AgentID] = agent.CapsPath;
lock (m_childrenSeeds)
m_childrenSeeds[agent.AgentID]
= ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
}
public string GetCapsPath(UUID agentId)
{
if (capsPaths.ContainsKey(agentId))
lock (m_capsPaths)
{
return capsPaths[agentId];
if (m_capsPaths.ContainsKey(agentId))
{
return m_capsPaths[agentId];
}
}
return null;
@ -186,17 +217,24 @@ namespace OpenSim.Region.CoreModules.Framework
public Dictionary<ulong, string> GetChildrenSeeds(UUID agentID)
{
Dictionary<ulong, string> seeds = null;
if (childrenSeeds.TryGetValue(agentID, out seeds))
return seeds;
lock (m_childrenSeeds)
if (m_childrenSeeds.TryGetValue(agentID, out seeds))
return seeds;
return new Dictionary<ulong, string>();
}
public void DropChildSeed(UUID agentID, ulong handle)
{
Dictionary<ulong, string> seeds;
if (childrenSeeds.TryGetValue(agentID, out seeds))
lock (m_childrenSeeds)
{
seeds.Remove(handle);
if (m_childrenSeeds.TryGetValue(agentID, out seeds))
{
seeds.Remove(handle);
}
}
}
@ -204,53 +242,275 @@ namespace OpenSim.Region.CoreModules.Framework
{
Dictionary<ulong, string> seeds;
string returnval;
if (childrenSeeds.TryGetValue(agentID, out seeds))
lock (m_childrenSeeds)
{
if (seeds.TryGetValue(handle, out returnval))
return returnval;
if (m_childrenSeeds.TryGetValue(agentID, out seeds))
{
if (seeds.TryGetValue(handle, out returnval))
return returnval;
}
}
return null;
}
public void SetChildrenSeed(UUID agentID, Dictionary<ulong, string> seeds)
{
//m_log.DebugFormat(" !!! Setting child seeds in {0} to {1}", m_scene.RegionInfo.RegionName, seeds.Count);
childrenSeeds[agentID] = seeds;
lock (m_childrenSeeds)
m_childrenSeeds[agentID] = seeds;
}
public void DumpChildrenSeeds(UUID agentID)
{
m_log.Info("================ ChildrenSeed "+m_scene.RegionInfo.RegionName+" ================");
foreach (KeyValuePair<ulong, string> kvp in childrenSeeds[agentID])
lock (m_childrenSeeds)
{
uint x, y;
Utils.LongToUInts(kvp.Key, out x, out y);
x = x / Constants.RegionSize;
y = y / Constants.RegionSize;
m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
foreach (KeyValuePair<ulong, string> kvp in m_childrenSeeds[agentID])
{
uint x, y;
Utils.LongToUInts(kvp.Key, out x, out y);
x = x / Constants.RegionSize;
y = y / Constants.RegionSize;
m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
}
}
}
private void HandleShowCapsCommand(string module, string[] cmdparams)
private void HandleShowCapsListCommand(string module, string[] cmdParams)
{
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
return;
StringBuilder caps = new StringBuilder();
caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects)
lock (m_capsObjects)
{
caps.AppendFormat("** User {0}:\n", kvp.Key);
for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext(); )
foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects)
{
Uri uri = new Uri(kvp2.Value.ToString());
caps.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery);
}
caps.AppendFormat("** User {0}:\n", kvp.Key);
foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers)
caps.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value);
for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext(); )
{
Uri uri = new Uri(kvp2.Value.ToString());
caps.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery);
}
foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers)
caps.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value);
}
}
MainConsole.Instance.Output(caps.ToString());
}
private void HandleShowCapsStatsByCapCommand(string module, string[] cmdParams)
{
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
return;
if (cmdParams.Length != 5 && cmdParams.Length != 6)
{
MainConsole.Instance.Output("Usage: show caps stats by cap [<cap-name>]");
return;
}
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Region {0}:\n", m_scene.Name);
if (cmdParams.Length == 5)
{
BuildSummaryStatsByCapReport(sb);
}
else if (cmdParams.Length == 6)
{
BuildDetailedStatsByCapReport(sb, cmdParams[5]);
}
MainConsole.Instance.Output(sb.ToString());
}
private void BuildDetailedStatsByCapReport(StringBuilder sb, string capName)
{
sb.AppendFormat("Capability name {0}\n", capName);
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("User Name", 34);
cdt.AddColumn("Req Received", 12);
cdt.AddColumn("Req Handled", 12);
cdt.Indent = 2;
Dictionary<string, int> receivedStats = new Dictionary<string, int>();
Dictionary<string, int> handledStats = new Dictionary<string, int>();
m_scene.ForEachScenePresence(
sp =>
{
Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
if (caps == null)
return;
Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
IRequestHandler reqHandler;
if (capsHandlers.TryGetValue(capName, out reqHandler))
{
receivedStats[sp.Name] = reqHandler.RequestsReceived;
handledStats[sp.Name] = reqHandler.RequestsHandled;
}
}
);
foreach (KeyValuePair<string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
{
cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
}
sb.Append(cdt.ToString());
}
private void BuildSummaryStatsByCapReport(StringBuilder sb)
{
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("Name", 34);
cdt.AddColumn("Req Received", 12);
cdt.AddColumn("Req Handled", 12);
cdt.Indent = 2;
Dictionary<string, int> receivedStats = new Dictionary<string, int>();
Dictionary<string, int> handledStats = new Dictionary<string, int>();
m_scene.ForEachScenePresence(
sp =>
{
Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
if (caps == null)
return;
Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
foreach (IRequestHandler reqHandler in capsHandlers.Values)
{
string reqName = reqHandler.Name ?? "";
if (!receivedStats.ContainsKey(reqName))
{
receivedStats[reqName] = reqHandler.RequestsReceived;
handledStats[reqName] = reqHandler.RequestsHandled;
}
else
{
receivedStats[reqName] += reqHandler.RequestsReceived;
handledStats[reqName] += reqHandler.RequestsHandled;
}
}
}
);
foreach (KeyValuePair<string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
sb.Append(cdt.ToString());
}
private void HandleShowCapsStatsByUserCommand(string module, string[] cmdParams)
{
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
return;
if (cmdParams.Length != 5 && cmdParams.Length != 7)
{
MainConsole.Instance.Output("Usage: show caps stats by user [<first-name> <last-name>]");
return;
}
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Region {0}:\n", m_scene.Name);
if (cmdParams.Length == 5)
{
BuildSummaryStatsByUserReport(sb);
}
else if (cmdParams.Length == 7)
{
string firstName = cmdParams[5];
string lastName = cmdParams[6];
ScenePresence sp = m_scene.GetScenePresence(firstName, lastName);
if (sp == null)
return;
BuildDetailedStatsByUserReport(sb, sp);
}
MainConsole.Instance.Output(sb.ToString());
}
private void BuildDetailedStatsByUserReport(StringBuilder sb, ScenePresence sp)
{
sb.AppendFormat("Avatar name {0}, type {1}\n", sp.Name, sp.IsChildAgent ? "child" : "root");
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("Cap Name", 34);
cdt.AddColumn("Req Received", 12);
cdt.AddColumn("Req Handled", 12);
cdt.Indent = 2;
Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
if (caps == null)
return;
Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
foreach (IRequestHandler reqHandler in capsHandlers.Values.OrderByDescending(rh => rh.RequestsReceived))
{
cdt.AddRow(reqHandler.Name, reqHandler.RequestsReceived, reqHandler.RequestsHandled);
}
sb.Append(cdt.ToString());
}
private void BuildSummaryStatsByUserReport(StringBuilder sb)
{
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("Name", 32);
cdt.AddColumn("Type", 5);
cdt.AddColumn("Req Received", 12);
cdt.AddColumn("Req Handled", 12);
cdt.Indent = 2;
m_scene.ForEachScenePresence(
sp =>
{
Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
if (caps == null)
return;
Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
int totalRequestsReceived = 0;
int totalRequestsHandled = 0;
foreach (IRequestHandler reqHandler in capsHandlers.Values)
{
totalRequestsReceived += reqHandler.RequestsReceived;
totalRequestsHandled += reqHandler.RequestsHandled;
}
cdt.AddRow(sp.Name, sp.IsChildAgent ? "child" : "root", totalRequestsReceived, totalRequestsHandled);
}
);
sb.Append(cdt.ToString());
}
}
}
}

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_EstateModule = fmodule;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -55,7 +55,6 @@ namespace OpenSim.Region.Framework.Scenes
private object m_lockObject = new object();
private object m_timerLock = new object();
private const double m_tickDuration = 50.0;
private Scene m_scene;
public double TickDuration
{
@ -69,8 +68,6 @@ namespace OpenSim.Region.Framework.Scenes
m_timer.AutoReset = true;
m_timer.Elapsed += OnTimer;
m_scene = scene;
m_timer.Start();
}
@ -94,13 +91,13 @@ namespace OpenSim.Region.Framework.Scenes
{
m.OnTimer(TickDuration);
}
catch (Exception inner)
catch (Exception)
{
// Don't stop processing
}
}
}
catch (Exception e)
catch (Exception)
{
// Keep running no matter what
}
@ -157,7 +154,7 @@ namespace OpenSim.Region.Framework.Scenes
[Serializable]
public class KeyframeMotion
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public enum PlayMode : int
{

View File

@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Scenes
osXStatsURI = Util.SHA1Hash(regionInfo.osSecret);
}
public override byte[] Handle(
protected override byte[] ProcessRequest(
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
return Util.UTF8.GetBytes(Report());

View File

@ -354,8 +354,6 @@ namespace OpenSim.Region.Framework.Scenes
private UUID m_collisionSound;
private float m_collisionSoundVolume;
private KeyframeMotion m_keyframeMotion = null;
public KeyframeMotion KeyframeMotion
{
get; set;

View File

@ -139,18 +139,21 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
{
string capsBase = "/CAPS/" + caps.CapsObjectPath;
IRequestHandler renderMaterialsPostHandler = new RestStreamHandler("POST", capsBase + "/", RenderMaterialsPostCap);
caps.RegisterHandler("RenderMaterials", renderMaterialsPostHandler);
IRequestHandler renderMaterialsPostHandler
= new RestStreamHandler("POST", capsBase + "/", RenderMaterialsPostCap, "RenderMaterialsPost", null);
caps.RegisterHandler("RenderMaterialsPost", renderMaterialsPostHandler);
// OpenSimulator CAPs infrastructure seems to be somewhat hostile towards any CAP that requires both GET
// and POST handlers, (at least at the time this was originally written), so we first set up a POST
// handler normally and then add a GET handler via MainServer
IRequestHandler renderMaterialsGetHandler = new RestStreamHandler("GET", capsBase + "/", RenderMaterialsGetCap);
IRequestHandler renderMaterialsGetHandler
= new RestStreamHandler("GET", capsBase + "/", RenderMaterialsGetCap, "RenderMaterialsGet", null);
MainServer.Instance.AddStreamHandler(renderMaterialsGetHandler);
// materials viewer seems to use either POST or PUT, so assign POST handler for PUT as well
IRequestHandler renderMaterialsPutHandler = new RestStreamHandler("PUT", capsBase + "/", RenderMaterialsPostCap);
IRequestHandler renderMaterialsPutHandler
= new RestStreamHandler("PUT", capsBase + "/", RenderMaterialsPostCap, "RenderMaterialsPut", null);
MainServer.Instance.AddStreamHandler(renderMaterialsPutHandler);
}
@ -394,7 +397,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
m_log.Debug("[MaterialsDemoModule]: null SOP for localId: " + matLocalID.ToString());
else
{
//var te = sop.Shape.Textures;
var te = new Primitive.TextureEntry(sop.Shape.TextureEntry, 0, sop.Shape.TextureEntry.Length);
if (te == null)
@ -413,14 +415,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
if (te.DefaultTexture == null)
m_log.Debug("[MaterialsDemoModule]: te.DefaultTexture is null");
else
{
if (te.DefaultTexture.MaterialID == null)
m_log.Debug("[MaterialsDemoModule]: te.DefaultTexture.MaterialID is null");
else
{
te.DefaultTexture.MaterialID = id;
}
}
te.DefaultTexture.MaterialID = id;
}
else
{

View File

@ -281,7 +281,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
m_module = module;
}
public override byte[] Handle(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader reader = new StreamReader(request);
string requestBody = reader.ReadToEnd();

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
m_WorldViewModule = fmodule;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
httpResponse.ContentType = "image/jpeg";

View File

@ -125,33 +125,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
static readonly float PIOverFour = ((float)Math.PI) / 4f;
static readonly float PIOverTwo = ((float)Math.PI) / 2f;
// For debugging, flags to turn on and off individual corrections.
public bool enableAngularVerticalAttraction;
public bool enableAngularDeflection;
public bool enableAngularBanking;
public BSDynamics(BSScene myScene, BSPrim myPrim, string actorName)
: base(myScene, myPrim, actorName)
{
ControllingPrim = myPrim;
Type = Vehicle.TYPE_NONE;
m_haveRegisteredForSceneEvents = false;
SetupVehicleDebugging();
}
// Stopgap debugging enablement. Allows source level debugging but still checking
// in changes by making enablement of debugging flags from INI file.
public void SetupVehicleDebugging()
{
enableAngularVerticalAttraction = true;
enableAngularDeflection = true;
enableAngularBanking = true;
if (BSParam.VehicleDebuggingEnable)
{
enableAngularVerticalAttraction = true;
enableAngularDeflection = false;
enableAngularBanking = false;
}
}
// Return 'true' if this vehicle is doing vehicle things
@ -556,10 +535,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
}
m_linearMotor = new BSVMotor("LinearMotor", m_linearMotorTimescale, m_linearMotorDecayTimescale, 1f);
m_linearMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging)
// m_linearMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging)
m_angularMotor = new BSVMotor("AngularMotor", m_angularMotorTimescale, m_angularMotorDecayTimescale, 1f);
m_angularMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging)
// m_angularMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging)
/* Not implemented
m_verticalAttractionMotor = new BSVMotor("VerticalAttraction", m_verticalAttractionTimescale,
@ -926,6 +905,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
return VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleOrientation));
}
}
private float VehicleForwardSpeed
{
get
@ -1061,26 +1041,37 @@ namespace OpenSim.Region.Physics.BulletSPlugin
Vector3 linearDeflectionV = Vector3.Zero;
Vector3 velocityV = VehicleForwardVelocity;
// Velocity in Y and Z dimensions is movement to the side or turning.
// Compute deflection factor from the to the side and rotational velocity
linearDeflectionV.Y = SortedClampInRange(0, (velocityV.Y * m_linearDeflectionEfficiency) / m_linearDeflectionTimescale, velocityV.Y);
linearDeflectionV.Z = SortedClampInRange(0, (velocityV.Z * m_linearDeflectionEfficiency) / m_linearDeflectionTimescale, velocityV.Z);
if (BSParam.VehicleEnableLinearDeflection)
{
// Velocity in Y and Z dimensions is movement to the side or turning.
// Compute deflection factor from the to the side and rotational velocity
linearDeflectionV.Y = SortedClampInRange(0, (velocityV.Y * m_linearDeflectionEfficiency) / m_linearDeflectionTimescale, velocityV.Y);
linearDeflectionV.Z = SortedClampInRange(0, (velocityV.Z * m_linearDeflectionEfficiency) / m_linearDeflectionTimescale, velocityV.Z);
// Velocity to the side and around is corrected and moved into the forward direction
linearDeflectionV.X += Math.Abs(linearDeflectionV.Y);
linearDeflectionV.X += Math.Abs(linearDeflectionV.Z);
// Velocity to the side and around is corrected and moved into the forward direction
linearDeflectionV.X += Math.Abs(linearDeflectionV.Y);
linearDeflectionV.X += Math.Abs(linearDeflectionV.Z);
// Scale the deflection to the fractional simulation time
linearDeflectionV *= pTimestep;
// Scale the deflection to the fractional simulation time
linearDeflectionV *= pTimestep;
// Subtract the sideways and rotational velocity deflection factors while adding the correction forward
linearDeflectionV *= new Vector3(1,-1,-1);
// Subtract the sideways and rotational velocity deflection factors while adding the correction forward
linearDeflectionV *= new Vector3(1, -1, -1);
// Correciont is vehicle relative. Convert to world coordinates and add to the velocity
VehicleVelocity += linearDeflectionV * VehicleOrientation;
// Correction is vehicle relative. Convert to world coordinates.
Vector3 linearDeflectionW = linearDeflectionV * VehicleOrientation;
VDetailLog("{0}, MoveLinear,LinearDeflection,linDefEff={1},linDefTS={2},linDeflectionV={3}",
ControllingPrim.LocalID, m_linearDeflectionEfficiency, m_linearDeflectionTimescale, linearDeflectionV);
// Optionally, if not colliding, don't effect world downward velocity. Let falling things fall.
if (BSParam.VehicleLinearDeflectionNotCollidingNoZ && !m_controllingPrim.IsColliding)
{
linearDeflectionW.Z = 0f;
}
VehicleVelocity += linearDeflectionW;
VDetailLog("{0}, MoveLinear,LinearDeflection,linDefEff={1},linDefTS={2},linDeflectionV={3}",
ControllingPrim.LocalID, m_linearDeflectionEfficiency, m_linearDeflectionTimescale, linearDeflectionV);
}
}
public void ComputeLinearTerrainHeightCorrection(float pTimestep)
@ -1393,116 +1384,134 @@ namespace OpenSim.Region.Physics.BulletSPlugin
{
// If vertical attaction timescale is reasonable
if (enableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff)
if (BSParam.VehicleEnableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff)
{
//Another formula to try got from :
//http://answers.unity3d.com/questions/10425/how-to-stabilize-angular-motion-alignment-of-hover.html
Vector3 VehicleUpAxis = Vector3.UnitZ * VehicleOrientation;
// Flipping what was originally a timescale into a speed variable and then multiplying it by 2
// since only computing half the distance between the angles.
float VerticalAttractionSpeed = (1 / m_verticalAttractionTimescale) * 2.0f;
// Make a prediction of where the up axis will be when this is applied rather then where it is now as
// this makes for a smoother adjustment and less fighting between the various forces.
Vector3 predictedUp = VehicleUpAxis * Quaternion.CreateFromAxisAngle(VehicleRotationalVelocity, 0f);
// This is only half the distance to the target so it will take 2 seconds to complete the turn.
Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ);
// Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared
Vector3 vertContributionV = torqueVector * VerticalAttractionSpeed * VerticalAttractionSpeed;
VehicleRotationalVelocity += vertContributionV;
VDetailLog("{0}, MoveAngular,verticalAttraction,UpAxis={1},PredictedUp={2},torqueVector={3},contrib={4}",
ControllingPrim.LocalID,
VehicleUpAxis,
predictedUp,
torqueVector,
vertContributionV);
//=====================================================================
/*
// Possible solution derived from a discussion at:
// http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no
// Create a rotation that is only the vehicle's rotation around Z
Vector3 currentEuler = Vector3.Zero;
VehicleOrientation.GetEulerAngles(out currentEuler.X, out currentEuler.Y, out currentEuler.Z);
Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEuler.Z);
// Create the axis that is perpendicular to the up vector and the rotated up vector.
Vector3 differenceAxis = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleOrientation);
// Compute the angle between those to vectors.
double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleOrientation)));
// 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical
// Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied.
// TODO: add 'efficiency'.
differenceAngle /= m_verticalAttractionTimescale;
// Create the quaterian representing the correction angle
Quaternion correctionRotation = Quaternion.CreateFromAxisAngle(differenceAxis, (float)differenceAngle);
// Turn that quaternion into Euler values to make it into velocities to apply.
Vector3 vertContributionV = Vector3.Zero;
correctionRotation.GetEulerAngles(out vertContributionV.X, out vertContributionV.Y, out vertContributionV.Z);
vertContributionV *= -1f;
VehicleRotationalVelocity += vertContributionV;
VDetailLog("{0}, MoveAngular,verticalAttraction,diffAxis={1},diffAng={2},corrRot={3},contrib={4}",
ControllingPrim.LocalID,
differenceAxis,
differenceAngle,
correctionRotation,
vertContributionV);
*/
// ===================================================================
/*
Vector3 vertContributionV = Vector3.Zero;
Vector3 origRotVelW = VehicleRotationalVelocity; // DEBUG DEBUG
// Take a vector pointing up and convert it from world to vehicle relative coords.
Vector3 verticalError = Vector3.Normalize(Vector3.UnitZ * VehicleOrientation);
// If vertical attraction correction is needed, the vector that was pointing up (UnitZ)
// is now:
// leaning to one side: rotated around the X axis with the Y value going
// from zero (nearly straight up) to one (completely to the side)) or
// leaning front-to-back: rotated around the Y axis with the value of X being between
// zero and one.
// The value of Z is how far the rotation is off with 1 meaning none and 0 being 90 degrees.
// Y error means needed rotation around X axis and visa versa.
// Since the error goes from zero to one, the asin is the corresponding angle.
vertContributionV.X = (float)Math.Asin(verticalError.Y);
// (Tilt forward (positive X) needs to tilt back (rotate negative) around Y axis.)
vertContributionV.Y = -(float)Math.Asin(verticalError.X);
// If verticalError.Z is negative, the vehicle is upside down. Add additional push.
if (verticalError.Z < 0f)
Vector3 vehicleUpAxis = Vector3.UnitZ * VehicleOrientation;
switch (BSParam.VehicleAngularVerticalAttractionAlgorithm)
{
vertContributionV.X += Math.Sign(vertContributionV.X) * PIOverFour;
// vertContribution.Y -= PIOverFour;
case 0:
{
//Another formula to try got from :
//http://answers.unity3d.com/questions/10425/how-to-stabilize-angular-motion-alignment-of-hover.html
// Flipping what was originally a timescale into a speed variable and then multiplying it by 2
// since only computing half the distance between the angles.
float VerticalAttractionSpeed = (1 / m_verticalAttractionTimescale) * 2.0f;
// Make a prediction of where the up axis will be when this is applied rather then where it is now as
// this makes for a smoother adjustment and less fighting between the various forces.
Vector3 predictedUp = vehicleUpAxis * Quaternion.CreateFromAxisAngle(VehicleRotationalVelocity, 0f);
// This is only half the distance to the target so it will take 2 seconds to complete the turn.
Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ);
// Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared
Vector3 vertContributionV = torqueVector * VerticalAttractionSpeed * VerticalAttractionSpeed;
VehicleRotationalVelocity += vertContributionV;
VDetailLog("{0}, MoveAngular,verticalAttraction,upAxis={1},PredictedUp={2},torqueVector={3},contrib={4}",
ControllingPrim.LocalID,
vehicleUpAxis,
predictedUp,
torqueVector,
vertContributionV);
break;
}
case 1:
{
// Possible solution derived from a discussion at:
// http://stackoverflow.com/questions/14939657/computing-vector-from-quaternion-works-computing-quaternion-from-vector-does-no
// Create a rotation that is only the vehicle's rotation around Z
Vector3 currentEuler = Vector3.Zero;
VehicleOrientation.GetEulerAngles(out currentEuler.X, out currentEuler.Y, out currentEuler.Z);
Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEuler.Z);
// Create the axis that is perpendicular to the up vector and the rotated up vector.
Vector3 differenceAxis = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleOrientation);
// Compute the angle between those to vectors.
double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleOrientation)));
// 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical
// Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied.
// TODO: add 'efficiency'.
differenceAngle /= m_verticalAttractionTimescale;
// Create the quaterian representing the correction angle
Quaternion correctionRotation = Quaternion.CreateFromAxisAngle(differenceAxis, (float)differenceAngle);
// Turn that quaternion into Euler values to make it into velocities to apply.
Vector3 vertContributionV = Vector3.Zero;
correctionRotation.GetEulerAngles(out vertContributionV.X, out vertContributionV.Y, out vertContributionV.Z);
vertContributionV *= -1f;
VehicleRotationalVelocity += vertContributionV;
VDetailLog("{0}, MoveAngular,verticalAttraction,upAxis={1},diffAxis={2},diffAng={3},corrRot={4},contrib={5}",
ControllingPrim.LocalID,
vehicleUpAxis,
differenceAxis,
differenceAngle,
correctionRotation,
vertContributionV);
break;
}
case 2:
{
Vector3 vertContributionV = Vector3.Zero;
Vector3 origRotVelW = VehicleRotationalVelocity; // DEBUG DEBUG
// Take a vector pointing up and convert it from world to vehicle relative coords.
Vector3 verticalError = Vector3.Normalize(Vector3.UnitZ * VehicleOrientation);
// If vertical attraction correction is needed, the vector that was pointing up (UnitZ)
// is now:
// leaning to one side: rotated around the X axis with the Y value going
// from zero (nearly straight up) to one (completely to the side)) or
// leaning front-to-back: rotated around the Y axis with the value of X being between
// zero and one.
// The value of Z is how far the rotation is off with 1 meaning none and 0 being 90 degrees.
// Y error means needed rotation around X axis and visa versa.
// Since the error goes from zero to one, the asin is the corresponding angle.
vertContributionV.X = (float)Math.Asin(verticalError.Y);
// (Tilt forward (positive X) needs to tilt back (rotate negative) around Y axis.)
vertContributionV.Y = -(float)Math.Asin(verticalError.X);
// If verticalError.Z is negative, the vehicle is upside down. Add additional push.
if (verticalError.Z < 0f)
{
vertContributionV.X += Math.Sign(vertContributionV.X) * PIOverFour;
// vertContribution.Y -= PIOverFour;
}
// 'vertContrbution' is now the necessary angular correction to correct tilt in one second.
// Correction happens over a number of seconds.
Vector3 unscaledContribVerticalErrorV = vertContributionV; // DEBUG DEBUG
// The correction happens over the user's time period
vertContributionV /= m_verticalAttractionTimescale;
// Rotate the vehicle rotation to the world coordinates.
VehicleRotationalVelocity += (vertContributionV * VehicleOrientation);
VDetailLog("{0}, MoveAngular,verticalAttraction,,upAxis={1},origRotVW={2},vertError={3},unscaledV={4},eff={5},ts={6},vertContribV={7}",
ControllingPrim.LocalID,
vehicleUpAxis,
origRotVelW,
verticalError,
unscaledContribVerticalErrorV,
m_verticalAttractionEfficiency,
m_verticalAttractionTimescale,
vertContributionV);
break;
}
default:
{
break;
}
}
// 'vertContrbution' is now the necessary angular correction to correct tilt in one second.
// Correction happens over a number of seconds.
Vector3 unscaledContribVerticalErrorV = vertContributionV; // DEBUG DEBUG
// The correction happens over the user's time period
vertContributionV /= m_verticalAttractionTimescale;
// Rotate the vehicle rotation to the world coordinates.
VehicleRotationalVelocity += (vertContributionV * VehicleOrientation);
VDetailLog("{0}, MoveAngular,verticalAttraction,,origRotVW={1},vertError={2},unscaledV={3},eff={4},ts={5},vertContribV={6}",
Prim.LocalID, origRotVelW, verticalError, unscaledContribVerticalErrorV,
m_verticalAttractionEfficiency, m_verticalAttractionTimescale, vertContributionV);
*/
}
}
@ -1514,7 +1523,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
public void ComputeAngularDeflection()
{
if (enableAngularDeflection && m_angularDeflectionEfficiency != 0 && VehicleForwardSpeed > 0.2)
if (BSParam.VehicleEnableAngularDeflection && m_angularDeflectionEfficiency != 0 && VehicleForwardSpeed > 0.2)
{
Vector3 deflectContributionV = Vector3.Zero;
@ -1593,7 +1602,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// make a sluggish vehicle by giving it a timescale of several seconds.
public void ComputeAngularBanking()
{
if (enableAngularBanking && m_bankingEfficiency != 0 && m_verticalAttractionTimescale < m_verticalAttractionCutoff)
if (BSParam.VehicleEnableAngularBanking && m_bankingEfficiency != 0 && m_verticalAttractionTimescale < m_verticalAttractionCutoff)
{
Vector3 bankingContributionV = Vector3.Zero;

View File

@ -155,7 +155,12 @@ public static class BSParam
public static Vector3 VehicleInertiaFactor { get; private set; }
public static float VehicleGroundGravityFudge { get; private set; }
public static float VehicleAngularBankingTimescaleFudge { get; private set; }
public static bool VehicleDebuggingEnable { get; private set; }
public static bool VehicleEnableLinearDeflection { get; private set; }
public static bool VehicleLinearDeflectionNotCollidingNoZ { get; private set; }
public static bool VehicleEnableAngularVerticalAttraction { get; private set; }
public static int VehicleAngularVerticalAttractionAlgorithm { get; private set; }
public static bool VehicleEnableAngularDeflection { get; private set; }
public static bool VehicleEnableAngularBanking { get; private set; }
// Convex Hulls
public static int CSHullMaxDepthSplit { get; private set; }
@ -606,8 +611,18 @@ public static class BSParam
0.2f ),
new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.",
60.0f ),
new ParameterDefn<bool>("VehicleDebuggingEnable", "Turn on/off vehicle debugging",
false ),
new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect",
true ),
new ParameterDefn<bool>("VehicleLinearDeflectionNotCollidingNoZ", "Turn on/off linear deflection Z effect on non-colliding vehicles",
true ),
new ParameterDefn<bool>("VehicleEnableAngularVerticalAttraction", "Turn on/off vehicle angular vertical attraction effect",
true ),
new ParameterDefn<int>("VehicleAngularVerticalAttractionAlgorithm", "Select vertical attraction algo. You need to look at the source.",
0 ),
new ParameterDefn<bool>("VehicleEnableAngularDeflection", "Turn on/off vehicle angular deflection effect",
true ),
new ParameterDefn<bool>("VehicleEnableAngularBanking", "Turn on/off vehicle angular banking effect",
true ),
new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
0f,

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@ -648,7 +648,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
simTime = Util.EnvironmentTickCountSubtract(beforeTime);
if (PhysicsLogging.Enabled)
{
DetailLog("{0},DoPhysicsStep,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}",
DetailLog("{0},DoPhysicsStep,complete,frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}",
DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps,
updatedEntityCount, collidersCount, ObjectsWithCollisions.Count);
}

View File

@ -57,6 +57,8 @@ public class BasicVehicles : OpenSimTestCase
public void Init()
{
Dictionary<string, string> engineParams = new Dictionary<string, string>();
engineParams.Add("VehicleEnableAngularVerticalAttraction", "true");
engineParams.Add("VehicleAngularVerticalAttractionAlgorithm", "1");
PhysicsScene = BulletSimTestsUtil.CreateBasicPhysicsEngine(engineParams);
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateSphere();
@ -119,7 +121,7 @@ public class BasicVehicles : OpenSimTestCase
{
vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency);
vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_TIMESCALE, timeScale);
vehicleActor.enableAngularVerticalAttraction = true;
// vehicleActor.enableAngularVerticalAttraction = true;
TestVehicle.IsPhysical = true;
PhysicsScene.ProcessTaints();

View File

@ -108,7 +108,6 @@ namespace OpenSim.Region.Physics.OdePlugin
private Vector3 m_taintAngularLock = Vector3.One;
private IntPtr Amotor = IntPtr.Zero;
private object m_assetsLock = new object();
private bool m_assetFailed = false;
private Vector3 m_PIDTarget;

View File

@ -46,7 +46,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// </summary>
public class OdePlugin : IPhysicsPlugin
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private OdeScene m_scene;

View File

@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Asset
m_allowedTypes = allowedTypes;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
bool result = false;

View File

@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Asset
m_AssetService = service;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] result = new byte[0];

View File

@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Asset
m_AssetService = service;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
AssetBase asset;

View File

@ -70,7 +70,7 @@ namespace OpenSim.Server.Handlers.Authentication
}
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
string[] p = SplitParams(path);

View File

@ -147,7 +147,7 @@ namespace OpenSim.Server.Handlers.Authentication
#endregion
}
public class OpenIdStreamHandler : IStreamHandler
public class OpenIdStreamHandler : BaseOutputStreamHandler
{
#region HTML
@ -191,42 +191,34 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
#endregion HTML
public string Name { get { return "OpenId"; } }
public string Description { get { return null; } }
public string ContentType { get { return m_contentType; } }
public string HttpMethod { get { return m_httpMethod; } }
public string Path { get { return m_path; } }
string m_contentType;
string m_httpMethod;
string m_path;
IAuthenticationService m_authenticationService;
IUserAccountService m_userAccountService;
ProviderMemoryStore m_openidStore = new ProviderMemoryStore();
public override string ContentType { get { return "text/html"; } }
/// <summary>
/// Constructor
/// </summary>
public OpenIdStreamHandler(string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService)
public OpenIdStreamHandler(
string httpMethod, string path, IUserAccountService userService, IAuthenticationService authService)
: base(httpMethod, path, "OpenId", "OpenID stream handler")
{
m_authenticationService = authService;
m_userAccountService = userService;
m_httpMethod = httpMethod;
m_path = path;
m_contentType = "text/html";
}
/// <summary>
/// Handles all GET and POST requests for OpenID identifier pages and endpoint
/// server communication
/// </summary>
public void Handle(string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override void ProcessRequest(
string path, Stream request, Stream response, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath));
// Defult to returning HTML content
m_contentType = "text/html";
httpResponse.ContentType = ContentType;
try
{
@ -276,7 +268,7 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type");
if (contentTypeValues != null && contentTypeValues.Length == 1)
m_contentType = contentTypeValues[0];
httpResponse.ContentType = contentTypeValues[0];
// Set the response code and document body based on the OpenID result
httpResponse.StatusCode = (int)provider.Request.Response.Code;
@ -344,4 +336,4 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
return false;
}
}
}
}

View File

@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Authorization
m_AuthorizationService = service;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest));

View File

@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Avatar
m_AvatarService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Friends
m_FriendsService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -57,7 +57,7 @@ namespace OpenSim.Server.Handlers.Grid
m_GridService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.GridUser
m_GridUserService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!");
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -91,7 +91,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
m_HandlersType = handlersType;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
return OKResponse(httpResponse);

View File

@ -68,6 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
{
return new ExtendedAgentDestinationData();
}
protected override void UnpackData(OSDMap args, AgentDestinationData d, Hashtable request)
{
base.UnpackData(args, d, request);

View File

@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Inventory
m_InventoryService = service;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>));

View File

@ -87,7 +87,7 @@ namespace OpenSim.Server.Handlers.Asset
m_InventoryService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -99,7 +99,7 @@ namespace OpenSim.Server.Handlers.MapImage
m_Proxy = proxy;
}
public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
StreamReader sr = new StreamReader(requestData);

View File

@ -80,7 +80,7 @@ namespace OpenSim.Server.Handlers.MapImage
m_MapService = service;
}
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[] result = new byte[0];

View File

@ -58,7 +58,7 @@ namespace OpenSim.Server.Handlers.Neighbour
// TODO: unused: m_AuthenticationService = authentication;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Not implemented yet
@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Neighbour
// TODO: unused: m_AllowForeignGuests = foreignGuests;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] result = new byte[0];
@ -176,7 +176,7 @@ namespace OpenSim.Server.Handlers.Neighbour
// TODO: unused: m_AuthenticationService = authentication;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Not implemented yet
@ -197,7 +197,7 @@ namespace OpenSim.Server.Handlers.Neighbour
// TODO: unused: m_AuthenticationService = authentication;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// Not implemented yet

View File

@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.Presence
m_PresenceService = service;
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -251,7 +251,7 @@ namespace OpenSim.Server.Handlers.Simulation
m_SimulationService = null;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[SIMULATION]: Stream handler called");
@ -457,7 +457,7 @@ namespace OpenSim.Server.Handlers.Simulation
m_SimulationService = null;
}
public override byte[] Handle(string path, Stream request,
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[SIMULATION]: Stream handler called");

View File

@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
}
}
public override byte[] Handle(string path, Stream requestData,
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);

View File

@ -54,7 +54,7 @@ namespace OpenSim.Services.HypergridService
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private string m_HomeURL;
// private string m_HomeURL;
private IUserAccountService m_UserAccountService;
private IAvatarService m_AvatarService;
@ -96,8 +96,8 @@ namespace OpenSim.Services.HypergridService
if (m_AvatarService == null)
throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll));
m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI",
new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty);
// m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI",
// new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty);
// m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
}