2009-08-31 21:15:13 -06:00
|
|
|
#! /usr/bin/env python3
|
|
|
|
|
|
|
|
import asyncore
|
|
|
|
import pointsd
|
2009-09-01 11:23:40 -06:00
|
|
|
import game
|
2009-08-31 21:15:13 -06:00
|
|
|
import flagd
|
2009-09-01 09:34:15 -06:00
|
|
|
import histogram
|
2009-09-30 13:58:16 -06:00
|
|
|
import config
|
2009-10-01 18:33:21 -06:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
do_reap = False
|
|
|
|
|
|
|
|
def chart(s):
|
|
|
|
if not os.fork():
|
|
|
|
histogram.main(s)
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
def reap():
|
|
|
|
try:
|
|
|
|
while True:
|
|
|
|
os.waitpid(0, os.WNOHANG)
|
|
|
|
except OSError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
def sigchld(signum, frame):
|
|
|
|
do_reap = True
|
2009-08-31 21:15:13 -06:00
|
|
|
|
|
|
|
def main():
|
2009-09-01 09:34:15 -06:00
|
|
|
pointsrv = pointsd.start()
|
|
|
|
flagsrv = flagd.start()
|
2009-09-29 15:36:25 -06:00
|
|
|
|
2009-09-01 09:34:15 -06:00
|
|
|
s = pointsrv.store
|
|
|
|
slen = 0
|
|
|
|
while True:
|
2009-10-01 18:33:21 -06:00
|
|
|
if do_reap:
|
|
|
|
reap()
|
2009-09-01 09:34:15 -06:00
|
|
|
asyncore.loop(timeout=30, use_poll=True, count=1)
|
|
|
|
if len(s) > slen:
|
|
|
|
slen = len(s)
|
2009-10-01 18:33:21 -06:00
|
|
|
chart(s)
|
2009-08-31 21:15:13 -06:00
|
|
|
|
|
|
|
main()
|