Skip to content

Commit

Permalink
Fix: the server should send a zero PID for hung instances
Browse files Browse the repository at this point in the history
  • Loading branch information
Killswitch00 committed Dec 19, 2014
1 parent 19b5cfd commit 58ea0a7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
20 changes: 10 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for Arma Server Monitor 0.1.
# Generated by GNU Autoconf 2.69 for Arma Server Monitor 0.2.
#
# Report bugs to <[email protected]>.
#
Expand Down Expand Up @@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='Arma Server Monitor'
PACKAGE_TARNAME='armaservermonitor'
PACKAGE_VERSION='0.1'
PACKAGE_STRING='Arma Server Monitor 0.1'
PACKAGE_VERSION='0.2'
PACKAGE_STRING='Arma Server Monitor 0.2'
PACKAGE_BUGREPORT='[email protected]'
PACKAGE_URL='https://dev.withsix.com/projects/asm-linux/'

Expand Down Expand Up @@ -1320,7 +1320,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures Arma Server Monitor 0.1 to adapt to many kinds of systems.
\`configure' configures Arma Server Monitor 0.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1391,7 +1391,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of Arma Server Monitor 0.1:";;
short | recursive ) echo "Configuration of Arma Server Monitor 0.2:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1504,7 +1504,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
Arma Server Monitor configure 0.1
Arma Server Monitor configure 0.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1782,7 +1782,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Arma Server Monitor $as_me 0.1, which was
It was created by Arma Server Monitor $as_me 0.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -2652,7 +2652,7 @@ fi

# Define the identity of the package.
PACKAGE='armaservermonitor'
VERSION='0.1'
VERSION='0.2'


cat >>confdefs.h <<_ACEOF
Expand Down Expand Up @@ -12975,7 +12975,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by Arma Server Monitor $as_me 0.1, which was
This file was extended by Arma Server Monitor $as_me 0.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -13042,7 +13042,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
Arma Server Monitor config.status 0.1
Arma Server Monitor config.status 0.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([Arma Server Monitor], [0.1],[[email protected]],
AC_INIT([Arma Server Monitor], [0.2],[[email protected]],
[armaservermonitor], [https://dev.withsix.com/projects/asm-linux/])
AC_PREREQ([2.59])

Expand Down
7 changes: 4 additions & 3 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ void handle_signal(int s)
* (aka Little endian). That means that this function is technically
* non-portable to non-x86 architectures, since we do not use htons()
* et al to serialize the data before it is sent.
* (OTOTH, ArmA is strictly x86 anyhow)
* (OTOH, ArmA is strictly x86 anyhow)
*/
int send_asi(int clientfd)
{
Expand All @@ -501,10 +501,11 @@ int send_asi(int clientfd)
asi = (struct ARMA_SERVER_INFO*)((unsigned char *)filemap + (instance * pagesize));

// Serialize the ARMA_SERVER_INFO struct data
*((unsigned short *)p) = asi->PID; p += sizeof(unsigned short); // 2
if (asi->PID == 0 || asi->TICK_COUNT < DeadTimeOut) {
// The slot is either unused or dead - just send the PID field.
// The slot is either unused or dead - just send a zero PID field.
*((unsigned short *)p) = 0; p += sizeof(unsigned short); // 2
} else {
*((unsigned short *)p) = asi->PID; p += sizeof(unsigned short); // 2
*((unsigned short *)p) = asi->OBJ_COUNT_0; p += sizeof(unsigned short); // 4
*((unsigned short *)p) = asi->OBJ_COUNT_1; p += sizeof(unsigned short); // 6
*((unsigned short *)p) = asi->OBJ_COUNT_2; p += sizeof(unsigned short); // 8
Expand Down

0 comments on commit 58ea0a7

Please sign in to comment.