Skip to content

Commit

Permalink
fcgi/Client: eliminate redundant DestructObserver instance
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Jan 13, 2025
1 parent 5935002 commit 20c65cf
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/fcgi/Client.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class FcgiClient final
*
* @return false if the connection was closed
*/
bool SubmitResponse() noexcept;
bool SubmitResponse(const DestructObserver &destructed) noexcept;

/**
* The END_REQUEST packet was received completely. This
Expand Down Expand Up @@ -509,7 +509,7 @@ FcgiClient::Feed(std::span<const std::byte> src) noexcept
}

inline bool
FcgiClient::SubmitResponse() noexcept
FcgiClient::SubmitResponse(const DestructObserver &destructed) noexcept
{
assert(!response.receiving_headers);

Expand Down Expand Up @@ -545,8 +545,6 @@ FcgiClient::SubmitResponse() noexcept
response.available = l;
}

const DestructObserver destructed(*this);

response.in_handler = true;
handler.InvokeResponse(status, std::move(response.headers),
UnusedIstreamPtr(this));
Expand Down Expand Up @@ -697,7 +695,7 @@ FcgiClient::ConsumeInput(std::span<const std::byte> src) noexcept
/* the read_state has been switched from HEADERS to
BODY: we have to deliver the response now */

return SubmitResponse()
return SubmitResponse(destructed)
/* continue parsing the response body from the
buffer */
? BufferedResult::AGAIN
Expand Down

0 comments on commit 20c65cf

Please sign in to comment.