| 1841 | } |
| 1842 | |
| 1843 | WasiExpect<void> INode::sockSend(Span<Span<const uint8_t>> SiData, |
| 1844 | __wasi_siflags_t, |
| 1845 | __wasi_size_t &NWritten) const noexcept { |
| 1846 | EXPECTED_TRY(detail::ensureWSAStartup()); |
| 1847 | |
| 1848 | std::size_t TotalBufSize = 0; |
| 1849 | for (auto &IOV : SiData) { |
| 1850 | TotalBufSize += IOV.size(); |
| 1851 | } |
| 1852 | std::vector<uint8_t> TotalBuf(TotalBufSize); |
| 1853 | Span<uint8_t> TotalBufView(TotalBuf); |
| 1854 | for (auto &IOV : SiData) { |
| 1855 | std::copy_n(IOV.begin(), IOV.size(), TotalBufView.begin()); |
| 1856 | TotalBufView = TotalBufView.subspan(IOV.size()); |
| 1857 | } |
| 1858 | assuming(TotalBufView.empty()); |
| 1859 | |
| 1860 | if (auto Res = send(Socket, reinterpret_cast<char *>(TotalBuf.data()), |
| 1861 | static_cast<int>(TotalBuf.size()), 0); |
| 1862 | unlikely(Res == SOCKET_ERROR_)) { |
| 1863 | return WasiUnexpect(detail::fromWSALastError()); |
| 1864 | } else { |
| 1865 | NWritten = static_cast<__wasi_size_t>(Res); |
| 1866 | } |
| 1867 | |
| 1868 | return {}; |
| 1869 | } |
| 1870 | |
| 1871 | WasiExpect<void> INode::sockSendTo(Span<Span<const uint8_t>> SiData, |
| 1872 | __wasi_siflags_t, |
no test coverage detected