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

TLS and Websocket connection is serialized unexpectedly #298

Closed
redboltz opened this issue Jun 25, 2019 · 0 comments
Closed

TLS and Websocket connection is serialized unexpectedly #298

redboltz opened this issue Jun 25, 2019 · 0 comments

Comments

@redboltz
Copy link
Owner

Problem

When I test my broker that uses mqtt_cpp, I noticed that accepting process of server_tls, server_ws, and server_tls_ws behaves unexpectedly.

The function do_accept() is called after asynchronous underlying processes (handshake, websocket upgrade, etc) are finished.
If underlying processes are stuck, then the next do_accept() isn't called until timeout(#295 ) happens.

Solution

The next do_accept() should be called in the TCP accept handler.
Then asynchronous underlying processes can run concurrently each sockets.

Required change

Remove std::unique_ptr<socket_t> socket_ member variables. It is avoiding concurrent process.

std::unique_ptr<socket_t> socket_;

Instead of that, create socket_t object locally each do_accept() call. This is common accepting pattern. It requires std::shared_ptr<socket_t> for the local variable socket.

acceptor_.value().async_accept(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant