Skip to content
Snippets Groups Projects
Commit 68188721 authored by Konstantinos Sideris's avatar Konstantinos Sideris
Browse files

Add option to shutdown connection before joining threads

parent e45b1c85
No related branches found
No related tags found
No related merge requests found
......@@ -96,7 +96,7 @@ public:
Client(const std::string &server = "", uint16_t port = 443);
//! Wait for the client to close.
void close();
void close(bool force = false);
//! Set the homeserver domain name.
void set_user(const mtx::identifiers::User &user) { user_id_ = user; }
//! Set the device ID.
......
......@@ -38,13 +38,17 @@ Client::set_server(const std::string &server)
}
void
Client::close()
Client::close(bool force)
{
// Destroy work object. This allows the I/O thread to
// exit the event loop when there are no more pending
// asynchronous operations.
work_.reset();
// We close all open connections.
if (force)
shutdown();
// Wait for the worker threads to exit.
thread_group_.join_all();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment