System.Net.WebConnectionStream.EndWrite C# (CSharp) Method

EndWrite() public method

public EndWrite ( IAsyncResult r ) : void
r IAsyncResult
return void
		public override void EndWrite (IAsyncResult r)
		{
			if (r == null)
				throw new ArgumentNullException ("r");

			WebAsyncResult result = r as WebAsyncResult;
			if (result == null)
				throw new ArgumentException ("Invalid IAsyncResult");

			if (result.EndCalled)
				return;

			if (sendChunked) {
				lock (locker) {
					pendingWrites--;
					if (pendingWrites <= 0)
						pending.Set ();
				}
			}

			result.EndCalled = true;
			if (result.AsyncWriteAll) {
				result.WaitUntilComplete ();
				if (result.GotException)
					throw result.Exception;
				return;
			}

			if (allowBuffering && !sendChunked)
				return;

			if (result.GotException)
				throw result.Exception;
		}