-
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved handling of ChannelMsg::WindowAdjusted in the Session::server_r…
…ead_authenticated() method
- Loading branch information
Showing
6 changed files
with
186 additions
and
146 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::sync::Arc; | ||
|
||
use tokio::sync::{mpsc::UnboundedSender, Mutex}; | ||
|
||
use crate::ChannelMsg; | ||
|
||
/// A handle to the [`super::Channel`]'s to be able to transmit messages | ||
/// to it and update it's `window_size`. | ||
#[derive(Debug)] | ||
pub struct ChannelRef { | ||
pub(super) sender: UnboundedSender<ChannelMsg>, | ||
pub(super) window_size: Arc<Mutex<u32>>, | ||
} | ||
|
||
impl ChannelRef { | ||
pub fn new(sender: UnboundedSender<ChannelMsg>) -> Self { | ||
Self { | ||
sender, | ||
window_size: Default::default(), | ||
} | ||
} | ||
|
||
pub fn window_size(&self) -> &Arc<Mutex<u32>> { | ||
&self.window_size | ||
} | ||
} | ||
|
||
impl std::ops::Deref for ChannelRef { | ||
type Target = UnboundedSender<ChannelMsg>; | ||
|
||
fn deref(&self) -> &Self::Target { | ||
&self.sender | ||
} | ||
} |
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
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
Oops, something went wrong.