Refactor connection task management to avoid cancels (#117)
authorCory Johns <johnsca@gmail.com>
Thu, 27 Apr 2017 20:27:32 +0000 (16:27 -0400)
committerPete Vander Giessen <petevg@gmail.com>
Thu, 27 Apr 2017 20:27:32 +0000 (16:27 -0400)
commit054805953c7c8ed11ce341adf55bf6e19e589fbe
tree3e62ca5955f775ae79dbdf2ffb88e8a58c485969
parent7c2a530853c95b8a3518f6db0870f94858f87c27
Refactor connection task management to avoid cancels (#117)

Connections in libjuju require a few tasks to help manage the data
flowing through it.  The model AllWatcher task, the connection packet
receiver, and the connection keep-alive pinger.  Due to how these
connections were being managed, they had to be tracked and cancelled
externally, leading to exceptions being masked and the need to shield
AllWatcher notifier callbacks, making them entirely uncancellable.  This
refactor cleans that up by using events to track when the connection is
being shutdown and cleanly stopping the tasks internally.
juju/client/connection.py
juju/model.py
juju/utils.py
tests/unit/test_connection.py