Implemented tcp sockets (only IPv4) and asynchronous IO (for sockets).
This commit is contained in:
@@ -53,7 +53,7 @@ int ProcessStream::close()
|
||||
return result;
|
||||
}
|
||||
|
||||
StreamError ProcessStream::readRaw(std::span<std::uint8_t> buffer, bool partial, std::size_t* outBytesRead)
|
||||
StreamError ProcessStream::readRaw(std::span<std::uint8_t> buffer, const ReadOptions& options, std::size_t* outBytesRead)
|
||||
{
|
||||
assert(handle);
|
||||
assert(mode == FileOpenMode::READ || mode == FileOpenMode::READ_WRITE);
|
||||
@@ -67,7 +67,7 @@ StreamError ProcessStream::readRaw(std::span<std::uint8_t> buffer, bool partial,
|
||||
if (std::ferror(handle)) {
|
||||
return StreamError::IO_ERROR;
|
||||
}
|
||||
if (!partial && readBytes < buffer.size()) {
|
||||
if (!options.partial && readBytes < buffer.size()) {
|
||||
return StreamError::IO_ERROR;
|
||||
}
|
||||
if (outBytesRead != nullptr)
|
||||
@@ -134,7 +134,10 @@ StreamFeatures ProcessStream::getFeatures()
|
||||
.read = (mode == FileOpenMode::READ),
|
||||
.write = (mode == FileOpenMode::WRITE || mode == FileOpenMode::READ_WRITE),
|
||||
.tell = true,
|
||||
.seek = false
|
||||
.seek = false,
|
||||
.readOptions = {
|
||||
.partial = true
|
||||
}
|
||||
};
|
||||
}
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user