mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
fix(replication): Handle errors instead of crashing. (#1757)
This commit is contained in:
parent
d964325f93
commit
254c86786e
2 changed files with 9 additions and 2 deletions
|
@ -106,7 +106,11 @@ std::error_code JournalReader::EnsureRead(size_t num) {
|
|||
// Try reading at least how much we need, but possibly more
|
||||
uint64_t read;
|
||||
SET_OR_RETURN(source_->ReadAtLeast(buf_.AppendBuffer(), remainder), read);
|
||||
CHECK(read >= remainder);
|
||||
|
||||
// Happens on end of stream (for example, a too-small string buffer or a closed socket)
|
||||
if (read < remainder) {
|
||||
return make_error_code(errc::io_error);
|
||||
}
|
||||
|
||||
buf_.CommitWrite(read);
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue