Initial implementation of lpxclient

This commit is contained in:
2021-11-09 16:27:39 -05:00
parent 6172fb983c
commit 051e6bc8bf
7 changed files with 229 additions and 29 deletions

View File

@@ -364,6 +364,14 @@ public:
// Verify that the buffer is empty, if not, throw StreamCorruption.
void verify_empty();
// Make sure the specified number of bytes are available to read.
void check_available(int64_t bytes) {
int64_t avail = write_cursor_ - read_cursor_;
if (avail < bytes) {
throw StreamEof();
}
}
// Rewind the read cursor to a previous position.
void unread_to(int64_t total_reads);
@@ -429,14 +437,6 @@ private:
void wrote_space(int64_t bytes);
// Make sure the specified number of bytes are available to read.
void check_available(int64_t bytes) {
int64_t avail = write_cursor_ - read_cursor_;
if (avail < bytes) {
throw StreamEof();
}
}
// Implementation for the overwrite_int functions.
char *get_overwrite(int64_t size, int64_t write_count_after);
@@ -446,5 +446,4 @@ private:
friend int lfn_unittests_streambuffer(lua_State *L);
};
#endif // STREAMBUFFER_HPP