-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When `Message::Done` was received before the cleanup loop executed it led to a deadlock since the loop didn't see the receiving end being disconnected and it also had strong reference via `Arc` preventing it from dropping. This change solves the problem by splitting the channel and only keeping the sender in `Connection`. The reciver is passed to `handle_replies` as an extra argument, making sure it will be used exactly once. The main advantage of this method over trying to keep the receiver inside `Connection` is that it hanles cases when the thread panicks and possibly forgetting explicit close in future refactors. Another advantage is being able to remove one `Arc::clone` and I have an idea for removing locking on `senders` in the future too. Closes #283
- Loading branch information
Showing
1 changed file
with
16 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters