Skip to content

Commit

Permalink
Override onHttpError rather than tcp onError
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 authored and mikee47 committed Mar 25, 2024
1 parent d15afb6 commit b833ffb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,20 @@ void HttpClientConnection::reset()
HttpConnection::reset();
}

void HttpClientConnection::onError(err_t err)
bool HttpClientConnection::onHttpError(HttpError error)
{
HttpConnection::onError(err);
bool res = HttpConnection::onHttpError(error);

auto request = waitingQueue.peek();
auto request = executionQueue.peek();

if(request != nullptr) {
auto callback = request->requestCompletedDelegate;
if(callback) {
callback(*this, false);
}
}

return res;
}

int HttpClientConnection::onMessageBegin(http_parser* parser)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ class HttpClientConnection : public HttpConnection
}

protected:
// HttpConnection methods
bool onHttpError(HttpError error) override;

// HTTP parser methods

int onMessageBegin(http_parser* parser) override;
Expand All @@ -68,7 +71,6 @@ class HttpClientConnection : public HttpConnection

// TCP methods
void onReadyToSendData(TcpConnectionEvent sourceEvent) override;
void onError(err_t err) override;

void onClosed() override;

Expand Down

0 comments on commit b833ffb

Please sign in to comment.