Patch 7.4.1252
Problem: The channel test server may receive two messages concatenated.
Solution: Split the messages.
Files: src/testdir/test_channel.py
*** ../vim-7.4.1251/src/testdir/test_channel.py 2016-02-03 21:32:39.171071570
+0100
--- src/testdir/test_channel.py 2016-02-03 22:20:09.681119193 +0100
***************
*** 45,100 ****
print("=== socket closed ===")
break
print("received: {}".format(data))
! try:
! decoded = json.loads(data)
! except ValueError:
! print("json decoding failed")
! decoded = [-1, '']
!
! # Send a response if the sequence number is positive.
! if decoded[0] >= 0:
! if decoded[1] == 'hello!':
! # simply send back a string
! response = "got it"
! elif decoded[1] == 'make change':
! # Send two ex commands at the same time, before replying
to
! # the request.
! cmd = '["ex","call append(\\"$\\",\\"added1\\")"]'
! cmd += '["ex","call append(\\"$\\",\\"added2\\")"]'
! print("sending: {}".format(cmd))
! thesocket.sendall(cmd.encode('utf-8'))
! response = "ok"
! elif decoded[1] == 'eval-works':
! # Send an eval request. We ignore the response.
! cmd = '["eval","\\"foo\\" . 123", -1]'
! print("sending: {}".format(cmd))
! thesocket.sendall(cmd.encode('utf-8'))
! response = "ok"
! elif decoded[1] == 'eval-fails':
! # Send an eval request that will fail.
! cmd = '["eval","xxx", -2]'
! print("sending: {}".format(cmd))
! thesocket.sendall(cmd.encode('utf-8'))
! response = "ok"
! elif decoded[1] == 'eval-result':
! # Send back the last received eval result.
! response = last_eval
! elif decoded[1] == '!quit!':
! # we're done
! sys.exit(0)
! elif decoded[1] == '!crash!':
! # Crash!
! 42 / 0
else:
! response = "what?"
! encoded = json.dumps([decoded[0], response])
! print("sending: {}".format(encoded))
! thesocket.sendall(encoded.encode('utf-8'))
!
! # Negative numbers are used for "eval" responses.
! elif decoded[0] < 0:
! last_eval = decoded
thesocket = None
--- 45,113 ----
print("=== socket closed ===")
break
print("received: {}".format(data))
!
! # We may receive two messages at once. Take the part up to the
! # matching "]" (recognized by finding "][").
! while data != '':
! splitidx = data.find('][')
! if splitidx < 0:
! todo = data
! data = ''
else:
! todo = data[:splitidx + 1]
! data = data[splitidx + 1:]
! print("using: {}".format(todo))
!
! try:
! decoded = json.loads(todo)
! except ValueError:
! print("json decoding failed")
! decoded = [-1, '']
!
! # Send a response if the sequence number is positive.
! if decoded[0] >= 0:
! if decoded[1] == 'hello!':
! # simply send back a string
! response = "got it"
! elif decoded[1] == 'make change':
! # Send two ex commands at the same time, before
replying to
! # the request.
! cmd = '["ex","call append(\\"$\\",\\"added1\\")"]'
! cmd += '["ex","call append(\\"$\\",\\"added2\\")"]'
! print("sending: {}".format(cmd))
! thesocket.sendall(cmd.encode('utf-8'))
! response = "ok"
! elif decoded[1] == 'eval-works':
! # Send an eval request. We ignore the response.
! cmd = '["eval","\\"foo\\" . 123", -1]'
! print("sending: {}".format(cmd))
! thesocket.sendall(cmd.encode('utf-8'))
! response = "ok"
! elif decoded[1] == 'eval-fails':
! # Send an eval request that will fail.
! cmd = '["eval","xxx", -2]'
! print("sending: {}".format(cmd))
! thesocket.sendall(cmd.encode('utf-8'))
! response = "ok"
! elif decoded[1] == 'eval-result':
! # Send back the last received eval result.
! response = last_eval
! elif decoded[1] == '!quit!':
! # we're done
! sys.exit(0)
! elif decoded[1] == '!crash!':
! # Crash!
! 42 / 0
! else:
! response = "what?"
!
! encoded = json.dumps([decoded[0], response])
! print("sending: {}".format(encoded))
! thesocket.sendall(encoded.encode('utf-8'))
! # Negative numbers are used for "eval" responses.
! elif decoded[0] < 0:
! last_eval = decoded
thesocket = None
*** ../vim-7.4.1251/src/version.c 2016-02-03 21:56:38.380012968 +0100
--- src/version.c 2016-02-03 22:01:27.884974378 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 1252,
/**/
--
hundred-and-one symptoms of being an internet addict:
124. You begin conversations with, "Who is your internet service provider?"
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.