Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiller committed Feb 20, 2025
1 parent a06dc40 commit ccb498e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
11 changes: 6 additions & 5 deletions src/core/ext/transport/chaotic_good_legacy/client_transport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ uint32_t ChaoticGoodClientTransport::MakeStream(CallHandler call_handler) {
}

namespace {
absl::Status BooleanSuccessToTransportError(bool success) {
return success ? absl::OkStatus()
: absl::UnavailableError("Transport closed.");
absl::Status BooleanSuccessToTransportError(StatusFlag success) {
return success.ok() ? absl::OkStatus()
: absl::UnavailableError("Transport closed.");
}
} // namespace

Expand Down Expand Up @@ -351,8 +351,9 @@ void ChaoticGoodClientTransport::StartCall(CallHandler call_handler) {
if (!result.ok()) {
GRPC_TRACE_LOG(chaotic_good, INFO)
<< "CHAOTIC_GOOD: Send cancel";
if (!sender.UnbufferedImmediateSend(
CancelFrame{stream_id})) {
if (!sender
.UnbufferedImmediateSend(CancelFrame{stream_id})
.ok()) {
GRPC_TRACE_LOG(chaotic_good, INFO)
<< "CHAOTIC_GOOD: Send cancel failed";
}
Expand Down
4 changes: 3 additions & 1 deletion src/core/ext/transport/chaotic_good_legacy/message_chunker.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "src/core/lib/promise/loop.h"
#include "src/core/lib/promise/map.h"
#include "src/core/lib/promise/seq.h"
#include "src/core/lib/promise/status_flag.h"

namespace grpc_core {
namespace chaotic_good_legacy {
Expand Down Expand Up @@ -105,7 +106,8 @@ class MessageChunker {
&output]() mutable {
auto next = chunker.NextChunk();
return Map(output.Send(std::move(next.frame)),
[done = next.done](bool x) -> LoopCtl<bool> {
[done = next.done](
StatusFlag x) -> LoopCtl<StatusFlag> {
if (!done) return Continue{};
return x;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ auto ChaoticGoodServerTransport::DispatchFrame(

namespace {
auto BooleanSuccessToTransportErrorCapturingInitiator(CallInitiator initiator) {
return [initiator = std::move(initiator)](bool success) {
return success ? absl::OkStatus()
: absl::UnavailableError("Transport closed.");
return [initiator = std::move(initiator)](StatusFlag success) {
return success.ok() ? absl::OkStatus()
: absl::UnavailableError("Transport closed.");
};
}
} // namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct Sender {
Sender& operator=(Sender&&) = delete;
auto Send(Frame frame) {
frames.emplace_back(std::move(frame));
return []() -> Poll<bool> { return true; };
return []() -> Poll<StatusFlag> { return Success{}; };
}
};

Expand All @@ -54,7 +54,7 @@ void MessageChunkerTest(uint32_t max_chunk_size, uint32_t alignment,
SliceBuffer(Slice::FromCopiedString(payload)),
message_flags),
stream_id, sender)(),
IsReady(true));
IsReady(Success{}));
if (max_chunk_size == 0) {
// No chunking ==> one frame with just a message.
EXPECT_EQ(sender.frames.size(), 1);
Expand Down

0 comments on commit ccb498e

Please sign in to comment.