X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fnetserv.c;h=71b23c959b0587ce5ce4231cfd8259d1165c3134;hb=359f8ed5f5c922fcbb78abce4b8648d354305759;hp=6555e0497922502843b7ef909c34cfc69be28bf1;hpb=bd9eb07192105e183db44f03d675332ffb2b767a;p=rocksndiamonds.git diff --git a/src/netserv.c b/src/netserv.c index 6555e049..71b23c95 100644 --- a/src/netserv.c +++ b/src/netserv.c @@ -433,6 +433,13 @@ static void Handle_OP_MOVE_PLAYER(struct NetworkServerPlayerInfo *player) ServerFrameCounter++; } +void ExitNetworkServer(int exit_value) +{ + Error(ERR_NETWORK_SERVER, "exiting network server"); + + exit(exit_value); +} + /* the following is not used for a standalone server; the pointer points to an integer containing the port-number */ int NetworkServerThread(void *ptr) @@ -458,6 +465,10 @@ void NetworkServer(int port, int serveronly) if (port == 0) port = DEFAULT_SERVER_PORT; + // if only running the network server, exit on Ctrl-C + if (serveronly) + signal(SIGINT, ExitNetworkServer); + if (!serveronly) onceonly = 1;