13 #ifndef __STOUT_OS_WINDOWS_SENDFILE_HPP__ 14 #define __STOUT_OS_WINDOWS_SENDFILE_HPP__ 28 const int_fd& s,
const int_fd& fd,
size_t length, OVERLAPPED* overlapped)
31 CHECK_LE(length, INT_MAX - 1);
33 const BOOL result = ::TransmitFile(
36 static_cast<DWORD>(length),
43 if (result == FALSE &&
44 (error.
code == WSA_IO_PENDING || error.
code == ERROR_IO_PENDING)) {
48 if (result == FALSE) {
59 const int_fd& s,
const int_fd& fd, off_t offset,
size_t length)
67 const uint64_t offset_ = offset;
76 OVERLAPPED from = from_.
get();
77 from.Offset =
static_cast<DWORD
>(offset_);
78 from.OffsetHigh =
static_cast<DWORD
>(offset_ >> 32);
91 if (::WSAGetOverlappedResult(s, &from, &sent, TRUE, &flags) == TRUE) {
100 #endif // __STOUT_OS_WINDOWS_SENDFILE_HPP__ T & get()&
Definition: try.hpp:80
static Result< T > error(const std::string &message)
Definition: result.hpp:54
Try< OVERLAPPED > init_overlapped_for_sync_io()
Definition: overlapped.hpp:30
Definition: error.hpp:108
Definition: posix_signalhandler.hpp:23
ErrnoError SocketError
Definition: error.hpp:33
const DWORD code
Definition: error.hpp:29
static Try error(const E &e)
Definition: try.hpp:43
bool isError() const
Definition: try.hpp:78
std::string error(const std::string &msg, uint32_t code)
T & get()&
Definition: result.hpp:116
Try< ssize_t, SocketError > sendfile(int s, int fd, off_t offset, size_t length)
Definition: sendfile.hpp:42
bool isSome() const
Definition: result.hpp:112
bool isError() const
Definition: result.hpp:114
int int_fd
Definition: int_fd.hpp:35
Result< size_t > sendfile_async(const int_fd &s, const int_fd &fd, size_t length, OVERLAPPED *overlapped)
Definition: sendfile.hpp:27