(ef_open_srv, start_server): Journal must not be written before
empth_init(), because writing calls empth_self(). Move call of journal_startup(). (ef_close_srv, finish_server, panic): Move call of journal_shutdown() for symmetry.
This commit is contained in:
parent
befac7cf83
commit
d62355e76d
3 changed files with 6 additions and 3 deletions
|
@ -36,6 +36,7 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "empthread.h"
|
#include "empthread.h"
|
||||||
|
#include "journal.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
static void panic(int sig);
|
static void panic(int sig);
|
||||||
|
@ -80,6 +81,7 @@ panic(int sig)
|
||||||
logerror("server received fatal signal %d", sig);
|
logerror("server received fatal signal %d", sig);
|
||||||
log_last_commands();
|
log_last_commands();
|
||||||
ef_fin_srv();
|
ef_fin_srv();
|
||||||
|
journal_shutdown();
|
||||||
/* End of unsafe code */
|
/* End of unsafe code */
|
||||||
|
|
||||||
if (CANT_HAPPEN(sig != SIGBUS && sig != SIGSEGV
|
if (CANT_HAPPEN(sig != SIGBUS && sig != SIGSEGV
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "journal.h"
|
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
struct fileinit {
|
struct fileinit {
|
||||||
|
@ -100,7 +99,6 @@ ef_open_srv(void)
|
||||||
{
|
{
|
||||||
int failed = 0;
|
int failed = 0;
|
||||||
|
|
||||||
failed |= journal_startup() < 0;
|
|
||||||
failed |= !ef_open(EF_NATION, EFF_MEM);
|
failed |= !ef_open(EF_NATION, EFF_MEM);
|
||||||
failed |= !ef_open(EF_SECTOR, EFF_MEM);
|
failed |= !ef_open(EF_SECTOR, EFF_MEM);
|
||||||
failed |= !ef_open(EF_SHIP, EFF_MEM);
|
failed |= !ef_open(EF_SHIP, EFF_MEM);
|
||||||
|
@ -145,7 +143,6 @@ ef_close_srv(void)
|
||||||
ef_close(EF_BMAP);
|
ef_close(EF_BMAP);
|
||||||
ef_close(EF_LOST);
|
ef_close(EF_LOST);
|
||||||
ef_close(EF_REALM);
|
ef_close(EF_REALM);
|
||||||
journal_shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -320,6 +320,9 @@ start_server(int flags)
|
||||||
|
|
||||||
empth_init((void **)&player, flags);
|
empth_init((void **)&player, flags);
|
||||||
|
|
||||||
|
if (journal_startup() < 0)
|
||||||
|
exit(1);
|
||||||
|
|
||||||
empth_create(PP_ACCEPT, player_accept, (50 * 1024), flags,
|
empth_create(PP_ACCEPT, player_accept, (50 * 1024), flags,
|
||||||
"AcceptPlayers", "Accept network connections", 0);
|
"AcceptPlayers", "Accept network connections", 0);
|
||||||
empth_create(PP_KILLIDLE, player_kill_idle, (50 * 1024), flags,
|
empth_create(PP_KILLIDLE, player_kill_idle, (50 * 1024), flags,
|
||||||
|
@ -346,6 +349,7 @@ finish_server(void)
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
loc_NTTerm();
|
loc_NTTerm();
|
||||||
#endif
|
#endif
|
||||||
|
journal_shutdown();
|
||||||
remove(pidfname);
|
remove(pidfname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue