From 343deca5d9bbf6e01f41c8492fd687040dd51115 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 14 Feb 2014 09:34:30 -0500 Subject: [PATCH] Fix race condition on sending data If data was sent prior to the activate payload response, the code to calculate the maximum chunk could not suceed. Correct this by having sent data accumulate as pending until connected state reached. Change-Id: I7c9aed67209b3526bd10cafeee0bae6b1b0ab85f --- pyghmi/ipmi/console.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyghmi/ipmi/console.py b/pyghmi/ipmi/console.py index 28514fc4..b9bcd5a2 100644 --- a/pyghmi/ipmi/console.py +++ b/pyghmi/ipmi/console.py @@ -130,6 +130,8 @@ class Console(object): #code anyway... self.ipmi_session.sol_handler = self._got_sol_payload self.connected = True + if len(self.pendingoutput) > 0: + self._sendpendingoutput() def _got_cons_input(self, handle): """Callback for handle events detected by ipmi session @@ -139,7 +141,11 @@ class Console(object): self._sendpendingoutput() def send_data(self, data): + if self.broken: + return self.pendingoutput += data + if not self.connected: + return if not self.awaitingack: self._sendpendingoutput()