aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMelanie2012-09-14 00:15:10 +0200
committerMelanie2012-09-14 00:15:10 +0200
commit9f93bef1110e4f0152713e0ff0472bc55890d962 (patch)
tree3c61a0209e5290a2378c4db658dacaeec365cae8 /OpenSim/Framework
parentAllow some more connections to try to ease lag. (diff)
downloadopensim-SC_OLD-9f93bef1110e4f0152713e0ff0472bc55890d962.zip
opensim-SC_OLD-9f93bef1110e4f0152713e0ff0472bc55890d962.tar.gz
opensim-SC_OLD-9f93bef1110e4f0152713e0ff0472bc55890d962.tar.bz2
opensim-SC_OLD-9f93bef1110e4f0152713e0ff0472bc55890d962.tar.xz
Allow setting connection limits, part 2
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/WebUtil.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 6a40cd5..8094b6d 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -695,6 +695,13 @@ namespace OpenSim.Framework
695 public static void MakeRequest<TRequest, TResponse>(string verb, 695 public static void MakeRequest<TRequest, TResponse>(string verb,
696 string requestUrl, TRequest obj, Action<TResponse> action) 696 string requestUrl, TRequest obj, Action<TResponse> action)
697 { 697 {
698 MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, action, 0);
699 }
700
701 public static void MakeRequest<TRequest, TResponse>(string verb,
702 string requestUrl, TRequest obj, Action<TResponse> action,
703 int maxConnections)
704 {
698 int reqnum = WebUtil.RequestNumber++; 705 int reqnum = WebUtil.RequestNumber++;
699 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); 706 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
700 707
@@ -706,6 +713,10 @@ namespace OpenSim.Framework
706 Type type = typeof(TRequest); 713 Type type = typeof(TRequest);
707 714
708 WebRequest request = WebRequest.Create(requestUrl); 715 WebRequest request = WebRequest.Create(requestUrl);
716 HttpWebRequest ht = (HttpWebRequest)request;
717 if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
718 ht.ServicePoint.ConnectionLimit = maxConnections;
719
709 WebResponse response = null; 720 WebResponse response = null;
710 TResponse deserial = default(TResponse); 721 TResponse deserial = default(TResponse);
711 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 722 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
@@ -1003,6 +1014,11 @@ namespace OpenSim.Framework
1003 1014
1004 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) 1015 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
1005 { 1016 {
1017 return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0);
1018 }
1019
1020 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
1021 {
1006 int reqnum = WebUtil.RequestNumber++; 1022 int reqnum = WebUtil.RequestNumber++;
1007 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); 1023 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
1008 1024
@@ -1013,6 +1029,10 @@ namespace OpenSim.Framework
1013 TResponse deserial = default(TResponse); 1029 TResponse deserial = default(TResponse);
1014 1030
1015 WebRequest request = WebRequest.Create(requestUrl); 1031 WebRequest request = WebRequest.Create(requestUrl);
1032 HttpWebRequest ht = (HttpWebRequest)request;
1033 if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
1034 ht.ServicePoint.ConnectionLimit = maxConnections;
1035
1016 request.Method = verb; 1036 request.Method = verb;
1017 if (pTimeout != 0) 1037 if (pTimeout != 0)
1018 request.Timeout = pTimeout * 1000; 1038 request.Timeout = pTimeout * 1000;