From be26effc554f15ef0c5cc047cff39fc0a929c085 Mon Sep 17 00:00:00 2001 From: "akalin@chromium.org" Date: Tue, 23 Nov 2010 00:07:41 +0000 Subject: Revert 67018 - Made testserver communicate to parent process with JSON This is so that if the testserver needs to communicate anything more than the port in the future (e.g., xmpp port for the test sync server), it can do so in a flexible manner. BUG=53934 TEST=manually Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=66879 Review URL: http://codereview.chromium.org/5196001 TBR=akalin@chromium.org Review URL: http://codereview.chromium.org/5291002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67025 0039d316-1c4b-4281-b951-d872f2087c98 --- net/tools/testserver/testserver.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'net/tools') diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py index b69eb2f..2551139 100755 --- a/net/tools/testserver/testserver.py +++ b/net/tools/testserver/testserver.py @@ -27,13 +27,6 @@ import time import urlparse import warnings -# If we use simplejson always, we get some warnings when we run under -# 2.6. -if sys.version_info < (2, 6): - import simplejson as json -else: - import json - # Ignore deprecation warnings, they make our output more cluttered. warnings.filterwarnings("ignore", category=DeprecationWarning) @@ -1328,22 +1321,15 @@ def main(options, args): # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: - server_data = { - 'port': listen_port - } - server_data_json = json.dumps(server_data) - debug('sending server_data: %s' % server_data_json) - server_data_len = len(server_data_json) if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") - # First write the data length as an unsigned 4-byte value. This - # is _not_ using network byte ordering since the other end of the - # pipe is on the same machine. - startup_pipe.write(struct.pack('=L', server_data_len)) - startup_pipe.write(server_data_json) + # Write the listening port as a 2 byte value. This is _not_ using + # network byte ordering since the other end of the pipe is on the same + # machine. + startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: -- cgit v1.1