diff options
author | Louis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.co.uk> | 2010-08-11 12:49:09 -0400 |
---|---|---|
committer | Louis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.co.uk> | 2010-08-13 00:30:24 -0400 |
commit | bfdc83907bc27b12a94494d6fb8c5976f0462e5c (patch) | |
tree | 90ccd594d13dfad1319bb0eb7ff670d0c8afa743 /butterfly | |
parent | c56ccfd7f11bb4586c4bfb368decbbfa41abdea5 (diff) |
ft: change state and send Closed signal before cleaning up everything
Diffstat (limited to 'butterfly')
-rw-r--r-- | butterfly/channel/file_transfer.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/butterfly/channel/file_transfer.py b/butterfly/channel/file_transfer.py index aa85e0e..527da80 100644 --- a/butterfly/channel/file_transfer.py +++ b/butterfly/channel/file_transfer.py @@ -173,22 +173,22 @@ class ButterflyFileTransferChannel(telepathy.server.ChannelTypeFileTransfer): def Close(self): logger.debug("Close") - self.cleanup() - if self.state not in (telepathy.FILE_TRANSFER_STATE_CANCELLED, - telepathy.FILE_TRANSFER_STATE_COMPLETED): - self.set_state(telepathy.FILE_TRANSFER_STATE_CANCELLED, - telepathy.FILE_TRANSFER_STATE_CHANGE_REASON_LOCAL_CANCELLED) - telepathy.server.ChannelTypeFileTransfer.Close(self) - self.remove_from_connection() - def cleanup(self): if self._receiving and self.state == telepathy.FILE_TRANSFER_STATE_PENDING: self._session.reject() - - if self.state not in (telepathy.FILE_TRANSFER_STATE_CANCELLED, + elif self.state not in (telepathy.FILE_TRANSFER_STATE_CANCELLED, telepathy.FILE_TRANSFER_STATE_COMPLETED): self._session.cancel() + if self.state != telepathy.FILE_TRANSFER_STATE_COMPLETED: + self.set_state(telepathy.FILE_TRANSFER_STATE_CANCELLED, + telepathy.FILE_TRANSFER_STATE_CHANGE_REASON_LOCAL_STOPPED) + + telepathy.server.ChannelTypeFileTransfer.Close(self) + self.cleanup() + self.remove_from_connection() + + def cleanup(self): if self.socket: self.socket.close() self.socket = None |