private bool HandleWriteUpgradeResponseComplete(IAsyncResult result) { bool flag; this.channel.Connection.EndWrite(result); IConnection innerConnection = this.channel.Connection; if (this.channel.size > 0) { innerConnection = new PreReadConnection(innerConnection, this.channel.connectionBuffer, this.channel.offset, this.channel.size); } if (onUpgradeConnection == null) { onUpgradeConnection = Fx.ThunkCallback(new AsyncCallback(ServerSessionPreambleConnectionReader.ServerFramingDuplexSessionChannel.OpenAsyncResult.OnUpgradeConnection)); } try { IAsyncResult result2 = InitialServerConnectionReader.BeginUpgradeConnection(innerConnection, this.channel.upgradeAcceptor, this.channel, onUpgradeConnection, this); if (!result2.CompletedSynchronously) { return false; } flag = this.HandleUpgradeConnectionComplete(result2); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } this.channel.WriteAuditFailure(this.channel.upgradeAcceptor as StreamSecurityUpgradeAcceptor, exception); throw; } return flag; }