Another step in the chain. Pipe the throttle update to the appropriate PollServiceTextureEventArgs. Each poll service having it's own throttle member is more consistent with the model then the region module keeping track of all of them globally and better for locking too. The Poll Services object is not set static to handle multiple nearby regions on the same simulator.
Next step is hooking it up to HasEventsavinationmerge
parent
4fa088bafb
commit
b7b96a5e4f
|
@ -68,7 +68,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
ret["content_type"] = "text/plain";
|
ret["content_type"] = "text/plain";
|
||||||
ret["keepalive"] = false;
|
ret["keepalive"] = false;
|
||||||
ret["reusecontext"] = false;
|
ret["reusecontext"] = false;
|
||||||
|
ret["int_bytes"] = 0;
|
||||||
string textureStr = (string)request["texture_id"];
|
string textureStr = (string)request["texture_id"];
|
||||||
string format = (string)request["format"];
|
string format = (string)request["format"];
|
||||||
|
|
||||||
|
@ -223,6 +223,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
|
response["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
|
||||||
response["bin_response_data"] = texture.Data;
|
response["bin_response_data"] = texture.Data;
|
||||||
|
response["int_bytes"] = texture.Data.Length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -232,6 +233,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
byte[] d = new byte[len];
|
byte[] d = new byte[len];
|
||||||
Array.Copy(texture.Data, start, d, 0, len);
|
Array.Copy(texture.Data, start, d, 0, len);
|
||||||
response["bin_response_data"] = d;
|
response["bin_response_data"] = d;
|
||||||
|
response["int_bytes"] = len;
|
||||||
}
|
}
|
||||||
// response.Body.Write(texture.Data, start, len);
|
// response.Body.Write(texture.Data, start, len);
|
||||||
}
|
}
|
||||||
|
@ -252,6 +254,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
response["content_type"] = "image/" + format;
|
response["content_type"] = "image/" + format;
|
||||||
|
|
||||||
response["bin_response_data"] = texture.Data;
|
response["bin_response_data"] = texture.Data;
|
||||||
|
response["int_bytes"] = texture.Data.Length;
|
||||||
|
|
||||||
// response.Body.Write(texture.Data, 0, texture.Data.Length);
|
// response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
public Hashtable request;
|
public Hashtable request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct aPollResponse
|
||||||
|
{
|
||||||
|
public Hashtable response;
|
||||||
|
public int bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -75,6 +82,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
||||||
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
||||||
|
|
||||||
|
private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
|
||||||
|
|
||||||
#region ISharedRegionModule Members
|
#region ISharedRegionModule Members
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
|
@ -147,7 +156,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// int wind = (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 cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||||
// int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
// int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||||
pos = pos + 16;
|
pos = pos + 20;
|
||||||
int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||||
//int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
//int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
||||||
return texture;
|
return texture;
|
||||||
|
@ -159,6 +168,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
byte[] throttles = p.ControllingClient.GetThrottlesPacked(1);
|
byte[] throttles = p.ControllingClient.GetThrottlesPacked(1);
|
||||||
UUID user = p.UUID;
|
UUID user = p.UUID;
|
||||||
int imagethrottle = ExtractImageThrottle(throttles);
|
int imagethrottle = ExtractImageThrottle(throttles);
|
||||||
|
PollServiceTextureEventArgs args;
|
||||||
|
if (m_pollservices.TryGetValue(user,out args))
|
||||||
|
{
|
||||||
|
args.UpdateThrottle(imagethrottle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -187,8 +201,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
private List<Hashtable> requests =
|
private List<Hashtable> requests =
|
||||||
new List<Hashtable>();
|
new List<Hashtable>();
|
||||||
private Dictionary<UUID, Hashtable> responses =
|
private Dictionary<UUID, aPollResponse> responses =
|
||||||
new Dictionary<UUID, Hashtable>();
|
new Dictionary<UUID, aPollResponse>();
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
|
||||||
|
@ -196,7 +210,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
base(null, null, null, null, pId, int.MaxValue)
|
base(null, null, null, null, pId, int.MaxValue)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
|
// x is request id, y is userid
|
||||||
HasEvents = (x, y) =>
|
HasEvents = (x, y) =>
|
||||||
{
|
{
|
||||||
lock (responses)
|
lock (responses)
|
||||||
|
@ -208,7 +222,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return responses[x];
|
return responses[x].response;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -216,14 +230,14 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// x is request id, y is request data hashtable
|
||||||
Request = (x, y) =>
|
Request = (x, y) =>
|
||||||
{
|
{
|
||||||
aPollRequest reqinfo = new aPollRequest();
|
aPollRequest reqinfo = new aPollRequest();
|
||||||
reqinfo.thepoll = this;
|
reqinfo.thepoll = this;
|
||||||
reqinfo.reqID = x;
|
reqinfo.reqID = x;
|
||||||
reqinfo.request = y;
|
reqinfo.request = y;
|
||||||
|
|
||||||
m_queue.Enqueue(reqinfo);
|
m_queue.Enqueue(reqinfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -265,16 +279,21 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
response["content_type"] = "text/plain";
|
response["content_type"] = "text/plain";
|
||||||
response["keepalive"] = false;
|
response["keepalive"] = false;
|
||||||
response["reusecontext"] = false;
|
response["reusecontext"] = false;
|
||||||
|
|
||||||
lock (responses)
|
lock (responses)
|
||||||
responses[requestID] = response;
|
responses[requestID] = new aPollResponse() {bytes = 0,response = response};
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
response = m_getTextureHandler.Handle(requestinfo.request);
|
response = m_getTextureHandler.Handle(requestinfo.request);
|
||||||
lock (responses)
|
lock (responses)
|
||||||
responses[requestID] = response;
|
responses[requestID] = new aPollResponse() { bytes = (int)response["int_bytes"], response = response};
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void UpdateThrottle(int pimagethrottle)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,19 +318,23 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
protocol = "https";
|
protocol = "https";
|
||||||
}
|
}
|
||||||
caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
|
caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
|
||||||
|
m_pollservices.Add(agentID, args);
|
||||||
m_capsDict[agentID] = capUrl;
|
m_capsDict[agentID] = capUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeregisterCaps(UUID agentID, Caps caps)
|
private void DeregisterCaps(UUID agentID, Caps caps)
|
||||||
{
|
{
|
||||||
string capUrl;
|
string capUrl;
|
||||||
|
PollServiceTextureEventArgs args;
|
||||||
if (m_capsDict.TryGetValue(agentID, out capUrl))
|
if (m_capsDict.TryGetValue(agentID, out capUrl))
|
||||||
{
|
{
|
||||||
MainServer.Instance.RemoveHTTPHandler("", capUrl);
|
MainServer.Instance.RemoveHTTPHandler("", capUrl);
|
||||||
m_capsDict.Remove(agentID);
|
m_capsDict.Remove(agentID);
|
||||||
}
|
}
|
||||||
|
if (m_pollservices.TryGetValue(agentID, out args))
|
||||||
|
{
|
||||||
|
m_pollservices.Remove(agentID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoTextureRequests()
|
private void DoTextureRequests()
|
||||||
|
|
Loading…
Reference in New Issue