Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BTReq Stream Methods #146

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions include/oxen/quic/btstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,13 @@ namespace oxen::quic
/// exception if the endpoint in this message should be considered not found.
void register_generic_handler(std::function<void(message)> request_handler);

/// Returns the number of requests/commands that are pending outbound transmission. These have
/// NOT been sent yet, rather they have been queued by the application
size_t num_pending() const;

/// Returns the number of sent requests awaiting response
size_t num_awaiting_response() const;

protected:
void check_timeouts() override;
void check_timeouts(std::optional<std::chrono::steady_clock::time_point> now);
Expand Down Expand Up @@ -280,5 +285,7 @@ namespace oxen::quic
size_t parse_length(std::string_view req);

size_t num_pending_impl() const { return user_buffers.size(); }

size_t num_awaiting_response_impl() const { return sent_reqs.size(); }
dr7ana marked this conversation as resolved.
Show resolved Hide resolved
};
} // namespace oxen::quic
5 changes: 5 additions & 0 deletions src/btstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,9 @@ namespace oxen::quic
return call_get_accessor(&BTRequestStream::num_pending_impl);
}

size_t BTRequestStream::num_awaiting_response() const
{
return call_get_accessor(&BTRequestStream::num_awaiting_response_impl);
}

} // namespace oxen::quic