Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions protobuf/echo/Echo.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "protobuf/echo/Echo.hpp"
#include "infra/util/ReallyAssert.hpp"

namespace services
{
Expand Down Expand Up @@ -35,13 +36,17 @@ namespace services

void ServiceProxy::RequestSend(infra::Function<void()> onGranted, uint32_t requestedSize)
{
really_assert(!inFlightRequest);
inFlightRequest = true;

this->onGranted = onGranted;
currentRequestedSize = requestedSize;
echo.RequestSend(*this);
}

infra::SharedPtr<MethodSerializer> ServiceProxy::GrantSend()
{
inFlightRequest = false;
onGranted();
return std::move(methodSerializer);
}
Expand Down
1 change: 1 addition & 0 deletions protobuf/echo/Echo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace services
infra::AutoResetFunction<void()> onGranted;
uint32_t currentRequestedSize = 0;
infra::SharedPtr<MethodSerializer> methodSerializer;
bool inFlightRequest = false;
};

class EchoPolicy
Expand Down
Loading