More work on client and server

This commit is contained in:
2021-11-11 13:56:49 -05:00
parent 051e6bc8bf
commit caa5bab9d3
6 changed files with 314 additions and 199 deletions

View File

@@ -97,6 +97,22 @@ void PrintBuffer::patch(StreamBuffer *sb) {
}
}
bool PrintChanneler::channel(const PrintBuffer *printbuffer, std::ostream &ostream) {
if (printbuffer == nullptr) return false;
if (printbuffer->first_line() > line_) {
line_ = printbuffer->first_line();
}
while (line_ < printbuffer->first_unchecked()) {
ostream << printbuffer->nth(line_) << std::endl;
line_ += 1;
}
return line_ > printbuffer->first_line();
}
Invocation PrintChanneler::invocation(int64_t actor_id) {
return Invocation(Invocation::KIND_FLUSH_PRINTS, actor_id, actor_id, std::to_string(line_), InvocationData());
}
LuaDefine(unittests_printbuffer, "c") {
PrintBuffer pbm(util::WORLD_TYPE_MASTER);
PrintBuffer pbs(util::WORLD_TYPE_S_SYNC);