Skip to content

Commit 23483f7

Browse files
schoppmpcopybara-github
authored andcommitted
Fix ProcessClientMessages, and add variant taking the input as a string
PiperOrigin-RevId: 853836141
1 parent 7eaf73a commit 23483f7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

willow/src/api/server_accumulator.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,16 @@ WillowShellServerAccumulator::CreateFromSerializedState(
6060

6161
absl::Status WillowShellServerAccumulator::ProcessClientMessages(
6262
willow::ClientMessageList client_messages) {
63+
auto serialized_client_messages = client_messages.SerializeAsString();
6364
client_messages.Clear();
65+
return ProcessClientMessages(std::move(serialized_client_messages));
66+
}
67+
68+
absl::Status WillowShellServerAccumulator::ProcessClientMessages(
69+
std::string serialized_client_messages) {
6470
std::unique_ptr<std::string> status_message;
6571
int status_code = accumulator_->ProcessClientMessages(
66-
std::make_unique<std::string>(client_messages.SerializeAsString()),
72+
std::make_unique<std::string>(std::move(serialized_client_messages)),
6773
&status_message);
6874
if (status_code != 0) {
6975
return absl::Status(absl::StatusCode(status_code), *status_message);

willow/src/api/server_accumulator.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ class WillowShellServerAccumulator {
5050
// an error is logged and processing continues.
5151
absl::Status ProcessClientMessages(willow::ClientMessageList client_messages);
5252

53+
// Processes a list of client messages, given as a serialized
54+
// ClientMessageList proto.
55+
absl::Status ProcessClientMessages(std::string serialized_client_messages);
56+
5357
// Merges the state of `other` into the current accumulator.
5458
absl::Status Merge(std::unique_ptr<WillowShellServerAccumulator> other);
5559

0 commit comments

Comments
 (0)