static void OnUpgrade(IAsyncResult result)
                {
                    if (result.CompletedSynchronously)
                    {
                        return;
                    }

                    SendPreambleAsyncResult thisPtr = (SendPreambleAsyncResult)result.AsyncState;

                    Exception completionException = null;
                    bool      completeSelf;

                    try
                    {
                        completeSelf = thisPtr.HandleUpgrade(result);
                    }
#pragma warning suppress 56500 // Microsoft, transferring exception to another thread
                    catch (Exception e)
                    {
                        if (Fx.IsFatal(e))
                        {
                            throw;
                        }

                        completeSelf        = true;
                        completionException = e;
                    }

                    if (completeSelf)
                    {
                        thisPtr.Complete(false, completionException);
                    }
                }
                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);
                }
                static void OnReadPreambleAck(object state)
                {
                    SendPreambleAsyncResult thisPtr = (SendPreambleAsyncResult)state;

                    Exception completionException = null;
                    bool      completeSelf;

                    try
                    {
                        completeSelf = thisPtr.HandlePreambleAck();
                    }
#pragma warning suppress 56500 // Microsoft, transferring exception to another thread
                    catch (Exception e)
                    {
                        if (Fx.IsFatal(e))
                        {
                            throw;
                        }

                        completeSelf        = true;
                        completionException = e;
                    }

                    if (completeSelf)
                    {
                        thisPtr.Complete(false, completionException);
                    }
                }
                public static IConnection End(IAsyncResult result, out SecurityMessageProperty remoteSecurity)
                {
                    SendPreambleAsyncResult thisPtr = AsyncResult.End <SendPreambleAsyncResult>(result);

                    remoteSecurity = thisPtr.remoteSecurity;
                    return(thisPtr.connection);
                }
Ejemplo n.º 5
0
                static void OnWritePreambleEnd(object asyncState)
                {
                    SendPreambleAsyncResult thisPtr = (SendPreambleAsyncResult)asyncState;

                    Exception completionException = null;
                    bool      completeSelf;

                    try
                    {
                        thisPtr.connection.EndWrite();
                        completeSelf = thisPtr.ReadPreambleAck();
                    }
#pragma warning suppress 56500 // [....], transferring exception to another thread
                    catch (Exception e)
                    {
                        if (Fx.IsFatal(e))
                        {
                            throw;
                        }

                        completeSelf        = true;
                        completionException = e;
                    }

                    if (completeSelf)
                    {
                        thisPtr.Complete(false, completionException);
                    }
                }
 protected override IConnection EndAcceptPooledConnection(IAsyncResult result)
 {
     return(SendPreambleAsyncResult.End(result, out this.remoteSecurity));
 }
Ejemplo n.º 7
0
 private IConnection EndSendPreamble(IAsyncResult result)
 {
     return(SendPreambleAsyncResult.End(result));
 }