diff options
Diffstat (limited to 'indra/llcommon/tests')
-rw-r--r-- | indra/llcommon/tests/llleap_test.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 677f4830ea..73d7217608 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -101,32 +101,25 @@ namespace tut " sys.path.insert(0,\n" " os.path.join(mydir, os.pardir, os.pardir, 'lib', 'python'))\n" " from indra.base import llsd\n" - "LEFTOVER = ''\n" "class ProtocolError(Exception):\n" " pass\n" "def get():\n" - " global LEFTOVER\n" - " hdr = LEFTOVER\n" - " if ':' not in hdr:\n" - " hdr += sys.stdin.read(20)\n" + " hdr = ''\n" + " while ':' not in hdr and len(hdr) < 20:\n" + " hdr += sys.stdin.read(1)\n" " if not hdr:\n" " sys.exit(0)\n" - " parts = hdr.split(':', 1)\n" - " if len(parts) != 2:\n" + " if not hdr.endswith(':'):\n" " raise ProtocolError('Expected len:data, got %r' % hdr)\n" " try:\n" - " length = int(parts[0])\n" + " length = int(hdr[:-1])\n" " except ValueError:\n" - " raise ProtocolError('Non-numeric len %r' % parts[0])\n" - " del parts[0]\n" - " received = len(parts[0])\n" + " raise ProtocolError('Non-numeric len %r' % hdr[:-1])\n" + " parts = []\n" + " received = 0\n" " while received < length:\n" " parts.append(sys.stdin.read(length - received))\n" " received += len(parts[-1])\n" - " if received > length:\n" - " excess = length - received\n" - " LEFTOVER = parts[-1][excess:]\n" - " parts[-1] = parts[-1][:excess]\n" " data = ''.join(parts)\n" " assert len(data) == length\n" " try:\n" |