private void HandleError(WebExceptionStatus st, Exception e, string where) { status = st; lock (this) { if (st == WebExceptionStatus.RequestCanceled) { Data = new WebConnectionData(); } } if (e == null) { try { throw new Exception(new StackTrace().ToString()); IL_0043 :; } catch (Exception ex) { e = ex; } } HttpWebRequest httpWebRequest = null; if (Data != null && Data.request != null) { httpWebRequest = Data.request; } Close(sendNext: true); if (httpWebRequest != null) { httpWebRequest.FinishedReading = true; httpWebRequest.SetResponseError(st, e, where); } }
void HandleError(WebExceptionStatus st, Exception e, string where) { status = st; lock (this) { if (st == WebExceptionStatus.RequestCanceled) { Data = new WebConnectionData(); } } if (e == null) // At least we now where it comes from { try { #if TARGET_JVM throw new Exception(); #else throw new Exception(new System.Diagnostics.StackTrace().ToString()); #endif } catch (Exception e2) { e = e2; } } HttpWebRequest req = null; if (Data != null && Data.request != null) { req = Data.request; } Close(true); if (req != null) { req.SetResponseError(st, e, where); } }
private void Abort(object sender, EventArgs args) { lock (this) { Queue obj = this.queue; lock (obj) { HttpWebRequest httpWebRequest = (HttpWebRequest)sender; if (this.Data.request == httpWebRequest) { if (!httpWebRequest.FinishedReading) { this.status = WebExceptionStatus.RequestCanceled; this.Close(false); if (this.queue.Count > 0) { this.Data.request = (HttpWebRequest)this.queue.Dequeue(); this.SendRequest(this.Data.request); } } } else { httpWebRequest.FinishedReading = true; httpWebRequest.SetResponseError(WebExceptionStatus.RequestCanceled, null, "User aborted"); if (this.queue.Count > 0 && this.queue.Peek() == sender) { this.queue.Dequeue(); } else if (this.queue.Count > 0) { object[] array = this.queue.ToArray(); this.queue.Clear(); for (int i = array.Length - 1; i >= 0; i--) { if (array[i] != sender) { this.queue.Enqueue(array[i]); } } } } } } }
private void Abort(object sender, EventArgs args) { lock (this) { lock (queue) { HttpWebRequest httpWebRequest = (HttpWebRequest)sender; if (Data.request == httpWebRequest) { if (!httpWebRequest.FinishedReading) { status = WebExceptionStatus.RequestCanceled; Close(sendNext: false); if (queue.Count > 0) { Data.request = (HttpWebRequest)queue.Dequeue(); SendRequest(Data.request); } } } else { httpWebRequest.FinishedReading = true; httpWebRequest.SetResponseError(WebExceptionStatus.RequestCanceled, null, "User aborted"); if (queue.Count > 0 && queue.Peek() == sender) { queue.Dequeue(); } else if (queue.Count > 0) { object[] array = queue.ToArray(); queue.Clear(); for (int num = array.Length - 1; num >= 0; num--) { if (array[num] != sender) { queue.Enqueue(array[num]); } } } } } } }
void Abort(object sender, EventArgs args) { lock (this) { lock (queue) { HttpWebRequest req = (HttpWebRequest)sender; if (Data.request == req) { if (!req.FinishedReading) { status = WebExceptionStatus.RequestCanceled; Close(false); if (queue.Count > 0) { Data.request = (HttpWebRequest)queue.Dequeue(); SendRequest(Data.request); } } return; } req.FinishedReading = true; req.SetResponseError(WebExceptionStatus.RequestCanceled, null, "User aborted"); if (queue.Count > 0 && queue.Peek() == sender) { queue.Dequeue(); } else if (queue.Count > 0) { object [] old = queue.ToArray(); queue.Clear(); for (int i = old.Length - 1; i >= 0; i--) { if (old [i] != sender) { queue.Enqueue(old [i]); } } } } } }