Fixed incorrect hpfs process kill on read-request.

This commit is contained in:
ravinsp
2020-10-27 15:52:26 +05:30
parent 116a54e980
commit 3481961aa8

View File

@@ -199,10 +199,15 @@ namespace sc
{
// In readonly mode, we must start the hpfs process first.
// In RW mode, there is a global hpfs RW process so we only need to create an fs session.
if (ctx.args.readonly && hpfs::start_ro_rw_process(ctx.hpfs_pid, ctx.args.state_dir, true, false, false) == -1)
return -1;
if (ctx.args.readonly)
{
if (hpfs::start_ro_rw_process(ctx.hpfs_pid, ctx.args.state_dir, true, false, false) == -1)
return -1;
}
else
{
ctx.hpfs_pid = hpfs_rw_pid;
}
if (hpfs::start_fs_session(ctx.args.state_dir) == -1)
return -1;
@@ -222,14 +227,14 @@ namespace sc
LOG_DEBUG << "Stopping hpfs contract session..." << (ctx.args.readonly ? " (rdonly)" : "");
// In readonly mode, we must also stop the hpfs process itself.
// In RW mode, we only need to stop the fs session and let the RW process keep running.
if (ctx.args.readonly && util::kill_process(ctx.hpfs_pid, true) == -1)
result = -1;
if (hpfs::stop_fs_session(ctx.args.state_dir) == -1)
return -1;
// In readonly mode, we must also stop the hpfs process itself after sopping the session.
// In RW mode, we only need to stop the fs session and let the process keep running.
if (ctx.args.readonly && util::kill_process(ctx.hpfs_pid, true) == -1)
result = -1;
ctx.hpfs_pid = 0;
return result;
}