From e19defde36ddbd5ff90d8304c6fe3b57110f8078 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 8 Jul 2013 22:03:07 +0100
Subject: 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
---
.../Handlers/Asset/AssetServerDeleteHandler.cs | 2 +-
.../Server/Handlers/Asset/AssetServerGetHandler.cs | 2 +-
.../Handlers/Asset/AssetServerPostHandler.cs | 2 +-
.../AuthenticationServerPostHandler.cs | 2 +-
.../Handlers/Authentication/OpenIdServerHandler.cs | 30 ++++++++--------------
.../AuthorizationServerPostHandler.cs | 2 +-
.../Handlers/Avatar/AvatarServerPostHandler.cs | 2 +-
.../Handlers/Friends/FriendsServerPostHandler.cs | 2 +-
.../Server/Handlers/Grid/GridServerPostHandler.cs | 2 +-
.../Handlers/GridUser/GridUserServerPostHandler.cs | 2 +-
.../Hypergrid/HGFriendsServerPostHandler.cs | 2 +-
.../Handlers/Hypergrid/HeloServerConnector.cs | 2 +-
.../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 1 +
.../Inventory/InventoryServerMoveItemsHandler.cs | 2 +-
.../Handlers/Inventory/XInventoryInConnector.cs | 2 +-
.../Server/Handlers/Map/MapAddServerConnector.cs | 2 +-
.../Server/Handlers/Map/MapGetServerConnector.cs | 2 +-
.../Server/Handlers/Neighbour/NeighbourHandlers.cs | 8 +++---
.../Handlers/Presence/PresenceServerPostHandler.cs | 2 +-
.../Server/Handlers/Simulation/AgentHandlers.cs | 4 +--
.../UserAccounts/UserAccountServerPostHandler.cs | 2 +-
21 files changed, 35 insertions(+), 42 deletions(-)
(limited to 'OpenSim/Server')
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
index 986394b..941b97d 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
@@ -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;
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
index 8f7412b..8b23a83 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs
@@ -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];
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
index a006fa8..8eebc61 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs
@@ -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;
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
index 6b93cd9..16e011a 100644
--- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
index 18cef15..66a26fc 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerHandler.cs
@@ -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 http://openid.net/.
#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"; } }
+
///
/// Constructor
///
- 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";
}
///
/// Handles all GET and POST requests for OpenID identifier pages and endpoint
/// server communication
///
- 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 http://openid.net/.
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 http://openid.net/.
return false;
}
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
index bcf9d47..c9b4e9b 100644
--- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs
@@ -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));
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
index 8cd747e..d6bbb8f 100644
--- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
index 47a8558..ca0a24c 100644
--- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index ef5f33e..89cba8a 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
index 7483395..0b98e9a 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
index 0aa2729..a2bdadb 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
index f306b1c..06eaf2e 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index df875af..f37f2f1 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
index 231e32f..e2c50fe 100644
--- a/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
+++ b/OpenSim/Server/Handlers/Inventory/InventoryServerMoveItemsHandler.cs
@@ -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));
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 9d28dc3..0d7c136 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
index 4a61969..d438fc7 100644
--- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
index fb85d1c..7bb2f39 100644
--- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
@@ -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];
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
index 8a1f824..3525a01 100644
--- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
+++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs
@@ -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
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
index 2d67c6d..abb4b19 100644
--- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
@@ -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);
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 71a9e6f..a9fd4ed 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -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");
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
index 72551ef..24c9de6 100644
--- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -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);
--
cgit v1.1