mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 18:25:33 +08:00
remove TAP also from rastclient
This commit is contained in:
@@ -32,7 +32,6 @@ using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
|
||||
@@ -325,7 +324,6 @@ namespace OpenSim.Framework
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
try
|
||||
{
|
||||
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
||||
@@ -335,9 +333,11 @@ namespace OpenSim.Framework
|
||||
_asyncException = null;
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
else
|
||||
_request.AllowWriteStreamBuffering = false;
|
||||
|
||||
if (WebUtil.DebugLevel >= 3)
|
||||
m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} REST {1} to {2}", reqnum, _request.Method, _request.RequestUri);
|
||||
m_log.DebugFormat("[REST CLIENT] {0} to {1}", _request.Method, _request.RequestUri);
|
||||
|
||||
using (_response = (HttpWebResponse) _request.GetResponse())
|
||||
{
|
||||
@@ -379,16 +379,15 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
if (WebUtil.DebugLevel >= 5)
|
||||
WebUtil.LogResponseDetail(reqnum, _resource);
|
||||
WebUtil.LogOutgoingDetail("[REST CLIENT]", _resource);
|
||||
|
||||
return _resource;
|
||||
}
|
||||
}
|
||||
|
||||
// just post data, ignoring result
|
||||
public async Task AsyncPOSTRequest(byte[] src, IServiceAuth auth)
|
||||
// just sync post data, ignoring result
|
||||
public void POSTRequest(byte[] src, IServiceAuth auth)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
try
|
||||
{
|
||||
_request = (HttpWebRequest)WebRequest.Create(buildUri());
|
||||
@@ -399,10 +398,12 @@ namespace OpenSim.Framework
|
||||
_request.ContentLength = src.Length;
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
else
|
||||
_request.AllowWriteStreamBuffering = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[REST]: AsyncPOST {0} failed with exception {1} {2}",
|
||||
m_log.WarnFormat("[REST]: POST {0} failed with exception {1} {2}",
|
||||
_request.RequestUri, e.Message, e.StackTrace);
|
||||
return;
|
||||
}
|
||||
@@ -411,19 +412,20 @@ namespace OpenSim.Framework
|
||||
{
|
||||
using (Stream dst = _request.GetRequestStream())
|
||||
{
|
||||
await dst.WriteAsync(src, 0, src.Length).ConfigureAwait(false);
|
||||
dst.Write(src, 0, src.Length);
|
||||
}
|
||||
|
||||
using(HttpWebResponse response = (HttpWebResponse)await _request.GetResponseAsync().ConfigureAwait(false))
|
||||
using(HttpWebResponse response = (HttpWebResponse)_request.GetResponse())
|
||||
{
|
||||
if (WebUtil.DebugLevel >= 5)
|
||||
using (Stream responseStream = response.GetResponseStream())
|
||||
{
|
||||
using (Stream responseStream = response.GetResponseStream())
|
||||
using (StreamReader reader = new StreamReader(responseStream))
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(responseStream))
|
||||
string responseStr = reader.ReadToEnd();
|
||||
if (WebUtil.DebugLevel >= 5)
|
||||
{
|
||||
string responseStr = await reader.ReadToEndAsync().ConfigureAwait(false);
|
||||
WebUtil.LogResponseDetail(reqnum, responseStr);
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
WebUtil.LogOutgoingDetail("REST POST", responseStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -431,7 +433,7 @@ namespace OpenSim.Framework
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
m_log.WarnFormat("[REST]: AsyncPOST {0} failed with status {1} and message {2}",
|
||||
m_log.WarnFormat("[REST]: POST {0} failed with status {1} and message {2}",
|
||||
_request.RequestUri, e.Status, e.Message);
|
||||
return;
|
||||
}
|
||||
@@ -443,45 +445,6 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
#region Async Invocation
|
||||
|
||||
public IAsyncResult BeginRequest(AsyncCallback callback, object state)
|
||||
{
|
||||
/// <summary>
|
||||
/// In case, we are invoked asynchroneously this object will keep track of the state
|
||||
/// </summary>
|
||||
AsyncResult<Stream> ar = new AsyncResult<Stream>(callback, state);
|
||||
Util.FireAndForget(RequestHelper, ar, "RestClient.BeginRequest");
|
||||
return ar;
|
||||
}
|
||||
|
||||
public Stream EndRequest(IAsyncResult asyncResult)
|
||||
{
|
||||
AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
|
||||
|
||||
// Wait for operation to complete, then return result or
|
||||
// throw exception
|
||||
return ar.EndInvoke();
|
||||
}
|
||||
|
||||
private void RequestHelper(Object asyncResult)
|
||||
{
|
||||
// We know that it's really an AsyncResult<DateTime> object
|
||||
AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
|
||||
try
|
||||
{
|
||||
// Perform the operation; if sucessful set the result
|
||||
MemoryStream s = Request(null);
|
||||
ar.SetAsCompleted(s, false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// If operation fails, set the exception
|
||||
ar.HandleException(e, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Async Invocation
|
||||
}
|
||||
|
||||
internal class SimpleAsyncResult : IAsyncResult
|
||||
|
||||
@@ -125,17 +125,15 @@ namespace OpenSim.Framework
|
||||
/// </remarks>
|
||||
public class STPInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public STPStartInfo STPStartInfo { get; set; }
|
||||
public WIGStartInfo WIGStartInfo { get; set; }
|
||||
public bool IsIdle { get; set; }
|
||||
public bool IsShuttingDown { get; set; }
|
||||
public int MaxThreads { get; set; }
|
||||
public int MinThreads { get; set; }
|
||||
public int InUseThreads { get; set; }
|
||||
public int ActiveThreads { get; set; }
|
||||
public int WaitingCallbacks { get; set; }
|
||||
public int MaxConcurrentWorkItems { get; set; }
|
||||
public string Name;
|
||||
public bool IsIdle;
|
||||
public bool IsShuttingDown;
|
||||
public int MaxThreads;
|
||||
public int MinThreads;
|
||||
public int InUseThreads;
|
||||
public int ActiveThreads;
|
||||
public int WaitingCallbacks;
|
||||
public int MaxConcurrentWorkItems;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3324,10 +3322,9 @@ namespace OpenSim.Framework
|
||||
if (m_ThreadPool == null)
|
||||
return null;
|
||||
|
||||
STPInfo stpi = new STPInfo()
|
||||
return new STPInfo()
|
||||
{
|
||||
Name = m_ThreadPool.Name,
|
||||
STPStartInfo = m_ThreadPool.STPStartInfo,
|
||||
IsIdle = m_ThreadPool.IsIdle,
|
||||
IsShuttingDown = m_ThreadPool.IsShuttingdown,
|
||||
MaxThreads = m_ThreadPool.MaxThreads,
|
||||
@@ -3337,7 +3334,6 @@ namespace OpenSim.Framework
|
||||
WaitingCallbacks = m_ThreadPool.WaitingCallbacks,
|
||||
MaxConcurrentWorkItems = m_ThreadPool.Concurrency
|
||||
};
|
||||
return stpi;
|
||||
}
|
||||
|
||||
public static void StopThreadPool()
|
||||
|
||||
@@ -35,7 +35,6 @@ using System.Xml.Serialization;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
@@ -186,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||
{
|
||||
}
|
||||
|
||||
public async Task Store(UUID agentId, WearableCacheItem[] data)
|
||||
public void Store(UUID agentId, WearableCacheItem[] data)
|
||||
{
|
||||
if (m_URL == String.Empty)
|
||||
return;
|
||||
@@ -237,18 +236,18 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||
|
||||
uploadData = bakeStream.ToArray();
|
||||
}
|
||||
//Util.FireAndForget(
|
||||
// delegate
|
||||
// {
|
||||
Util.FireAndForget(
|
||||
delegate
|
||||
{
|
||||
using(RestClient rc = new RestClient(m_URL))
|
||||
{
|
||||
rc.AddResourcePath("bakes/" + agentId.ToString());
|
||||
await rc.AsyncPOSTRequest(uploadData, m_Auth).ConfigureAwait(false);
|
||||
rc.POSTRequest(uploadData, m_Auth);
|
||||
m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", numberWears, agentId);
|
||||
}
|
||||
uploadData = null;
|
||||
// }, null, "XBakesModule.Store"
|
||||
//);
|
||||
}, null, "XBakesModule.Store"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenSim.Services.Interfaces
|
||||
WearableCacheItem[] Get(UUID id);
|
||||
|
||||
void Store(UUID id);
|
||||
Task Store(UUID id, WearableCacheItem[] WearableCache);
|
||||
void Store(UUID id, WearableCacheItem[] WearableCache);
|
||||
void UpdateMeshAvatar(UUID id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user