private void OpenWriteAsyncCallback(IAsyncResult result)
{
Stream stream = null;
Exception ex = null;
bool cancel = false;
InternalWebRequestStreamWrapper internal_stream;
try {
stream = request.EndGetRequestStream(result);
internal_stream = (InternalWebRequestStreamWrapper)stream;
internal_stream.WebClient = this;
internal_stream.WebClientData = callback_data;
}
catch (WebException web) {
cancel = (web.Status == WebExceptionStatus.RequestCanceled);
ex = web;
}
catch (Exception e) {
ex = e;
}
finally {
callback_data.sync_context.Post(delegate(object sender) {
OnOpenWriteCompleted(new OpenWriteCompletedEventArgs(stream, ex, cancel, callback_data.user_token));
}, null);
}
}