2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 19:40:12 +00:00

Merge pull request #45 from jjohnson42/fixnullclient

Fixnullclient
This commit is contained in:
Jarrod Johnson 2015-10-21 10:33:50 -04:00
commit 7a8fbe7d62
2 changed files with 8 additions and 0 deletions

View File

@ -38,6 +38,9 @@ def send(handle, data):
if isinstance(data, str):
# plain text, e.g. console data
tl = len(data)
if tl == 0:
# if you don't have anything to say, don't say anything at all
return
if tl < 16777216:
# type for string is '0', so we don't need
# to xor anything in
@ -76,6 +79,8 @@ def recv(handle):
# 4 byte tlv
dlen = tl & 16777215 # grab lower 24 bits
datatype = (tl & 2130706432) >> 24 # grab 7 bits from near beginning
if dlen == 0:
return None
data = handle.recv(dlen)
while len(data) < dlen:
ndata = handle.recv(dlen - len(data))

View File

@ -347,6 +347,9 @@ class _ConsoleHandler(object):
if data == conapi.ConsoleEvent.Disconnect:
self._got_disconnected()
return
elif data == '':
# ignore empty strings from a cconsole provider
return
if '\x1b[?1l' in data: # request for ansi mode cursor keys
self.appmodedetected = False
if '\x1b[?1h' in data: # remember the session wants the client to use