Skip to content

It's impossible to upgrade connection asynchroniously #26

Closed

Description

@kekekeks

If the response wasn't sent inside RequestHandler::onRequest and is sent later, RequestHandler will recieve EOM instead of upgrade.

I. e. this scenario does not work as expected:

void EchoHandler::onRequest(std::unique_ptr<HTTPMessage> headers) noexcept {
    auto ev = folly::EventBaseManager::get()->getExistingEventBase();
    std::thread([=](){
        //Do some logic here
        ev->runInEventBaseThread([=](){
            auto builder = make_unique<ResponseBuilder>(downstream_);
            builder->acceptUpgradeRequest(ResponseBuilder::UpgradeType::HTTP_UPGRADE, "websocket");
        });
    }).detach();
}

Activity

  1. kekekeks commented on Jan 2, 2015

    @kekekeks
    Author

    Oh, sorry. I figured out, that I should call pauseIngress/resumeIngress to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions