session.flush()\r
\r
\r
-def get_or_create_server(session, name, hashkey, ip_addr, revision):\r
+def get_or_create_server(session, name, hashkey, ip_addr, revision, port):\r
"""\r
Find a server by name or create one if not found. Parameters:\r
\r
"""\r
server = None\r
\r
+ try:\r
+ port = int(port)\r
+ except:\r
+ port = None\r
+\r
# finding by hashkey is preferred, but if not we will fall\r
# back to using name only, which can result in dupes\r
if hashkey is not None:\r
server.ip_addr = ip_addr\r
session.add(server)\r
\r
+ if server.port != port:\r
+ server.port = port\r
+ session.add(server)\r
+\r
if server.revision != revision:\r
server.revision = revision\r
session.add(server)\r
hashkey = idfp,\r
name = game_meta['S'],\r
revision = revision,\r
- ip_addr = get_remote_addr(request))\r
+ ip_addr = get_remote_addr(request),\r
+ port = game_meta.get('U', None))\r
\r
gmap = get_or_create_map(\r
session = session,\r