Permalink
Browse files

Do not die if missing revision metadata.

The Xonotic revision metadata comes as a part of the 'R'
line in the POST. Although it isn't required, server was dying
when it was missing. I made it optional now, defaulting
that field to "unkown" when it isn't present. Note: DTG
brought this issue into the light, as they custom compile
their Xonotic, and they omit #ifdef'ing WARPZONE, which
is what prints the 'R' line in stats.
  • Loading branch information...
1 parent faca562 commit 0a2b6ea372e7f09dda2319af6d330848a2039f2c @antzucaro committed May 14, 2012
Showing with 10 additions and 4 deletions.
  1. +10 −4 xonstat/views/submission.py
@@ -563,15 +563,21 @@ def stats_submit(request):
log.debug("ERROR: Blank game")
raise pyramid.httpexceptions.HTTPOk("OK")
- # FIXME: if we have two players and game type is 'dm',
- # change this into a 'duel' gametype. This should be
- # removed when the stats actually send 'duel' instead of 'dm'
+ # the "duel" gametype is fake
if num_real_players(players, count_bots=True) == 2 and \
game_meta['G'] == 'dm':
game_meta['G'] = 'duel'
+
+ # fix for DTG, who didn't #ifdef WATERMARK to set the revision info
+ try:
+ revision = game_meta['R']
+ except:
+ revision = "unknown"
+
+ log.debug(revision)
server = get_or_create_server(session=session, hashkey=idfp,
- name=game_meta['S'], revision=game_meta['R'],
+ name=game_meta['S'], revision=revision,
ip_addr=get_remote_addr(request))
gmap = get_or_create_map(session=session, name=game_meta['M'])

0 comments on commit 0a2b6ea

Please sign in to comment.