mirror of
https://opendev.org/x/pyghmi
synced 2025-01-27 19:37:44 +00:00
Fix break handling in SOL
When the retry logic was moved to console, it exposed a problem with the sol handler being called in the midst of transmitting without clearing the pending payload, resulting in an infinite recursion of sending the same break. Resolve by using the common call to sendoutput to have it occur only after the current head of pending output has been removed. Change-Id: Iaae86a3bd870c1841530e200ef0f5780a5cc6993
This commit is contained in:
parent
2c901ac471
commit
4337179d7e
@ -1,6 +1,7 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2014 IBM Corporation
|
||||
# Copyright 2015-2019 Lenovo
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -237,23 +238,25 @@ class Console(object):
|
||||
|
||||
def _sendpendingoutput(self):
|
||||
with self.outputlock:
|
||||
dobreak = False
|
||||
chunk = ''
|
||||
if len(self.pendingoutput) == 0:
|
||||
return
|
||||
if isinstance(self.pendingoutput[0], dict):
|
||||
if 'break' in self.pendingoutput[0]:
|
||||
self._sendoutput("", sendbreak=True)
|
||||
dobreak = True
|
||||
else:
|
||||
del self.pendingoutput[0]
|
||||
raise ValueError
|
||||
del self.pendingoutput[0]
|
||||
return
|
||||
if len(self.pendingoutput[0]) > self.maxoutcount:
|
||||
elif len(self.pendingoutput[0]) > self.maxoutcount:
|
||||
chunk = self.pendingoutput[0][:self.maxoutcount]
|
||||
self.pendingoutput[0] = self.pendingoutput[0][
|
||||
self.maxoutcount:]
|
||||
else:
|
||||
chunk = self.pendingoutput[0]
|
||||
del self.pendingoutput[0]
|
||||
self._sendoutput(chunk)
|
||||
self._sendoutput(chunk, sendbreak=dobreak)
|
||||
|
||||
def _sendoutput(self, output, sendbreak=False):
|
||||
self.myseq += 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user