static void OnFailedUpgrade(IAsyncResult result) { if (result.CompletedSynchronously) { return; } SendPreambleAsyncResult thisPtr = (SendPreambleAsyncResult)result.AsyncState; Exception completionException = null; try { ConnectionUpgradeHelper.EndDecodeFramingFault(result); } #pragma warning suppress 56500 // Microsoft, transferring exception to another thread catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completionException = e; } thisPtr.Complete(false, completionException); }
bool HandlePreambleAck() { int ackBytesRead = connection.EndRead(); if (!ConnectionUpgradeHelper.ValidatePreambleResponse( connection.AsyncReadBuffer, ackBytesRead, decoder, channel.Via)) { if (onFailedUpgrade == null) { onFailedUpgrade = Fx.ThunkCallback(new AsyncCallback(OnFailedUpgrade)); } IAsyncResult decodeFaultResult = ConnectionUpgradeHelper.BeginDecodeFramingFault(decoder, connection, channel.Via, channel.messageEncoder.ContentType, ref timeoutHelper, onFailedUpgrade, this); if (!decodeFaultResult.CompletedSynchronously) { return(false); } ConnectionUpgradeHelper.EndDecodeFramingFault(decodeFaultResult); return(true); } return(true); }
private bool HandlePreambleAck() { int count = this.connection.EndRead(); if (!ConnectionUpgradeHelper.ValidatePreambleResponse(this.connection.AsyncReadBuffer, count, this.channel.decoder, this.channel.Via)) { IAsyncResult result = ConnectionUpgradeHelper.BeginDecodeFramingFault(this.channel.decoder, this.connection, this.channel.Via, this.channel.MessageEncoder.ContentType, ref this.timeoutHelper, Fx.ThunkCallback(new AsyncCallback(this.OnFailedPreamble)), this); if (!result.CompletedSynchronously) { return(false); } ConnectionUpgradeHelper.EndDecodeFramingFault(result); } return(true); }
private bool HandlePreambleAck() { int count = this.connection.EndRead(); if (!ConnectionUpgradeHelper.ValidatePreambleResponse(this.connection.AsyncReadBuffer, count, this.decoder, this.channel.Via)) { if (onFailedUpgrade == null) { onFailedUpgrade = Fx.ThunkCallback(new AsyncCallback(StreamedFramingRequestChannel.StreamedConnectionPoolHelper.SendPreambleAsyncResult.OnFailedUpgrade)); } IAsyncResult result = ConnectionUpgradeHelper.BeginDecodeFramingFault(this.decoder, this.connection, this.channel.Via, this.channel.messageEncoder.ContentType, ref this.timeoutHelper, onFailedUpgrade, this); if (!result.CompletedSynchronously) { return(false); } ConnectionUpgradeHelper.EndDecodeFramingFault(result); } return(true); }
private void OnFailedPreamble(IAsyncResult result) { if (!result.CompletedSynchronously) { Exception exception = null; try { ConnectionUpgradeHelper.EndDecodeFramingFault(result); } catch (Exception exception2) { if (Fx.IsFatal(exception2)) { throw; } exception = exception2; } base.Complete(false, exception); } }
private static void OnFailedUpgrade(IAsyncResult result) { if (!result.CompletedSynchronously) { ConnectionUpgradeHelper.InitiateUpgradeAsyncResult asyncState = (ConnectionUpgradeHelper.InitiateUpgradeAsyncResult)result.AsyncState; Exception exception = null; try { ConnectionUpgradeHelper.EndDecodeFramingFault(result); } catch (Exception exception2) { if (Fx.IsFatal(exception2)) { throw; } exception = exception2; } asyncState.Complete(false, exception); } }
private static void OnFailedUpgrade(IAsyncResult result) { if (!result.CompletedSynchronously) { StreamedFramingRequestChannel.StreamedConnectionPoolHelper.SendPreambleAsyncResult asyncState = (StreamedFramingRequestChannel.StreamedConnectionPoolHelper.SendPreambleAsyncResult)result.AsyncState; Exception exception = null; try { ConnectionUpgradeHelper.EndDecodeFramingFault(result); } catch (Exception exception2) { if (Fx.IsFatal(exception2)) { throw; } exception = exception2; } asyncState.Complete(false, exception); } }
private bool CompleteReadUpgradeResponse() { int count = this.connection.EndRead(); if (!ConnectionUpgradeHelper.ValidateUpgradeResponse(this.connection.AsyncReadBuffer, count, this.decoder)) { if (onFailedUpgrade == null) { onFailedUpgrade = Fx.ThunkCallback(new AsyncCallback(ConnectionUpgradeHelper.InitiateUpgradeAsyncResult.OnFailedUpgrade)); } IAsyncResult result = ConnectionUpgradeHelper.BeginDecodeFramingFault(this.decoder, this.connection, this.remoteAddress.Uri, this.contentType, ref this.timeoutHelper, onFailedUpgrade, this); if (result.CompletedSynchronously) { ConnectionUpgradeHelper.EndDecodeFramingFault(result); } return(result.CompletedSynchronously); } this.connectionStream = new ConnectionStream(this.connection, this.defaultTimeouts); IAsyncResult result2 = null; WindowsImpersonationContext context = (this.identityToImpersonate == null) ? null : this.identityToImpersonate.Impersonate(); try { using (context) { result2 = this.upgradeInitiator.BeginInitiateUpgrade(this.connectionStream, onInitiateUpgrade, this); } } catch { throw; } if (!result2.CompletedSynchronously) { return(false); } this.CompleteUpgrade(result2); return(true); }