mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Fixed disk io error - set fds to -1 when closing in hpws parent process (#254)
This commit is contained in:
@@ -386,8 +386,11 @@ namespace hpws
|
||||
|
||||
// --- PARENT
|
||||
|
||||
// Fds are set to -1, so when error occurred these fds won't get closed again.
|
||||
::close(fd[1]);
|
||||
fd[1] = -1;
|
||||
::close(fd[3]);
|
||||
fd[3] = -1;
|
||||
|
||||
int child_fd[2] = {fd[0], fd[2]};
|
||||
|
||||
@@ -776,7 +779,7 @@ namespace hpws
|
||||
if (HPWS_DEBUG)
|
||||
fprintf(stderr, "[HPWS.HPP] 'r%c' received on child_fd[%d]=%d\n", rbuf[1], i, child_fd[i]);
|
||||
}
|
||||
|
||||
|
||||
if (HPWS_DEBUG)
|
||||
fprintf(stderr, "[HPWS.HPP] Accept[13] called %d\n", calls);
|
||||
}
|
||||
@@ -886,7 +889,9 @@ namespace hpws
|
||||
|
||||
// --- PARENT
|
||||
|
||||
// Fds are set to -1, so when error occurred these fds won't get closed again.
|
||||
::close(fd[1]);
|
||||
fd[1] = -1;
|
||||
|
||||
int flags = fcntl(fd[0], F_GETFD, NULL);
|
||||
if (flags < 0)
|
||||
|
||||
@@ -287,7 +287,6 @@ namespace ledger::sqlite
|
||||
if (sqlite3_prepare_v2(db, sql.data(), -1, &stmt, 0) == SQLITE_OK &&
|
||||
stmt != NULL && sqlite3_step(stmt) == SQLITE_ROW)
|
||||
{
|
||||
// Finalize and distroys the statement.
|
||||
ledger.seq_no = sqlite3_column_int64(stmt, 0);
|
||||
ledger.time = sqlite3_column_int64(stmt, 1);
|
||||
ledger.ledger_hash_hex = std::string((char *)sqlite3_column_text(stmt, 2));
|
||||
@@ -300,6 +299,7 @@ namespace ledger::sqlite
|
||||
ledger.output_hash_hex = std::string((char *)sqlite3_column_text(stmt, 9));
|
||||
}
|
||||
|
||||
// Finalize and distroys the statement.
|
||||
sqlite3_finalize(stmt);
|
||||
return ledger;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace ledger::sqlite
|
||||
std::string input_hash_hex;
|
||||
std::string output_hash_hex;
|
||||
|
||||
ledger() {};
|
||||
ledger(){};
|
||||
|
||||
ledger(
|
||||
const uint64_t seq_no,
|
||||
|
||||
Reference in New Issue
Block a user