# Prevent requests from hanging when shutting down a connection · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/6b0ed820bf9402f469dfc576da9f6a25ca323737)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 6b0ed820bf9402f469dfc576da9f6a25ca323737

Requested commit: 6b0ed820bf9402f469dfc576da9f6a25ca323737

Commit: 6b0ed820bf9402f469dfc576da9f6a25ca323737

Tree: 5d2c8d50866fcdd30bbc2992c5e263240be40c00

Author: Antonio Scandurra

Committer: Antonio Scandurra

## Message

```
Prevent requests from hanging when shutting down a connection

When closing a connection (either due to an error or simply because the
user wanted to), we will now  *take* `response_channels` as opposed to
clearing them. This ensures that `Peer::request` can't succeed in both
adding the oneshot channel in `response_channels` map _and_ submit the
message onto the `outgoing_tx` channel.

This also streamlines how we close a connection by unifying all the exit
code paths of the IO handling future.

```

## Parents

- [c70b4a99c99ba60f7097b771f069174480dfaafd](https://git.cafe/gitcafe/zed/commit/c70b4a99c99ba60f7097b771f069174480dfaafd?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/6b0ed820bf9402f469dfc576da9f6a25ca323737?format=markdown)
