Ejemplo n.º 1
0
            private static unsafe void Callback(uint errorCode, uint numBytes, NativeOverlapped *nativeOverlapped)
            {
                HttpRequestStream.HttpRequestStreamAsyncResult asyncResult = Overlapped.Unpack(nativeOverlapped).AsyncResult as HttpRequestStream.HttpRequestStreamAsyncResult;
                object result = null;

                try
                {
                    if ((errorCode != 0) && (errorCode != 0x26))
                    {
                        asyncResult.ErrorCode = (int)errorCode;
                        result = new HttpListenerException((int)errorCode);
                    }
                    else
                    {
                        result = numBytes;
                        if (Logging.On)
                        {
                            Logging.Dump(Logging.HttpListener, asyncResult, "Callback", (IntPtr)asyncResult.m_pPinnedBuffer, (int)numBytes);
                        }
                    }
                }
                catch (Exception exception)
                {
                    result = exception;
                }
                asyncResult.InvokeCallback(result);
            }