internal ConnectionGroup(System.Net.ServicePoint servicePoint, string connName) { this.m_ServicePoint = servicePoint; this.m_ConnectionLimit = servicePoint.ConnectionLimit; this.m_ConnectionList = new ArrayList(3); this.m_Name = MakeQueryStr(connName); this.m_AbortDelegate = new HttpAbortDelegate(this.Abort); }
public bool CheckValidationResult( System.Net.ServicePoint srvPoint, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Net.WebRequest request, int certificateProblem ) { return(true); }
public string Publish() { System.Net.ServicePoint point = System.Net.ServicePointManager.FindServicePoint(new Uri(LR_3DR_Bridge.LR_Integration_PublishURL()));; System.Net.ServicePointManager.CertificatePolicy = new AcceptAllCerts(); System.Net.WebClient wc = new System.Net.WebClient(); wc.Credentials = new System.Net.NetworkCredential(LR_3DR_Bridge.LR_Integration_NodeUsername(), LR_3DR_Bridge.LR_Integration_NodePassword()); string result = wc.UploadString(LR_3DR_Bridge.LR_Integration_PublishURL(), Serialize()); return(result); }
internal ConnectionPool(System.Net.ServicePoint servicePoint, int maxPoolSize, int minPoolSize, int idleTimeout, CreateConnectionDelegate createConnectionCallback) { this.m_CreateConnectionCallback = createConnectionCallback; this.m_MaxPoolSize = maxPoolSize; this.m_MinPoolSize = minPoolSize; this.m_ServicePoint = servicePoint; this.Initialize(); if (idleTimeout > 0) { this.m_CleanupQueue = TimerThread.GetOrCreateQueue((idleTimeout == 1) ? 1 : (idleTimeout / 2)); this.m_CleanupQueue.CreateTimer(s_CleanupCallback, this); } }
public static CloudQueue GetQueue(string queueName) { CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Settings.AzureWebJobsStorage); System.Net.ServicePoint servicePoint = System.Net.ServicePointManager.FindServicePoint(storageAccount.QueueEndpoint); servicePoint.UseNagleAlgorithm = false; CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); CloudQueue queue = queueClient.GetQueueReference(QueueNameResolver.GetQueueEnvironmentName(queueName)); queue.CreateIfNotExists(); return(queue); }
/// <summary> /// Recupera o callback usado para reciclar as conexões. /// </summary> /// <param name="servicePoint"></param> /// <returns></returns> private static System.Threading.TimerCallback GetIdleTimerCallback(this System.Net.ServicePoint servicePoint) { return(new System.Threading.TimerCallback(obj => { try { (_idleTimerCallback ?? (_idleTimerCallback = typeof(System.Net.ServicePoint).GetMethod("IdleTimerCallback", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance))).Invoke(servicePoint, new object[] { obj }); } catch (System.Reflection.TargetInvocationException ex) { throw ex.InnerException; } })); }
public static bool _FindServicePoint_System_Uri_System_Net_IWebProxy( ) { //Parameters System.Uri address = null; System.Net.IWebProxy proxy = null; //ReturnType/Value System.Net.ServicePoint returnVal_Real = null; System.Net.ServicePoint returnVal_Intercepted = null; //Exception Exception exception_Real = null; Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { returnValue_Real = System.Net.ServicePointManager.FindServicePoint(address, proxy); } catch (Exception e) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { returnValue_Intercepted = System.Net.ServicePointManager.FindServicePoint(address, proxy); } catch (Exception e) { exception_Intercepted = e; } Return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted)); }
/// <summary> /// Envia a requisição. /// </summary> /// <param name="servicePoint"></param> /// <param name="request"></param> /// <param name="groupName"></param> /// <returns></returns> public static EventHandler SendRequest(this System.Net.ServicePoint servicePoint, System.Net.HttpWebRequest request, string groupName) { object connection; object obj2 = servicePoint; lock (obj2) { bool flag2; connection = servicePoint.GetConnectionGroup(groupName).GetConnection(request, out flag2); if (flag2) { servicePoint.SetCurrentConnections(servicePoint.GetCurrentConnections() + 1); if (servicePoint.GetIdleTimer() == null) { var maxIdleTime = servicePoint.GetMaxIdleTime(); servicePoint.SetIdleTimer(new System.Threading.Timer(new System.Threading.TimerCallback(servicePoint.GetIdleTimerCallback()), null, maxIdleTime, maxIdleTime)); } } } return(WebConnectionExtensions.SendRequest(connection, request)); }
private static void SetIdleTimer(this System.Net.ServicePoint servicePoint, System.Threading.Timer value) { (_idleTimer ?? (_idleTimer = typeof(System.Net.ServicePoint).GetField("idleTimer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance))).SetValue(servicePoint, value); }
/// <summary> /// Recupera os grupos de conexão do ServicePoint. /// </summary> /// <param name="servicePoint"></param> /// <param name="groups"></param> /// <returns></returns> private static void SetGroups(this System.Net.ServicePoint servicePoint, System.Collections.IDictionary groups) { typeof(System.Net.ServicePoint).GetField("groups", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(servicePoint, groups); }
private static object GetConnectionGroup(this System.Net.ServicePoint servicePoint, string name) { return((_getConnectionGroup ?? (_getConnectionGroup = typeof(System.Net.ServicePoint).GetMethod("GetConnectionGroup", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic))).Invoke(servicePoint, new object[] { name })); }
/// <summary> /// Verifica se possui grupos disponível para reciclar. /// </summary> /// <param name="servicePoint"></param> /// <param name="outIdleSince"></param> /// <returns></returns> private static bool CheckAvailableForRecycling(this System.Net.ServicePoint servicePoint, out DateTime outIdleSince) { var groups = servicePoint.GetGroups(); TimeSpan span; outIdleSince = DateTime.MinValue; System.Collections.ArrayList list = null; System.Collections.ArrayList list2 = null; object obj2 = servicePoint; lock (obj2) { if ((groups == null) || (groups.Count == 0)) { servicePoint.SetIdleSince(DateTime.MinValue); return(true); } span = TimeSpan.FromMilliseconds((double)servicePoint.GetMaxIdleTime()); list = new System.Collections.ArrayList(groups.Values); } foreach (var group in list) { if (group.TryRecycle(span, ref outIdleSince)) { if (list2 == null) { list2 = new System.Collections.ArrayList(); } list2.Add(group); } } object obj3 = servicePoint; lock (obj3) { servicePoint.SetIdleSince(outIdleSince); if ((list2 != null) && (groups != null)) { foreach (var group2 in list2) { if (groups.Contains(WebConnectionGroupExtensions.GetName(group2))) { servicePoint.RemoveConnectionGroup(group2); } } } if ((groups != null) && (groups.Count == 0)) { groups = null; servicePoint.SetGroups(null); } if (groups == null) { if (servicePoint.GetIdleTimer() != null) { servicePoint.GetIdleTimer().Dispose(); servicePoint.SetIdleTimer(null); } return(true); } return(false); } }
/// <summary> /// Remove o grupo de conexão. /// </summary> /// <param name="servicePoint"></param> /// <param name="group"></param> private static void RemoveConnectionGroup(this System.Net.ServicePoint servicePoint, object group) { typeof(System.Net.ServicePoint).GetMethod("RemoveConnectionGroup", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(servicePoint, new object[] { group }); }
/// <summary> /// Recupera o tempo máximo para varredura. /// </summary> /// <param name="servicePoint"></param> /// <param name="value"></param> /// <returns></returns> private static void SetIdleSince(this System.Net.ServicePoint servicePoint, DateTime value) { typeof(System.Net.ServicePoint).GetField("idleSince", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).SetValue(servicePoint, value); }
/// <summary> /// Recupera o tempo máximo para varredura. /// </summary> /// <param name="servicePoint"></param> /// <returns></returns> private static int GetMaxIdleTime(this System.Net.ServicePoint servicePoint) { return((int)(_maxIdleTime ?? (_maxIdleTime = typeof(System.Net.ServicePoint).GetField("maxIdleTime", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance))).GetValue(servicePoint)); }
/// <summary> /// Recupera o atual número de conexões. /// </summary> /// <param name="servicePoint"></param> /// <returns></returns> private static int GetCurrentConnections(this System.Net.ServicePoint servicePoint) { return((int)(_currentConnections ?? (_currentConnections = typeof(System.Net.ServicePoint).GetField("currentConnections", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance))).GetValue(servicePoint)); }
/// <summary> /// Recupera os grupos de conexão do ServicePoint. /// </summary> /// <param name="servicePoint"></param> /// <returns></returns> private static System.Collections.IDictionary GetGroups(this System.Net.ServicePoint servicePoint) { return((System.Collections.IDictionary) typeof(System.Net.ServicePoint).GetField("groups", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(servicePoint)); }
/// <summary> /// Define o atual número de conexões. /// </summary> /// <param name="servicePoint"></param> /// <param name="value"></param> private static void SetCurrentConnections(this System.Net.ServicePoint servicePoint, int value) { (_currentConnections ?? (_currentConnections = typeof(System.Net.ServicePoint).GetField("currentConnections", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance))).SetValue(servicePoint, value); }
/// <summary> /// Define o ponto do serviço. /// </summary> /// <param name="request"></param> /// <param name="value"></param> private static void SetServicePoint(this System.Net.HttpWebRequest request, System.Net.ServicePoint value) { (_servicePoint ?? (_servicePoint = typeof(System.Net.HttpWebRequest).GetField("servicePoint", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic))).SetValue(request, value); }