Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
f4cc19968c
|
@ -312,14 +312,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
// Now that everything is setup we can proceed to
|
// Now that everything is setup we can proceed to
|
||||||
// add THIS agent to the HTTP server's handler list
|
// add THIS agent to the HTTP server's handler list
|
||||||
|
|
||||||
if (!AddAgentHandler(Rest.Name,this))
|
// FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
|
||||||
{
|
// have to be handled through the AddHttpHandler interface.
|
||||||
Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
|
// if (!AddAgentHandler(Rest.Name,this))
|
||||||
foreach (IRest handler in handlers)
|
// {
|
||||||
{
|
// Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
|
||||||
handler.Close();
|
// foreach (IRest handler in handlers)
|
||||||
}
|
// {
|
||||||
}
|
// handler.Close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -342,11 +344,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
{
|
{
|
||||||
Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId);
|
Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId);
|
||||||
|
|
||||||
try
|
// FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
|
||||||
{
|
// have to be handled through the AddHttpHandler interface.
|
||||||
RemoveAgentHandler(Rest.Name, this);
|
// try
|
||||||
}
|
// {
|
||||||
catch (KeyNotFoundException){}
|
// RemoveAgentHandler(Rest.Name, this);
|
||||||
|
// }
|
||||||
|
// catch (KeyNotFoundException){}
|
||||||
|
|
||||||
foreach (IRest handler in handlers)
|
foreach (IRest handler in handlers)
|
||||||
{
|
{
|
||||||
|
|
|
@ -297,7 +297,9 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
{
|
{
|
||||||
if (!IsEnabled) return false;
|
if (!IsEnabled) return false;
|
||||||
_agents.Add(agentName, handler);
|
_agents.Add(agentName, handler);
|
||||||
return _httpd.AddAgentHandler(agentName, handler);
|
// return _httpd.AddAgentHandler(agentName, handler);
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -316,7 +318,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
if (_agents[agentName] == handler)
|
if (_agents[agentName] == handler)
|
||||||
{
|
{
|
||||||
_agents.Remove(agentName);
|
_agents.Remove(agentName);
|
||||||
return _httpd.RemoveAgentHandler(agentName, handler);
|
// return _httpd.RemoveAgentHandler(agentName, handler);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -358,10 +360,10 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
_httpd.RemoveStreamHandler(h.HttpMethod, h.Path);
|
_httpd.RemoveStreamHandler(h.HttpMethod, h.Path);
|
||||||
}
|
}
|
||||||
_handlers = null;
|
_handlers = null;
|
||||||
foreach (KeyValuePair<string, IHttpAgentHandler> h in _agents)
|
// foreach (KeyValuePair<string, IHttpAgentHandler> h in _agents)
|
||||||
{
|
// {
|
||||||
_httpd.RemoveAgentHandler(h.Key, h.Value);
|
// _httpd.RemoveAgentHandler(h.Key, h.Value);
|
||||||
}
|
// }
|
||||||
_agents = null;
|
_agents = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,15 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
/// </value>
|
/// </value>
|
||||||
public int DebugLevel { get; set; }
|
public int DebugLevel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Request number for diagnostic purposes.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is an internal number. In some debug situations an external number may also be supplied in the
|
||||||
|
/// opensim-request-id header but we are not currently logging this.
|
||||||
|
/// </remarks>
|
||||||
|
public int RequestNumber { get; private set; }
|
||||||
|
|
||||||
private volatile int NotSocketErrors = 0;
|
private volatile int NotSocketErrors = 0;
|
||||||
public volatile bool HTTPDRunning = false;
|
public volatile bool HTTPDRunning = false;
|
||||||
|
|
||||||
|
@ -73,7 +82,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
|
protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
|
||||||
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
|
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
|
||||||
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
|
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
|
||||||
protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
// protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
||||||
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
|
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
|
||||||
new Dictionary<string, PollServiceEventArgs>();
|
new Dictionary<string, PollServiceEventArgs>();
|
||||||
|
|
||||||
|
@ -251,29 +260,29 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
return new List<string>(m_pollHandlers.Keys);
|
return new List<string>(m_pollHandlers.Keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that the agent string is provided simply to differentiate
|
// // Note that the agent string is provided simply to differentiate
|
||||||
// the handlers - it is NOT required to be an actual agent header
|
// // the handlers - it is NOT required to be an actual agent header
|
||||||
// value.
|
// // value.
|
||||||
public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
|
// public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
|
||||||
{
|
// {
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
{
|
// {
|
||||||
if (!m_agentHandlers.ContainsKey(agent))
|
// if (!m_agentHandlers.ContainsKey(agent))
|
||||||
{
|
// {
|
||||||
m_agentHandlers.Add(agent, handler);
|
// m_agentHandlers.Add(agent, handler);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//must already have a handler for that path so return false
|
// //must already have a handler for that path so return false
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public List<string> GetAgentHandlerKeys()
|
// public List<string> GetAgentHandlerKeys()
|
||||||
{
|
// {
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
return new List<string>(m_agentHandlers.Keys);
|
// return new List<string>(m_agentHandlers.Keys);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public bool AddLLSDHandler(string path, LLSDMethod handler)
|
public bool AddLLSDHandler(string path, LLSDMethod handler)
|
||||||
{
|
{
|
||||||
|
@ -302,6 +311,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
private void OnRequest(object source, RequestEventArgs args)
|
private void OnRequest(object source, RequestEventArgs args)
|
||||||
{
|
{
|
||||||
|
RequestNumber++;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IHttpClientContext context = (IHttpClientContext)source;
|
IHttpClientContext context = (IHttpClientContext)source;
|
||||||
|
@ -411,7 +422,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
string requestMethod = request.HttpMethod;
|
string requestMethod = request.HttpMethod;
|
||||||
string uriString = request.RawUrl;
|
string uriString = request.RawUrl;
|
||||||
|
|
||||||
// string reqnum = "unknown";
|
|
||||||
int requestStartTick = Environment.TickCount;
|
int requestStartTick = Environment.TickCount;
|
||||||
|
|
||||||
// Will be adjusted later on.
|
// Will be adjusted later on.
|
||||||
|
@ -428,22 +438,22 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
||||||
|
|
||||||
// This is the REST agent interface. We require an agent to properly identify
|
// // This is the REST agent interface. We require an agent to properly identify
|
||||||
// itself. If the REST handler recognizes the prefix it will attempt to
|
// // itself. If the REST handler recognizes the prefix it will attempt to
|
||||||
// satisfy the request. If it is not recognizable, and no damage has occurred
|
// // satisfy the request. If it is not recognizable, and no damage has occurred
|
||||||
// the request can be passed through to the other handlers. This is a low
|
// // the request can be passed through to the other handlers. This is a low
|
||||||
// probability event; if a request is matched it is normally expected to be
|
// // probability event; if a request is matched it is normally expected to be
|
||||||
// handled
|
// // handled
|
||||||
IHttpAgentHandler agentHandler;
|
// IHttpAgentHandler agentHandler;
|
||||||
|
//
|
||||||
if (TryGetAgentHandler(request, response, out agentHandler))
|
// if (TryGetAgentHandler(request, response, out agentHandler))
|
||||||
{
|
// {
|
||||||
if (HandleAgentRequest(agentHandler, request, response))
|
// if (HandleAgentRequest(agentHandler, request, response))
|
||||||
{
|
// {
|
||||||
requestEndTick = Environment.TickCount;
|
// requestEndTick = Environment.TickCount;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//response.KeepAlive = true;
|
//response.KeepAlive = true;
|
||||||
response.SendChunked = false;
|
response.SendChunked = false;
|
||||||
|
@ -535,8 +545,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
if (DebugLevel >= 3)
|
if (DebugLevel >= 3)
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}",
|
"[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
|
||||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
|
RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
|
||||||
|
|
||||||
buffer = HandleHTTPRequest(request, response);
|
buffer = HandleHTTPRequest(request, response);
|
||||||
break;
|
break;
|
||||||
|
@ -547,8 +557,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
if (DebugLevel >= 3)
|
if (DebugLevel >= 3)
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}",
|
"[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
|
||||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
|
RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
|
||||||
|
|
||||||
buffer = HandleLLSDRequests(request, response);
|
buffer = HandleLLSDRequests(request, response);
|
||||||
break;
|
break;
|
||||||
|
@ -641,7 +651,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
if (tickdiff > 3000)
|
if (tickdiff > 3000)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms",
|
"[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms",
|
||||||
|
RequestNumber,
|
||||||
requestMethod,
|
requestMethod,
|
||||||
uriString,
|
uriString,
|
||||||
requestHandler != null ? requestHandler.Name : "",
|
requestHandler != null ? requestHandler.Name : "",
|
||||||
|
@ -652,12 +663,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
else if (DebugLevel >= 4)
|
else if (DebugLevel >= 4)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[BASE HTTP SERVER]: HTTP IN {0} {1} {2} {3} from {4} took {5}ms",
|
"[BASE HTTP SERVER]: HTTP IN {0} :{1} took {2}ms",
|
||||||
requestMethod,
|
RequestNumber,
|
||||||
uriString,
|
Port,
|
||||||
requestHandler != null ? requestHandler.Name : "",
|
|
||||||
requestHandler != null ? requestHandler.Description : "",
|
|
||||||
request.RemoteIPEndPoint,
|
|
||||||
tickdiff);
|
tickdiff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -666,8 +674,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler)
|
private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[BASE HTTP SERVER]: HTTP IN stream handler {0} {1} {2} {3} from {4}",
|
"[BASE HTTP SERVER]: HTTP IN {0} :{1} stream handler {2} {3} {4} {5} from {6}",
|
||||||
request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description, request.RemoteIPEndPoint);
|
RequestNumber,
|
||||||
|
Port,
|
||||||
|
request.HttpMethod,
|
||||||
|
request.Url.PathAndQuery,
|
||||||
|
requestHandler.Name,
|
||||||
|
requestHandler.Description,
|
||||||
|
request.RemoteIPEndPoint);
|
||||||
|
|
||||||
if (DebugLevel >= 5)
|
if (DebugLevel >= 5)
|
||||||
LogIncomingInDetail(request);
|
LogIncomingInDetail(request);
|
||||||
|
@ -676,8 +690,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
private void LogIncomingToContentTypeHandler(OSHttpRequest request)
|
private void LogIncomingToContentTypeHandler(OSHttpRequest request)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[BASE HTTP SERVER]: HTTP IN {0} content type handler {1} {2} from {3}",
|
"[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
|
||||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
|
RequestNumber,
|
||||||
|
Port,
|
||||||
|
request.ContentType,
|
||||||
|
request.HttpMethod,
|
||||||
|
request.Url.PathAndQuery,
|
||||||
|
request.RemoteIPEndPoint);
|
||||||
|
|
||||||
if (DebugLevel >= 5)
|
if (DebugLevel >= 5)
|
||||||
LogIncomingInDetail(request);
|
LogIncomingInDetail(request);
|
||||||
|
@ -686,8 +705,12 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
private void LogIncomingToXmlRpcHandler(OSHttpRequest request)
|
private void LogIncomingToXmlRpcHandler(OSHttpRequest request)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[BASE HTTP SERVER]: HTTP IN assumed generic XMLRPC request {0} {1} from {2}",
|
"[BASE HTTP SERVER]: HTTP IN {0} :{1} assumed generic XMLRPC request {2} {3} from {4}",
|
||||||
request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
|
RequestNumber,
|
||||||
|
Port,
|
||||||
|
request.HttpMethod,
|
||||||
|
request.Url.PathAndQuery,
|
||||||
|
request.RemoteIPEndPoint);
|
||||||
|
|
||||||
if (DebugLevel >= 5)
|
if (DebugLevel >= 5)
|
||||||
LogIncomingInDetail(request);
|
LogIncomingInDetail(request);
|
||||||
|
@ -807,24 +830,24 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
||||||
{
|
// {
|
||||||
agentHandler = null;
|
// agentHandler = null;
|
||||||
|
//
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
{
|
// {
|
||||||
foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
// foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
||||||
{
|
// {
|
||||||
if (handler.Match(request, response))
|
// if (handler.Match(request, response))
|
||||||
{
|
// {
|
||||||
agentHandler = handler;
|
// agentHandler = handler;
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Try all the registered xmlrpc handlers when an xmlrpc request is received.
|
/// Try all the registered xmlrpc handlers when an xmlrpc request is received.
|
||||||
|
@ -1749,21 +1772,21 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
m_pollHandlers.Remove(path);
|
m_pollHandlers.Remove(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
||||||
{
|
// {
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
{
|
// {
|
||||||
IHttpAgentHandler foundHandler;
|
// IHttpAgentHandler foundHandler;
|
||||||
|
//
|
||||||
if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
|
// if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
|
||||||
{
|
// {
|
||||||
m_agentHandlers.Remove(agent);
|
// m_agentHandlers.Remove(agent);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void RemoveXmlRPCHandler(string method)
|
public void RemoveXmlRPCHandler(string method)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,10 +41,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
uint Port { get; }
|
uint Port { get; }
|
||||||
bool UseSSL { get; }
|
bool UseSSL { get; }
|
||||||
|
|
||||||
// Note that the agent string is provided simply to differentiate
|
// // Note that the agent string is provided simply to differentiate
|
||||||
// the handlers - it is NOT required to be an actual agent header
|
// // the handlers - it is NOT required to be an actual agent header
|
||||||
// value.
|
// // value.
|
||||||
bool AddAgentHandler(string agent, IHttpAgentHandler handler);
|
// bool AddAgentHandler(string agent, IHttpAgentHandler handler);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a handler for an HTTP request.
|
/// Add a handler for an HTTP request.
|
||||||
|
@ -106,13 +106,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
|
bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Remove the agent if it is registered.
|
// /// Remove the agent if it is registered.
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="agent"></param>
|
// /// <param name="agent"></param>
|
||||||
/// <param name="handler"></param>
|
// /// <param name="handler"></param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
|
// bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove an HTTP handler
|
/// Remove an HTTP handler
|
||||||
|
|
|
@ -231,9 +231,9 @@ namespace OpenSim.Framework.Servers
|
||||||
foreach (String s in httpServer.GetHTTPHandlerKeys())
|
foreach (String s in httpServer.GetHTTPHandlerKeys())
|
||||||
handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
|
handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
|
||||||
|
|
||||||
handlers.AppendFormat("* Agent:\n");
|
// handlers.AppendFormat("* Agent:\n");
|
||||||
foreach (String s in httpServer.GetAgentHandlerKeys())
|
// foreach (String s in httpServer.GetAgentHandlerKeys())
|
||||||
handlers.AppendFormat("\t{0}\n", s);
|
// handlers.AppendFormat("\t{0}\n", s);
|
||||||
|
|
||||||
handlers.AppendFormat("* LLSD:\n");
|
handlers.AppendFormat("* LLSD:\n");
|
||||||
foreach (String s in httpServer.GetLLSDHandlerKeys())
|
foreach (String s in httpServer.GetLLSDHandlerKeys())
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Request number for diagnostic purposes.
|
/// Request number for diagnostic purposes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int RequestNumber = 0;
|
public static int RequestNumber { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// this is the header field used to communicate the local request id
|
/// this is the header field used to communicate the local request id
|
||||||
|
@ -241,7 +241,7 @@ namespace OpenSim.Framework
|
||||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||||
if (tickdiff > LongCallTime)
|
if (tickdiff > LongCallTime)
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
"[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||||
reqnum,
|
reqnum,
|
||||||
method,
|
method,
|
||||||
url,
|
url,
|
||||||
|
@ -257,7 +257,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
"[WEB UTIL]: ServiceOSD request {0} {1} {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
||||||
|
|
||||||
return ErrorResponseMap(errorMessage);
|
return ErrorResponseMap(errorMessage);
|
||||||
}
|
}
|
||||||
|
@ -400,7 +400,7 @@ namespace OpenSim.Framework
|
||||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||||
if (tickdiff > LongCallTime)
|
if (tickdiff > LongCallTime)
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
"[WEB UTIL]: Slow ServiceForm request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||||
reqnum,
|
reqnum,
|
||||||
method,
|
method,
|
||||||
url,
|
url,
|
||||||
|
@ -415,7 +415,7 @@ namespace OpenSim.Framework
|
||||||
reqnum, tickdiff, tickdata);
|
reqnum, tickdiff, tickdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage);
|
m_log.WarnFormat("[WEB UTIL]: ServiceForm request {0} {1} {2} failed: {2}", reqnum, method, url, errorMessage);
|
||||||
|
|
||||||
return ErrorResponseMap(errorMessage);
|
return ErrorResponseMap(errorMessage);
|
||||||
}
|
}
|
||||||
|
@ -879,7 +879,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
"[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||||
reqnum,
|
reqnum,
|
||||||
verb,
|
verb,
|
||||||
requestUrl,
|
requestUrl,
|
||||||
|
@ -1002,7 +1002,7 @@ namespace OpenSim.Framework
|
||||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||||
if (tickdiff > WebUtil.LongCallTime)
|
if (tickdiff > WebUtil.LongCallTime)
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
"[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||||
reqnum,
|
reqnum,
|
||||||
verb,
|
verb,
|
||||||
requestUrl,
|
requestUrl,
|
||||||
|
@ -1154,7 +1154,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
"[SynchronousRestObjectRequester]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||||
reqnum,
|
reqnum,
|
||||||
verb,
|
verb,
|
||||||
requestUrl,
|
requestUrl,
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
protected string m_assetServerURL;
|
protected string m_assetServerURL;
|
||||||
protected HGAssetMapper m_assetMapper;
|
protected HGAssetMapper m_assetMapper;
|
||||||
|
|
||||||
public HGUuidGatherer(HGAssetMapper assMap, IAssetService assetCache, string assetServerURL) : base(assetCache)
|
public HGUuidGatherer(HGAssetMapper assMap, IAssetService assetService, string assetServerURL) : base(assetService)
|
||||||
{
|
{
|
||||||
m_assetMapper = assMap;
|
m_assetMapper = assMap;
|
||||||
m_assetServerURL = assetServerURL;
|
m_assetServerURL = assetServerURL;
|
||||||
|
@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
protected override AssetBase GetAsset(UUID uuid)
|
protected override AssetBase GetAsset(UUID uuid)
|
||||||
{
|
{
|
||||||
if (string.Empty == m_assetServerURL)
|
if (string.Empty == m_assetServerURL)
|
||||||
return m_assetCache.Get(uuid.ToString());
|
return base.GetAsset(uuid);
|
||||||
else
|
else
|
||||||
return m_assetMapper.FetchAsset(m_assetServerURL, uuid);
|
return m_assetMapper.FetchAsset(m_assetServerURL, uuid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,25 +53,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <summary>
|
protected IAssetService m_assetService;
|
||||||
/// Asset cache used for gathering assets
|
|
||||||
/// </summary>
|
|
||||||
protected IAssetService m_assetCache;
|
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
|
// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
|
||||||
/// asset was found by the asset service.
|
// /// asset was found by the asset service.
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
private AssetBase m_requestedObjectAsset;
|
// private AssetBase m_requestedObjectAsset;
|
||||||
|
//
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Signal whether we are currently waiting for the asset service to deliver an asset.
|
// /// Signal whether we are currently waiting for the asset service to deliver an asset.
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
private bool m_waitingForObjectAsset;
|
// private bool m_waitingForObjectAsset;
|
||||||
|
|
||||||
public UuidGatherer(IAssetService assetCache)
|
public UuidGatherer(IAssetService assetCache)
|
||||||
{
|
{
|
||||||
m_assetCache = assetCache;
|
m_assetService = assetCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -195,18 +192,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// The callback made when we request the asset for an object from the asset service.
|
// /// The callback made when we request the asset for an object from the asset service.
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
private void AssetReceived(string id, Object sender, AssetBase asset)
|
// private void AssetReceived(string id, Object sender, AssetBase asset)
|
||||||
{
|
// {
|
||||||
lock (this)
|
// lock (this)
|
||||||
{
|
// {
|
||||||
m_requestedObjectAsset = asset;
|
// m_requestedObjectAsset = asset;
|
||||||
m_waitingForObjectAsset = false;
|
// m_waitingForObjectAsset = false;
|
||||||
Monitor.Pulse(this);
|
// Monitor.Pulse(this);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get an asset synchronously, potentially using an asynchronous callback. If the
|
/// Get an asset synchronously, potentially using an asynchronous callback. If the
|
||||||
|
@ -216,25 +213,29 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected virtual AssetBase GetAsset(UUID uuid)
|
protected virtual AssetBase GetAsset(UUID uuid)
|
||||||
{
|
{
|
||||||
m_waitingForObjectAsset = true;
|
return m_assetService.Get(uuid.ToString());
|
||||||
m_assetCache.Get(uuid.ToString(), this, AssetReceived);
|
|
||||||
|
|
||||||
// The asset cache callback can either
|
// XXX: Switching to do this synchronously where the call was async before but we always waited for it
|
||||||
//
|
// to complete anyway!
|
||||||
// 1. Complete on the same thread (if the asset is already in the cache) or
|
// m_waitingForObjectAsset = true;
|
||||||
// 2. Come in via a different thread (if we need to go fetch it).
|
// m_assetCache.Get(uuid.ToString(), this, AssetReceived);
|
||||||
//
|
//
|
||||||
// The code below handles both these alternatives.
|
// // The asset cache callback can either
|
||||||
lock (this)
|
// //
|
||||||
{
|
// // 1. Complete on the same thread (if the asset is already in the cache) or
|
||||||
if (m_waitingForObjectAsset)
|
// // 2. Come in via a different thread (if we need to go fetch it).
|
||||||
{
|
// //
|
||||||
Monitor.Wait(this);
|
// // The code below handles both these alternatives.
|
||||||
m_waitingForObjectAsset = false;
|
// lock (this)
|
||||||
}
|
// {
|
||||||
}
|
// if (m_waitingForObjectAsset)
|
||||||
|
// {
|
||||||
return m_requestedObjectAsset;
|
// Monitor.Wait(this);
|
||||||
|
// m_waitingForObjectAsset = false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return m_requestedObjectAsset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue