示例#1
0
            private static void OnSocketSendComplete(IAsyncResult result)
            {
                if (result.CompletedSynchronously)
                {
                    return;
                }

                SendAsyncResult thisPtr             = (SendAsyncResult)result.AsyncState;
                bool            completeSelf        = false;
                Exception       completionException = null;

                try
                {
                    completeSelf = thisPtr.ContinueTransmitting(result);

                    if (completeSelf && thisPtr.retransmissionEnabled)
                    {
                        completeSelf = thisPtr.BeginRetransmission();
                    }
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }

                    completionException = e;
                    completeSelf        = true;
                }

                if (completeSelf)
                {
                    thisPtr.CompleteAndCleanup(false, completionException);
                }
            }