snoyberg/http-conduit — comment on commit 8e4a036593c36ecf5cb97f49c98c9a268a45af94
File: Network/HTTP/Conduit/Manager.hs line 163
By snoyberg:

`closeManager` isn't exported, and has the exact intention that it cannot be reused. I think the one issue is that any existing connection may try to put their `ConnInfo`s back into it, in which case we need to have something more substantial than just putting an `error` in there (unless we do some exception catching as well).

How's this:

* Add a new record `mIsOpen :: IORef Bool`
* At the beginning of `closeManager`, switch it to `False`
* Whenever trying to replace a connection, first check if it's still open.
* Adding `clearManager` is an orthogonal discussion, which I'm not sure is really necessary (we have the reaper running after all).
* If we make the change to `TVar` (most likely will happen) change `IORef` to `TVar`