aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/WebUtil.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index af25da9..77f3d9b 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -63,6 +63,31 @@ namespace OpenSim.Framework
63 // a "long" call for warning & debugging purposes 63 // a "long" call for warning & debugging purposes
64 public const int LongCallTime = 500; 64 public const int LongCallTime = 500;
65 65
66 // dictionary of end points
67 private static Dictionary<string,object> m_endpointSerializer = new Dictionary<string,object>();
68
69
70 private static object EndPointLock(string url)
71 {
72 System.Uri uri = new System.Uri(url);
73 string endpoint = string.Format("{0}:{1}",uri.Host,uri.Port);
74
75 lock (m_endpointSerializer)
76 {
77 object eplock = null;
78
79 if (! m_endpointSerializer.TryGetValue(endpoint,out eplock))
80 {
81 eplock = new object();
82 m_endpointSerializer.Add(endpoint,eplock);
83 // m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint);
84 }
85
86 return eplock;
87 }
88 }
89
90
66 #region JSONRequest 91 #region JSONRequest
67 92
68 /// <summary> 93 /// <summary>
@@ -96,6 +121,14 @@ namespace OpenSim.Framework
96 121
97 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed) 122 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed)
98 { 123 {
124 lock (EndPointLock(url))
125 {
126 return ServiceOSDRequestWorker(url,data,method,timeout,compressed);
127 }
128 }
129
130 private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed)
131 {
99 int reqnum = m_requestNumber++; 132 int reqnum = m_requestNumber++;
100 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); 133 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
101 134
@@ -248,6 +281,14 @@ namespace OpenSim.Framework
248 281
249 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) 282 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
250 { 283 {
284 lock (EndPointLock(url))
285 {
286 return ServiceFormRequestWorker(url,data,timeout);
287 }
288 }
289
290 private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout)
291 {
251 int reqnum = m_requestNumber++; 292 int reqnum = m_requestNumber++;
252 string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; 293 string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
253 // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method); 294 // m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method);