use std::sync::Arc;
use bytes::Bytes;
use tokio::sync::{
mpsc,
oneshot,
};
use super::window::SendWindow;
pub(crate) enum MuxCommand {
OpenStreamPairAndWrite {
error_id: u32,
data_id: u32,
error_headers: Vec<(String, String)>,
data_headers: Vec<(String, String)>,
first_payload: Bytes,
},
SendData {
stream_id: u32,
payload: Bytes,
fin: bool,
},
SendRawFrame { frame: Bytes },
CloseStream { stream_id: u32, status: u32 },
EncodePing { id: u32 },
SendWsPong { payload: Bytes },
EncodeWindowUpdate { stream_id: u32, delta: u32 },
GoAway { last_good_stream_id: u32 },
}
pub(crate) enum StreamRegistration {
Open {
stream_id: u32,
data_tx: mpsc::Sender<Bytes>,
reply_tx: oneshot::Sender<Result<(), crate::error::Error>>,
send_window: Arc<SendWindow>,
},
Close { stream_id: u32 },
SettingsWindowDelta { delta: i64 },
GoAway {
last_good_stream_id: u32,
status: u32,
},
}
pub(super) struct OpenState {
pub next_stream_id: u32,
}