API: save to temp file first and then rename it

This commit is contained in:
SChernykh
2022-08-24 17:28:53 +02:00
parent 3ea5b575b7
commit 4599d81a59
2 changed files with 34 additions and 20 deletions

View File

@@ -46,9 +46,8 @@ private:
static void on_dump_to_file(uv_async_t* async) { reinterpret_cast<p2pool_api*>(async->data)->dump_to_file(); }
struct DumpFileWork {
uv_fs_t open_req;
uv_fs_t write_req;
uv_fs_t close_req;
uv_fs_t req;
int fd;
std::string name;
std::vector<char> buf;
@@ -77,6 +76,7 @@ private:
static void on_fs_open(uv_fs_t* req);
static void on_fs_write(uv_fs_t* req);
static void on_fs_close(uv_fs_t* req);
static void on_fs_rename(uv_fs_t* req);
std::string m_apiPath;
std::string m_networkPath;