protected override void FinishCurrentChange(BaseAsyncResult.PerRequest pereq) { base.FinishCurrentChange(pereq); if (this.ResponseStream.Position != 0L) { this.ResponseStream.Position = 0L; this.HandleOperationResponseData(this.httpWebResponse, this.ResponseStream); } else { this.HandleOperationResponseData(this.httpWebResponse, null); } pereq.Dispose(); base.perRequest = null; if (!pereq.RequestCompletedSynchronously && !base.IsCompletedInternally) { this.BeginCreateNextChange(); } }
protected override void HandleCompleted(BaseAsyncResult.PerRequest pereq) { if (pereq != null) { base.SetCompletedSynchronously(pereq.RequestCompletedSynchronously); if (pereq.RequestCompleted) { Interlocked.CompareExchange<BaseAsyncResult.PerRequest>(ref this.perRequest, null, pereq); if (this.IsBatch) { Interlocked.CompareExchange<HttpWebResponse>(ref this.batchResponse, pereq.HttpWebResponse, null); pereq.HttpWebResponse = null; } pereq.Dispose(); } } base.HandleCompleted(); }