1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00

fix: invalid memory access fixed

This commit is contained in:
Falk Werner 2020-06-08 19:10:35 +02:00
parent 21dd96cdfb
commit df57043445

View File

@ -50,9 +50,8 @@ class Provider::Private
public: public:
explicit Private(char const * url) explicit Private(char const * url)
: is_shutdown_requested(false) : is_shutdown_requested(false)
, connection_state(ConnectionState::connecting)
{ {
ConnectionState connection_state = ConnectionState::connecting;
config = wfp_client_config_create(); config = wfp_client_config_create();
wfp_client_config_set_certpath(config, "client-cert.pem"); wfp_client_config_set_certpath(config, "client-cert.pem");
wfp_client_config_set_keypath(config, "client-key.pem"); wfp_client_config_set_keypath(config, "client-key.pem");
@ -92,6 +91,12 @@ public:
RequestShutdown(); RequestShutdown();
thread.join(); thread.join();
wfp_client_disconnect(client);
while (ConnectionState::disconnected != connection_state)
{
wfp_client_service(client);
}
wfp_client_dispose(client); wfp_client_dispose(client);
wfp_static_filesystem_dispose(fs); wfp_static_filesystem_dispose(fs);
@ -117,17 +122,12 @@ private:
{ {
wfp_client_service(context->client); wfp_client_service(context->client);
} }
wfp_client_disconnect(context->client);
while (wfp_impl_client_is_connected(context->client))
{
wfp_client_service(context->client);
}
} }
std::mutex shutdown_lock; std::mutex shutdown_lock;
std::thread thread; std::thread thread;
bool is_shutdown_requested; bool is_shutdown_requested;
ConnectionState connection_state;
wfp_client_config * config; wfp_client_config * config;
wfp_static_filesystem * fs; wfp_static_filesystem * fs;