|
@ -9,6 +9,7 @@ import optparse |
|
|
import socket |
|
|
import socket |
|
|
import sys |
|
|
import sys |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GameServer: |
|
|
class GameServer: |
|
|
def __init__(self, options, arguments): |
|
|
def __init__(self, options, arguments): |
|
|
self.option = options |
|
|
self.option = options |
|
@ -19,7 +20,6 @@ class GameServer: |
|
|
# |
|
|
# |
|
|
if self.option.engine == 'avalanche': |
|
|
if self.option.engine == 'avalanche': |
|
|
self.query_prompt_string = b'\xFE\xFD\x09\x10\x20\x30\x40' |
|
|
self.query_prompt_string = b'\xFE\xFD\x09\x10\x20\x30\x40' |
|
|
|
|
|
|
|
|
elif self.option.engine == 'goldsource': |
|
|
elif self.option.engine == 'goldsource': |
|
|
self.query_prompt_string = b'\xFF\xFF\xFF\xFFTSource Engine Query\0' |
|
|
self.query_prompt_string = b'\xFF\xFF\xFF\xFFTSource Engine Query\0' |
|
|
elif self.option.engine == 'idtech3': |
|
|
elif self.option.engine == 'idtech3': |
|
@ -71,7 +71,7 @@ class GameServer: |
|
|
self.fatal_error('Unable to receive', 2) |
|
|
self.fatal_error('Unable to receive', 2) |
|
|
connection.close() |
|
|
connection.close() |
|
|
# Response. |
|
|
# Response. |
|
|
if self.response == None: |
|
|
if self.response is None: |
|
|
self.fatal_error('No response', 3) |
|
|
self.fatal_error('No response', 3) |
|
|
if len(self.response) < 10: |
|
|
if len(self.response) < 10: |
|
|
sys.exit('Short response.', 3) |
|
|
sys.exit('Short response.', 3) |
|
@ -84,6 +84,7 @@ class GameServer: |
|
|
if not self.option.port: |
|
|
if not self.option.port: |
|
|
self.fatal_error('No port supplied.', 4) |
|
|
self.fatal_error('No port supplied.', 4) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
parser = optparse.OptionParser( |
|
|
parser = optparse.OptionParser( |
|
|
usage='usage: python %prog [options]', |
|
|
usage='usage: python %prog [options]', |
|
|