Commit 232a5093 authored by Sebastien Petitdemange's avatar Sebastien Petitdemange
Browse files

tcp: remove transaction on command object in case of exception on write.

close issue #90
parent c83603fe
......@@ -23,6 +23,8 @@ from .exceptions import CommunicationError, CommunicationTimeout
from ..common.greenlet_utils import KillMask
from .util import HexMsg
from bliss.common.task_utils import error_cleanup
class SocketTimeout(CommunicationTimeout):
'''Socket timeout error'''
......@@ -436,7 +438,8 @@ class Command:
if transaction is None and create_transaction:
transaction = self.new_transaction()
self._debug("Tx: %r %r",msg, HexMsg(msg))
with error_cleanup(self._pop_transaction,transaction=transaction):
return transaction
def write(self, msg, timeout=None):
......@@ -519,6 +522,9 @@ class Command:
return data_queue
def _pop_transaction(self,transaction=None):
index = self._transaction_list.index(transaction)
class TcpError(CommunicationError):
'''TCP communication error'''
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment