mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
This commit is contained in:
@@ -88,7 +88,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
|
||||
private static Thread[] m_workerThreads = null;
|
||||
|
||||
private static int m_NumberScenes = 0;
|
||||
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
||||
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
||||
|
||||
@@ -97,13 +97,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
#region Region Module interfaceBase Members
|
||||
|
||||
~GetMeshModule()
|
||||
{
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
@@ -151,7 +144,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
|
||||
m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
|
||||
|
||||
m_NumberScenes--;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
@@ -167,6 +160,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
|
||||
m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
|
||||
|
||||
m_NumberScenes++;
|
||||
|
||||
if (m_workerThreads == null)
|
||||
{
|
||||
m_workerThreads = new Thread[2];
|
||||
@@ -174,7 +169,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
for (uint i = 0; i < 2; i++)
|
||||
{
|
||||
m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests,
|
||||
String.Format("MeshWorkerThread{0}", i),
|
||||
String.Format("GetMeshWorker{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
false,
|
||||
@@ -182,22 +177,29 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
int.MaxValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Close() { }
|
||||
public void Close()
|
||||
{
|
||||
if(m_NumberScenes <= 0 && m_workerThreads != null)
|
||||
{
|
||||
m_log.DebugFormat("[GetMeshModule] Closing");
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
m_queue.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public string Name { get { return "GetMeshModule"; } }
|
||||
|
||||
#endregion
|
||||
|
||||
private void DoMeshRequests()
|
||||
private static void DoMeshRequests()
|
||||
{
|
||||
while (true)
|
||||
while(true)
|
||||
{
|
||||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
|
||||
Watchdog.UpdateThread();
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
}
|
||||
}
|
||||
@@ -293,6 +295,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
UUID requestID = requestinfo.reqID;
|
||||
|
||||
if(m_scene.ShuttingDown)
|
||||
return;
|
||||
|
||||
// If the avatar is gone, don't bother to get the texture
|
||||
if (m_scene.GetScenePresence(Id) == null)
|
||||
{
|
||||
@@ -386,7 +391,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
private volatile int BytesSent = 0;
|
||||
private int Lod3 = 0;
|
||||
private int Lod2 = 0;
|
||||
private int Lod1 = 0;
|
||||
// private int Lod1 = 0;
|
||||
private int UserSetThrottle = 0;
|
||||
private int UDPSetThrottle = 0;
|
||||
private int CapSetThrottle = 0;
|
||||
@@ -404,7 +409,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
User = puser;
|
||||
}
|
||||
|
||||
|
||||
public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses)
|
||||
{
|
||||
const float ThirtyPercent = 0.30f;
|
||||
@@ -486,7 +490,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
PassTime();
|
||||
}
|
||||
|
||||
|
||||
private void PassTime()
|
||||
{
|
||||
currenttime = Util.EnvironmentTickCount();
|
||||
@@ -501,10 +504,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
Lod3 = 0;
|
||||
Lod2 = 0;
|
||||
Lod1 = 0;
|
||||
// Lod1 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AlterThrottle(int setting, ScenePresence p)
|
||||
{
|
||||
p.ControllingClient.SetAgentThrottleSilent((int)Throttle,setting);
|
||||
@@ -534,6 +538,5 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,14 +76,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
|
||||
private static Thread[] m_workerThreads = null;
|
||||
|
||||
private string m_Url = "localhost";
|
||||
|
||||
private static int m_NumberScenes = 0;
|
||||
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
||||
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
||||
|
||||
private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
|
||||
|
||||
private string m_Url = "localhost";
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
@@ -116,6 +115,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
|
||||
m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
|
||||
m_NumberScenes--;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
@@ -128,6 +128,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
|
||||
m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
|
||||
|
||||
m_NumberScenes++;
|
||||
|
||||
if (m_workerThreads == null)
|
||||
{
|
||||
m_workerThreads = new Thread[2];
|
||||
@@ -135,7 +137,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
for (uint i = 0; i < 2; i++)
|
||||
{
|
||||
m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests,
|
||||
String.Format("TextureWorkerThread{0}", i),
|
||||
String.Format("GetTextureWorker{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
false,
|
||||
@@ -165,17 +167,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
adjData = pthrottles;
|
||||
}
|
||||
|
||||
// 0.125f converts from bits to bytes
|
||||
//int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
||||
//pos += 4;
|
||||
// int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
||||
//pos += 4;
|
||||
// int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
||||
// pos += 4;
|
||||
// int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
||||
// pos += 4;
|
||||
// int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
||||
// pos += 4;
|
||||
pos = pos + 20;
|
||||
int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); //pos += 4;
|
||||
//int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
||||
@@ -199,7 +190,18 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
}
|
||||
|
||||
public void Close() { }
|
||||
public void Close()
|
||||
{
|
||||
if(m_NumberScenes <= 0 && m_workerThreads != null)
|
||||
{
|
||||
m_log.DebugFormat("[GetTextureModule] Closing");
|
||||
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
m_queue.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public string Name { get { return "GetTextureModule"; } }
|
||||
|
||||
@@ -210,13 +212,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
#endregion
|
||||
|
||||
~GetTextureModule()
|
||||
{
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
}
|
||||
|
||||
private class PollServiceTextureEventArgs : PollServiceEventArgs
|
||||
{
|
||||
private List<Hashtable> requests =
|
||||
@@ -306,11 +301,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
UUID requestID = requestinfo.reqID;
|
||||
|
||||
if(m_scene.ShuttingDown)
|
||||
return;
|
||||
|
||||
if (requestinfo.send503)
|
||||
{
|
||||
response = new Hashtable();
|
||||
|
||||
|
||||
response["int_response_code"] = 503;
|
||||
response["str_response_string"] = "Throttled";
|
||||
response["content_type"] = "text/plain";
|
||||
@@ -412,15 +409,16 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
}
|
||||
|
||||
private void DoTextureRequests()
|
||||
private static void DoTextureRequests()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
|
||||
Watchdog.UpdateThread();
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class CapsDataThrottler
|
||||
{
|
||||
|
||||
@@ -498,7 +496,5 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
public int ThrottleBytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
private static DoubleQueue<aPollRequest> m_queue =
|
||||
new DoubleQueue<aPollRequest>();
|
||||
|
||||
private static int m_NumberScenes = 0;
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public WebFetchInvDescModule() : this(true) {}
|
||||
@@ -145,17 +147,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
StatsManager.DeregisterStat(s_processedRequestsStat);
|
||||
StatsManager.DeregisterStat(s_queuedRequestsStat);
|
||||
|
||||
if (ProcessQueuedRequestsAsync)
|
||||
{
|
||||
if (m_workerThreads != null)
|
||||
{
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
m_workerThreads = null;
|
||||
}
|
||||
}
|
||||
|
||||
m_NumberScenes--;
|
||||
Scene = null;
|
||||
}
|
||||
|
||||
@@ -203,6 +195,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
Scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
|
||||
m_NumberScenes++;
|
||||
|
||||
int nworkers = 2; // was 2
|
||||
if (ProcessQueuedRequestsAsync && m_workerThreads == null)
|
||||
{
|
||||
@@ -225,7 +219,23 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
}
|
||||
|
||||
public void Close() { }
|
||||
public void Close()
|
||||
{
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if (ProcessQueuedRequestsAsync)
|
||||
{
|
||||
if (m_NumberScenes <= 0 && m_workerThreads != null)
|
||||
{
|
||||
m_log.DebugFormat("[WebFetchInvDescModule] Closing");
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
m_workerThreads = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Name { get { return "WebFetchInvDescModule"; } }
|
||||
|
||||
@@ -350,6 +360,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
public void Process(aPollRequest requestinfo)
|
||||
{
|
||||
if(m_module == null || m_module.Scene == null || m_module.Scene.ShuttingDown)
|
||||
return;
|
||||
|
||||
UUID requestID = requestinfo.reqID;
|
||||
|
||||
Hashtable response = new Hashtable();
|
||||
@@ -425,31 +438,26 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
// }
|
||||
// }
|
||||
|
||||
private void DoInventoryRequests()
|
||||
private static void DoInventoryRequests()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Watchdog.UpdateThread();
|
||||
|
||||
WaitProcessQueuedInventoryRequest();
|
||||
}
|
||||
}
|
||||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
|
||||
public void WaitProcessQueuedInventoryRequest()
|
||||
{
|
||||
aPollRequest poolreq = m_queue.Dequeue();
|
||||
|
||||
if (poolreq != null && poolreq.thepoll != null)
|
||||
{
|
||||
try
|
||||
if (poolreq != null && poolreq.thepoll != null)
|
||||
{
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[INVENTORY]: Failed to process queued inventory request {0} for {1} in {2}. Exception {3}",
|
||||
poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", Scene.Name, e);
|
||||
try
|
||||
{
|
||||
poolreq.thepoll.Process(poolreq);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[INVENTORY]: Failed to process queued inventory request {0} for {1}. Exception {3}",
|
||||
poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user