private static void IOCompleted(RequestStreamAsyncResult asyncResult, uint errorCode, uint numBytes) { try { // Zero-byte reads if (errorCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_MORE_DATA && asyncResult._size == 0) { // numBytes returns 1 to let us know there's data available. Don't count it against the request body size yet. asyncResult.Complete(0, errorCode); } else if (errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF) { asyncResult.Fail(new IOException(string.Empty, new HttpSysException((int)errorCode))); } else { // TODO: Verbose log dump data read asyncResult.Complete((int)numBytes, errorCode); } } catch (Exception e) { asyncResult.Fail(new IOException(string.Empty, e)); } }
private static void IOCompleted(RequestStreamAsyncResult asyncResult, uint errorCode, uint numBytes) { try { if (errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS && errorCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_HANDLE_EOF) { asyncResult.Fail(new IOException(string.Empty, new HttpSysException((int)errorCode))); } else { // TODO: Verbose log dump data read asyncResult.Complete((int)numBytes, errorCode); } } catch (Exception e) { asyncResult.Fail(new IOException(string.Empty, e)); } }