Hi,

  Running q2ded in a tty/tmux window, and then if that tty disappears,
  q2ded begins spinning the CPU taking up sometimes 97% of the CPU.
  The process is constantly polling for input, but if the tty is 
  marked 'bad' in fstat, the program can't cope.

  Setting 'busywait' variable to 1 allows q2ded to use nanosleep and
  stop spinning the cpu.

  I've improved the rc script to include the busywait variable and
  also removed the cd into the shared yquake2 directory since setting
  +set basedir to that path does the same thing and is cleaner.

  I've used the following flags for testing:

  q2ded_flags="+set dedicated 1 +set game holywars +exec server.cfg"

  It might be worth also hard coding +set dedicated 1 as well in the
  rc script? What do you think?

  Diff is attached.

  Thanks,
  Tom


Index: Makefile
===================================================================
RCS file: /cvs/ports/games/yquake2/Makefile,v
retrieving revision 1.21
diff -u -p -r1.21 Makefile
--- Makefile    25 Mar 2020 21:22:59 -0000      1.21
+++ Makefile    24 Jun 2020 08:49:24 -0000
@@ -8,7 +8,7 @@ V=              7.43
 PKGNAME=       ${N}-${V}
 DISTNAME=      quake2-${V}
 CATEGORIES=    games
-REVISION=      0
+REVISION=      1
 
 HOMEPAGE=      https://www.yamagi.org/quake2/
 MAINTAINER=    Adam Wolk <aw...@openbsd.org>
Index: pkg/q2ded.rc
===================================================================
RCS file: /cvs/ports/games/yquake2/pkg/q2ded.rc,v
retrieving revision 1.5
diff -u -p -r1.5 q2ded.rc
--- pkg/q2ded.rc        11 Jan 2018 19:27:02 -0000      1.5
+++ pkg/q2ded.rc        24 Jun 2020 08:49:24 -0000
@@ -12,7 +12,7 @@ rc_bg=YES
 rc_reload=NO
 
 rc_start() {
-       ${rcexec} "cd ${TRUEPREFIX}/share/yquake2; ${daemon} ${daemon_flags}"
+       ${rcexec} "${daemon} +set gamedir ${TRUEPREFIX}/share/yquake2 +set 
busywait 0 ${daemon_flags}"
 }
 
 rc_cmd $1

Reply via email to