2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-21 17:11:58 +00:00

Assure that TL value read is complete

There is no hard guarantee that all 4 bytes will come.  In practice,
I've never seen this occur, but to be complete, should make sure recv gets everything it was supposed to.
This commit is contained in:
Jarrod Johnson 2014-05-19 10:12:16 -04:00
parent 724557b998
commit 4dfcc8103f
2 changed files with 6 additions and 31 deletions

35
TODO
View File

@ -31,34 +31,7 @@ KeyError: ''
a titlebar
-audit log did not show confetty activity for starting console
-read exclusive and full exclusive console access modes
-when an http session exists, confluent cpu usage on my vm idles at 2 %.
profile exactly what is spinning and try to make it nicer
- an ipmi console was once stuck in 'connecting' state, no idea how, this traceback might have occurred:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/eventlet/hubs/hub.py", line 346, in fire_timers
timer()
File "/usr/lib/python2.6/site-packages/eventlet/hubs/timer.py", line 56, in __call__
cb(*args, **kw)
File "/usr/lib/python2.6/site-packages/eventlet/semaphore.py", line 121, in _do_acquire
waiter.switch()
File "/usr/lib/python2.6/site-packages/eventlet/greenthread.py", line 194, in main
result = function(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/confluent/consoleserver.py", line 177, in _connect_backend
self._console.connect(self.get_console_output)
File "/usr/lib/python2.6/site-packages/confluent/plugins/hardwaremanagement/ipmi.py", line 143, in connect
iohandler=self.handle_data)
File "/usr/lib/python2.6/site-packages/pyghmi/ipmi/console.py", line 65, in __init__
session.Session.wait_for_rsp(0)
File "/usr/lib/python2.6/site-packages/pyghmi/ipmi/private/session.py", line 914, in wait_for_rsp
cls._route_ipmiresponse(sockaddr, data)
File "/usr/lib/python2.6/site-packages/pyghmi/ipmi/private/session.py", line 991, in _route_ipmiresponse
sockaddr=sockaddr)
File "/usr/lib/python2.6/site-packages/pyghmi/ipmi/private/session.py", line 1035, in _handle_ipmi_packet
self._handle_ipmi2_packet(data)
File "/usr/lib/python2.6/site-packages/pyghmi/ipmi/private/session.py", line 1063, in _handle_ipmi2_packet
self.k1, rawdata[4:-12], hashlib.sha1).digest()[:12]
File "/usr/lib64/python2.6/hmac.py", line 133, in new
return HMAC(key, msg, digestmod)
File "/usr/lib64/python2.6/hmac.py", line 68, in __init__
if len(key) > blocksize:
TypeError: object of type 'NoneType' has no len()
-remove the socket ignore code from pyghmi and repeat tests to understand
why python 2.7 with excessive select() would transpose typing so badly...
while the problem cannot be reproduced without that problem fixed, the
problem should only cause poor performance, not induce transpose of data...

View File

@ -44,6 +44,8 @@ def send(handle, data):
def recv(handle):
tl = handle.recv(4)
while len(tl) < 4:
tl += handle.recv(4 - len(tl))
if len(tl) == 0:
return None
tl = struct.unpack("!I", tl)[0]