diff --git a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp index b83765d7..f8d1e91b 100644 --- a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp +++ b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp @@ -50,6 +50,10 @@ E_SIMPLE3(winfsp_event, debug, true, std::string, api_path, ap, E_FROM_STRING, NTSTATUS, result, res, E_FROM_INT32 ); + +E_SIMPLE(drive_stop_begin, info, true); +E_SIMPLE(drive_stop_end, info, true); +E_SIMPLE(drive_stop_timed_out, info, true); // clang-format on #define RAISE_WINFSP_EVENT(func, file, ret) \ @@ -137,10 +141,20 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, PWSTR * /*Argv*/) auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS { REPERTORY_USES_FUNCTION_NAME(); - timeout stop_timeout([]() { app_config::set_stop_requested(); }, 30s); + event_system::instance().raise(); + + timeout stop_timeout( + []() { + event_system::instance().raise(); + app_config::set_stop_requested(); + }, + 30s); host_.Unmount(); + stop_timeout.disable(); + event_system::instance().raise(); + if (not lock_.set_mount_state(false, "", -1)) { utils::error::raise_error(function_name, "failed to set mount state"); }