| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # This native client will read full messages, but do nothing with them and | 6 # This native client will read full messages, but do nothing with them and |
| 7 # send no responses. | 7 # send no responses. |
| 8 | 8 |
| 9 import sys | 9 import sys |
| 10 import struct | 10 import struct |
| 11 | 11 |
| 12 while 1: | 12 while 1: |
| 13 # Read the message type (first 4 bytes). | 13 # Read the message type (first 4 bytes). |
| 14 typeBytes = sys.stdin.read(4) | 14 typeBytes = sys.stdin.read(4) |
| 15 | 15 |
| 16 if len(typeBytes) == 0: | 16 if len(typeBytes) == 0: |
| 17 break | 17 break |
| 18 | 18 |
| 19 # Read the message length (4 bytes). | 19 # Read the message length (4 bytes). |
| 20 textLength = struct.unpack('i', sys.stdin.read(4))[0] | 20 textLength = struct.unpack('i', sys.stdin.read(4))[0] |
| 21 | 21 |
| 22 # Read the text (JSON object) of the message. | 22 # Read the text (JSON object) of the message. |
| 23 text = sys.stdin.read(textLength) | 23 text = sys.stdin.read(textLength) |
| OLD | NEW |