change share of almost empty class httpclient, to just share of used SocketsHttpHandler, This simpifies handling of timeout, otherwise problematic

This commit is contained in:
UbitUmarov
2023-05-26 20:27:24 +01:00
parent c90858576c
commit e950c502ad
13 changed files with 108 additions and 127 deletions

View File

@@ -41,6 +41,7 @@ using OpenSim.Region.Framework.Scenes;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
using OpenSim.Services.Interfaces;
using System.Net.Http;
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
@@ -597,9 +598,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
ArrayList SendParams = new ArrayList();
SendParams.Add(xmlrpcdata);
XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams);
HttpClient hclient = null;
try
{
XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, WebUtil.SharedHttpClientWithRedir, 6000);
hclient = WebUtil.GetNewGlobalHttpClient(10000);
XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, hclient);
Hashtable responseData = (Hashtable)GridResp.Value;
if (responseData.ContainsKey("success"))
{
@@ -621,6 +624,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{
m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0} : {1}", reginfo.ServerURI.ToString(), e.Message);
}
finally
{
hclient?.Dispose();
}
return false;
}