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

fix client session Unknown error #7

Open
wants to merge 1 commit into
base: main
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
2 changes: 1 addition & 1 deletion lib/asio_client_session_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ const request *session_impl::submit(boost::system::error_code &ec,
ec.clear();

if (stopped_) {
ec = make_error_code(static_cast<nghttp2_error>(NGHTTP2_INTERNAL_ERROR));
ec = make_error_code(static_cast<nghttp2_error_code>(NGHTTP2_INTERNAL_ERROR));
return nullptr;
}

Expand Down
16 changes: 16 additions & 0 deletions lib/asio_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ boost::system::error_code make_error_code(nghttp2_asio_error ev) {
nghttp2_asio_category());
}

class nghttp2_error_code_category_impl : public boost::system::error_category {
public:
const char *name() const noexcept { return "nghttp2_error_code"; }
std::string message(int ev) const noexcept { return nghttp2_http2_strerror(ev); }
};

const boost::system::error_category &nghttp2_error_code_category() noexcept {
static nghttp2_error_code_category_impl cat;
return cat;
}

boost::system::error_code make_error_code(nghttp2_error_code ev){
return boost::system::error_code(static_cast<int>(ev),
nghttp2_error_code_category());
}

generator_cb string_generator(std::string data) {
auto strio = std::make_shared<std::pair<std::string, size_t>>(std::move(data),
data.size());
Expand Down
2 changes: 2 additions & 0 deletions lib/asio_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ boost::system::error_code make_error_code(nghttp2_error ev);

boost::system::error_code make_error_code(nghttp2_asio_error ev);

boost::system::error_code make_error_code(nghttp2_error_code ev);

generator_cb string_generator(std::string data);

// Returns generator_cb, which just returns NGHTTP2_ERR_DEFERRED
Expand Down