mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
Add "show caps stats by user" and "show caps stats by cap" console commands to print various counts of capability invocation by user and by cap
This currently prints caps requests received and handled, so that overload of received compared to handled or deadlock can be detected. This involves making BaseStreamHandler and BaseOutputStream record the ints, which means inheritors should subclass ProcessRequest() instead of Handle() However, existing inheriting classes overriding Handle() will still work, albeit without stats recording. "show caps" becomes "show caps list" to disambiguate between show caps commands
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user