diff options
Diffstat (limited to 'OpenSim/Framework/Communications/RestClient/RestClient.cs')
-rw-r--r-- | OpenSim/Framework/Communications/RestClient/RestClient.cs | 101 |
1 files changed, 52 insertions, 49 deletions
diff --git a/OpenSim/Framework/Communications/RestClient/RestClient.cs b/OpenSim/Framework/Communications/RestClient/RestClient.cs index 7212e5e..1178fed 100644 --- a/OpenSim/Framework/Communications/RestClient/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient/RestClient.cs | |||
@@ -195,15 +195,16 @@ namespace OpenSim.Framework.Communications | |||
195 | return s.Substring(s.Length - 1, 1) == "/"; | 195 | return s.Substring(s.Length - 1, 1) == "/"; |
196 | } | 196 | } |
197 | 197 | ||
198 | /// <summary> | 198 | // TODO: unused |
199 | /// return a slash or blank. A slash will be returned if the string does not contain one | 199 | // /// <summary> |
200 | /// </summary> | 200 | // /// return a slash or blank. A slash will be returned if the string does not contain one |
201 | /// <param name="s">stromg to be examined</param> | 201 | // /// </summary> |
202 | /// <returns>slash '/' if not already present</returns> | 202 | // /// <param name="s">stromg to be examined</param> |
203 | private string slash(string s) | 203 | // /// <returns>slash '/' if not already present</returns> |
204 | { | 204 | // private string slash(string s) |
205 | return isSlashed(s) ? String.Empty : "/"; | 205 | // { |
206 | } | 206 | // return isSlashed(s) ? String.Empty : "/"; |
207 | // } | ||
207 | 208 | ||
208 | /// <summary> | 209 | /// <summary> |
209 | /// Build a Uri based on the initial Url, path elements and parameters | 210 | /// Build a Uri based on the initial Url, path elements and parameters |
@@ -278,46 +279,48 @@ namespace OpenSim.Framework.Communications | |||
278 | } | 279 | } |
279 | } | 280 | } |
280 | 281 | ||
281 | /// <summary> | 282 | // TODO: unused |
282 | /// Async method, invoked when the initial response if received from the server | 283 | // /// <summary> |
283 | /// </summary> | 284 | // /// Async method, invoked when the initial response if received from the server |
284 | /// <param name="ar"></param> | 285 | // /// </summary> |
285 | private void ResponseIsReadyDelegate(IAsyncResult ar) | 286 | // /// <param name="ar"></param> |
286 | { | 287 | // private void ResponseIsReadyDelegate(IAsyncResult ar) |
287 | try | 288 | // { |
288 | { | 289 | // try |
289 | // grab response | 290 | // { |
290 | WebRequest wr = (WebRequest) ar.AsyncState; | 291 | // // grab response |
291 | _response = (HttpWebResponse) wr.EndGetResponse(ar); | 292 | // WebRequest wr = (WebRequest) ar.AsyncState; |
292 | 293 | // _response = (HttpWebResponse) wr.EndGetResponse(ar); | |
293 | // get response stream, and setup async reading | 294 | |
294 | Stream s = _response.GetResponseStream(); | 295 | // // get response stream, and setup async reading |
295 | IAsyncResult asynchronousResult = | 296 | // Stream s = _response.GetResponseStream(); |
296 | s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); | 297 | // IAsyncResult asynchronousResult = |
297 | 298 | // s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); | |
298 | // TODO! Implement timeout, without killing the server | 299 | |
299 | // wait until completed, or we timed out | 300 | // // TODO! Implement timeout, without killing the server |
300 | // ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); | 301 | // // wait until completed, or we timed out |
301 | } | 302 | // // ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); |
302 | catch (Exception e) | 303 | // } |
303 | { | 304 | // catch (Exception e) |
304 | _allDone.Set(); | 305 | // { |
305 | _asyncException = e; | 306 | // _allDone.Set(); |
306 | } | 307 | // _asyncException = e; |
307 | } | 308 | // } |
308 | 309 | // } | |
309 | // Abort the request if the timer fires. | 310 | |
310 | private static void TimeoutCallback(object state, bool timedOut) | 311 | // TODO: unused |
311 | { | 312 | // // Abort the request if the timer fires. |
312 | if (timedOut) | 313 | // private static void TimeoutCallback(object state, bool timedOut) |
313 | { | 314 | // { |
314 | HttpWebRequest request = state as HttpWebRequest; | 315 | // if (timedOut) |
315 | if (request != null) | 316 | // { |
316 | { | 317 | // HttpWebRequest request = state as HttpWebRequest; |
317 | request.Abort(); | 318 | // if (request != null) |
318 | } | 319 | // { |
319 | } | 320 | // request.Abort(); |
320 | } | 321 | // } |
322 | // } | ||
323 | // } | ||
321 | 324 | ||
322 | #endregion Async communications with server | 325 | #endregion Async communications with server |
323 | 326 | ||