Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-09-25 05:05:14 +02:00
commit 96ebf7b029
3 changed files with 62 additions and 67 deletions

View File

@ -596,7 +596,7 @@ namespace OpenSim.Region.ClientStack.Linden
if(IsAtestUpload) // let user know, still showing cost estimation if(IsAtestUpload) // let user know, still showing cost estimation
warning += "Upload will have no cost, for personal test purposes only. Other uses are forbiden. Items may not work on another region"; warning += "Upload will have no cost, for testing purposes only. Other uses are prohibited. Items will not work after 48 hours or on other regions";
// check funds // check funds
else else
@ -982,7 +982,7 @@ namespace OpenSim.Region.ClientStack.Linden
} }
if(istest) if(istest)
prim.Description = "For personal testing only. Other uses are forbiden"; prim.Description = "For testing only. Other uses are prohibited";
else else
prim.Description = ""; prim.Description = "";
@ -1066,7 +1066,7 @@ namespace OpenSim.Region.ClientStack.Linden
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
if (istest) if (istest)
{ {
item.Description = "For personal testing only. Other uses are forbiden"; item.Description = "For testing only. Other uses are prohibited";
item.Flags = (uint) (InventoryItemFlags.SharedSingleReference); item.Flags = (uint) (InventoryItemFlags.SharedSingleReference);
} }
else else
@ -1541,7 +1541,7 @@ namespace OpenSim.Region.ClientStack.Linden
if (m_IsAtestUpload) if (m_IsAtestUpload)
{ {
LLSDAssetUploadError resperror = new LLSDAssetUploadError(); LLSDAssetUploadError resperror = new LLSDAssetUploadError();
resperror.message = "Upload SUCESSEFULL for testing purposes only. Other uses are forbiden. Item may not work on other region"; resperror.message = "Upload SUCESSEFULL for testing purposes only. Other uses are prohibited. Item will not work after 48 hours or on other regions";
resperror.identifier = inv; resperror.identifier = inv;
uploadComplete.error = resperror; uploadComplete.error = resperror;

View File

@ -53,6 +53,14 @@ namespace OpenSim.Region.ClientStack.Linden
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetTextureModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetTextureModule")]
public class GetTextureModule : INonSharedRegionModule public class GetTextureModule : INonSharedRegionModule
{ {
struct aPollRequest
{
public PollServiceTextureEventArgs thepoll;
public UUID reqID;
public Hashtable request;
}
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene; private Scene m_scene;
@ -64,8 +72,8 @@ namespace OpenSim.Region.ClientStack.Linden
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
private static Thread[] m_workerThreads = null; private static Thread[] m_workerThreads = null;
private static OpenMetaverse.BlockingQueue<PollServiceTextureEventArgs> m_queue = private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
new OpenMetaverse.BlockingQueue<PollServiceTextureEventArgs>(); new OpenMetaverse.BlockingQueue<aPollRequest>();
#region ISharedRegionModule Members #region ISharedRegionModule Members
@ -104,7 +112,7 @@ namespace OpenSim.Region.ClientStack.Linden
String.Format("TextureWorkerThread{0}", i), String.Format("TextureWorkerThread{0}", i),
ThreadPriority.Normal, ThreadPriority.Normal,
false, false,
true, false,
null, null,
int.MaxValue); int.MaxValue);
} }
@ -129,7 +137,8 @@ namespace OpenSim.Region.ClientStack.Linden
~GetTextureModule() ~GetTextureModule()
{ {
foreach (Thread t in m_workerThreads) foreach (Thread t in m_workerThreads)
t.Abort(); Watchdog.AbortThread(t.ManagedThreadId);
} }
private class PollServiceTextureEventArgs : PollServiceEventArgs private class PollServiceTextureEventArgs : PollServiceEventArgs
@ -142,7 +151,12 @@ namespace OpenSim.Region.ClientStack.Linden
private Scene m_scene; private Scene m_scene;
public PollServiceTextureEventArgs(UUID pId, Scene scene) : public PollServiceTextureEventArgs(UUID pId, Scene scene) :
base(null, null, null, null, pId, 30000) base(null, null, null, null, pId, int.MaxValue)
// this should never timeout
// each request must be processed and return a response
// noevents can possible be use for nice shutdown, but not sure now
// the execution will provide a proper response even if it fails
{ {
m_scene = scene; m_scene = scene;
@ -164,21 +178,24 @@ namespace OpenSim.Region.ClientStack.Linden
Request = (x, y) => Request = (x, y) =>
{ {
y["RequestID"] = x.ToString(); aPollRequest reqinfo = new aPollRequest();
lock (requests) reqinfo.thepoll = this;
requests.Add(y); reqinfo.reqID = x;
reqinfo.request = y;
m_queue.Enqueue(this); m_queue.Enqueue(reqinfo);
}; };
// this should never happen except possible on shutdown
NoEvents = (x, y) => NoEvents = (x, y) =>
{ {
/*
lock (requests) lock (requests)
{ {
Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString());
requests.Remove(request); requests.Remove(request);
} }
*/
Hashtable response = new Hashtable(); Hashtable response = new Hashtable();
response["int_response_code"] = 500; response["int_response_code"] = 500;
@ -191,27 +208,14 @@ namespace OpenSim.Region.ClientStack.Linden
}; };
} }
public void Process() public void Process(aPollRequest requestinfo)
{ {
Hashtable response; Hashtable response;
Hashtable request = null;
try UUID requestID = requestinfo.reqID;
{
lock (requests)
{
request = requests[0];
requests.RemoveAt(0);
}
}
catch
{
return;
}
UUID requestID = new UUID(request["RequestID"].ToString());
// If the avatar is gone, don't bother to get the texture // If the avatar is gone, don't bother to get the texture
if (m_scene.GetScenePresence(Id) == null) if (m_scene.GetScenePresence(Id) == null)
{ {
response = new Hashtable(); response = new Hashtable();
@ -228,7 +232,7 @@ namespace OpenSim.Region.ClientStack.Linden
return; return;
} }
response = m_getTextureHandler.Handle(request); response = m_getTextureHandler.Handle(requestinfo.request);
lock (responses) lock (responses)
responses[requestID] = response; responses[requestID] = response;
} }
@ -275,11 +279,10 @@ namespace OpenSim.Region.ClientStack.Linden
{ {
while (true) while (true)
{ {
PollServiceTextureEventArgs args = m_queue.Dequeue(); aPollRequest poolreq = m_queue.Dequeue();
args.Process(); poolreq.thepoll.Process(poolreq);
} }
} }
} }
} }

View File

@ -52,6 +52,13 @@ namespace OpenSim.Region.ClientStack.Linden
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class WebFetchInvDescModule : INonSharedRegionModule public class WebFetchInvDescModule : INonSharedRegionModule
{ {
struct aPollRequest
{
public PollServiceInventoryEventArgs thepoll;
public UUID reqID;
public Hashtable request;
}
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene; private Scene m_scene;
@ -64,8 +71,8 @@ namespace OpenSim.Region.ClientStack.Linden
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
private static Thread[] m_workerThreads = null; private static Thread[] m_workerThreads = null;
private static OpenMetaverse.BlockingQueue<PollServiceInventoryEventArgs> m_queue = private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
new OpenMetaverse.BlockingQueue<PollServiceInventoryEventArgs>(); new OpenMetaverse.BlockingQueue<aPollRequest>();
#region ISharedRegionModule Members #region ISharedRegionModule Members
@ -131,18 +138,16 @@ namespace OpenSim.Region.ClientStack.Linden
~WebFetchInvDescModule() ~WebFetchInvDescModule()
{ {
foreach (Thread t in m_workerThreads) foreach (Thread t in m_workerThreads)
t.Abort(); Watchdog.AbortThread(t.ManagedThreadId);
} }
private class PollServiceInventoryEventArgs : PollServiceEventArgs private class PollServiceInventoryEventArgs : PollServiceEventArgs
{ {
private List<Hashtable> requests =
new List<Hashtable>();
private Dictionary<UUID, Hashtable> responses = private Dictionary<UUID, Hashtable> responses =
new Dictionary<UUID, Hashtable>(); new Dictionary<UUID, Hashtable>();
public PollServiceInventoryEventArgs(UUID pId) : public PollServiceInventoryEventArgs(UUID pId) :
base(null, null, null, null, pId, 30000) base(null, null, null, null, pId, int.MaxValue)
{ {
HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
GetEvents = (x, y, s) => GetEvents = (x, y, s) =>
@ -162,21 +167,23 @@ namespace OpenSim.Region.ClientStack.Linden
Request = (x, y) => Request = (x, y) =>
{ {
y["RequestID"] = x.ToString(); aPollRequest reqinfo = new aPollRequest();
lock (requests) reqinfo.thepoll = this;
requests.Add(y); reqinfo.reqID = x;
reqinfo.request = y;
m_queue.Enqueue(this); m_queue.Enqueue(reqinfo);
}; };
NoEvents = (x, y) => NoEvents = (x, y) =>
{ {
/*
lock (requests) lock (requests)
{ {
Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString());
requests.Remove(request); requests.Remove(request);
} }
*/
Hashtable response = new Hashtable(); Hashtable response = new Hashtable();
response["int_response_code"] = 500; response["int_response_code"] = 500;
@ -189,24 +196,9 @@ namespace OpenSim.Region.ClientStack.Linden
}; };
} }
public void Process() public void Process(aPollRequest requestinfo)
{ {
Hashtable request = null; UUID requestID = requestinfo.reqID;
try
{
lock (requests)
{
request = requests[0];
requests.RemoveAt(0);
}
}
catch
{
return;
}
UUID requestID = new UUID(request["RequestID"].ToString());
Hashtable response = new Hashtable(); Hashtable response = new Hashtable();
@ -215,7 +207,8 @@ namespace OpenSim.Region.ClientStack.Linden
response["keepalive"] = false; response["keepalive"] = false;
response["reusecontext"] = false; response["reusecontext"] = false;
response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(request["body"].ToString(), String.Empty, String.Empty, null, null); response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(
requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null);
lock (responses) lock (responses)
responses[requestID] = response; responses[requestID] = response;
@ -226,8 +219,7 @@ namespace OpenSim.Region.ClientStack.Linden
{ {
string capUrl = "/CAPS/" + UUID.Random() + "/"; string capUrl = "/CAPS/" + UUID.Random() + "/";
// Register this as a poll service // Register this as a poll service
// absurd large timeout to tune later to make a bit less than viewer
PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID);
args.Type = PollServiceEventArgs.EventType.Inventory; args.Type = PollServiceEventArgs.EventType.Inventory;
@ -263,9 +255,9 @@ namespace OpenSim.Region.ClientStack.Linden
{ {
while (true) while (true)
{ {
PollServiceInventoryEventArgs args = m_queue.Dequeue(); aPollRequest poolreq = m_queue.Dequeue();
args.Process(); poolreq.thepoll.Process(poolreq);
} }
} }
} }