mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
use 'in' on PollService event args
This commit is contained in:
@@ -610,7 +610,7 @@ namespace OpenSim.Framework.Console
|
||||
|
||||
// Check if there is anything to send. Return true if this client has
|
||||
// lines pending.
|
||||
protected bool HasEvents(UUID RequestID, UUID sessionID)
|
||||
protected bool HasEvents(in UUID RequestID, in UUID sessionID)
|
||||
{
|
||||
ConsoleConnection c = null;
|
||||
|
||||
@@ -627,7 +627,7 @@ namespace OpenSim.Framework.Console
|
||||
}
|
||||
|
||||
// Send all pending output to the client.
|
||||
protected Hashtable GetEvents(UUID RequestID, UUID sessionID)
|
||||
protected Hashtable GetEvents(in UUID RequestID, in UUID sessionID)
|
||||
{
|
||||
// Find the connection that goes with this client.
|
||||
ConsoleConnection c = null;
|
||||
@@ -716,17 +716,15 @@ namespace OpenSim.Framework.Console
|
||||
|
||||
// This is really just a no-op. It generates what is sent
|
||||
// to the client if the poll times out without any events.
|
||||
protected Hashtable NoEvents(UUID RequestID, UUID id)
|
||||
protected Hashtable NoEvents(in UUID RequestID, in UUID id)
|
||||
{
|
||||
Hashtable result = new Hashtable();
|
||||
|
||||
XmlDocument xmldoc = new XmlDocument();
|
||||
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
|
||||
"", "");
|
||||
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, "", "");
|
||||
|
||||
xmldoc.AppendChild(xmlnode);
|
||||
XmlElement rootElement = xmldoc.CreateElement("", "ConsoleSession",
|
||||
"");
|
||||
XmlElement rootElement = xmldoc.CreateElement("", "ConsoleSession", "");
|
||||
|
||||
xmldoc.AppendChild(rootElement);
|
||||
|
||||
|
||||
@@ -31,13 +31,13 @@ using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public delegate OSHttpResponse RequestMethod(UUID ID, OSHttpRequest request);
|
||||
public delegate bool HasEventsMethod(UUID requestID, UUID pId);
|
||||
public delegate OSHttpResponse RequestMethod(in UUID ID, OSHttpRequest request);
|
||||
public delegate bool HasEventsMethod(in UUID requestID, in UUID pId);
|
||||
|
||||
public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId);
|
||||
public delegate Hashtable GetEventsMethod(in UUID requestID, in UUID pId);
|
||||
|
||||
public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId);
|
||||
public delegate void DropMethod(UUID requestID, UUID pId);
|
||||
public delegate Hashtable NoEventsMethod(in UUID requestID, in UUID pId);
|
||||
public delegate void DropMethod(in UUID requestID, in UUID pId);
|
||||
|
||||
public class PollServiceEventArgs : EventArgs
|
||||
{
|
||||
|
||||
@@ -41,16 +41,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private ConcurrentQueue<PollServiceHttpRequest> m_retryRequests = new ConcurrentQueue<PollServiceHttpRequest>();
|
||||
|
||||
private int m_WorkerThreadCount = 0;
|
||||
private readonly ConcurrentQueue<PollServiceHttpRequest> m_retryRequests = new();
|
||||
private readonly int m_WorkerThreadCount = 0;
|
||||
private ObjectJobEngine m_workerPool;
|
||||
private Thread m_retrysThread;
|
||||
|
||||
private bool m_running = false;
|
||||
|
||||
public PollServiceRequestManager(
|
||||
bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout)
|
||||
public PollServiceRequestManager(bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout)
|
||||
{
|
||||
m_WorkerThreadCount = (int)pWorkerThreadCount;
|
||||
}
|
||||
@@ -59,6 +57,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
if(m_running)
|
||||
return;
|
||||
|
||||
m_running = true;
|
||||
m_workerPool = new ObjectJobEngine(PoolWorkerJob, "PollServiceWorker", 4000, m_WorkerThreadCount);
|
||||
|
||||
@@ -86,12 +85,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
private void CheckRetries()
|
||||
{
|
||||
PollServiceHttpRequest preq;
|
||||
while (m_running)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
Watchdog.UpdateThread();
|
||||
while (m_running && m_retryRequests.TryDequeue(out preq))
|
||||
while (m_running && m_retryRequests.TryDequeue(out PollServiceHttpRequest preq))
|
||||
m_workerPool.Enqueue(preq);
|
||||
}
|
||||
}
|
||||
@@ -126,8 +124,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
private void PoolWorkerJob(object o)
|
||||
{
|
||||
PollServiceHttpRequest req = o as PollServiceHttpRequest;
|
||||
if(req == null)
|
||||
if (o is not PollServiceHttpRequest req)
|
||||
return;
|
||||
try
|
||||
{
|
||||
@@ -176,7 +173,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
|
||||
m_log.Error($"Exception in poll service thread: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user