mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-08 22:38:01 -06:00
Optimize tcp_simple endpoint integration
This commit is contained in:
@@ -59,7 +59,8 @@ impl Session<FakePtyState> for PtySessionState {
|
||||
session.opened_pending = false;
|
||||
}
|
||||
|
||||
while let Some(packet) = incoming.pop_front() {
|
||||
while !incoming.is_empty() {
|
||||
let packet = incoming.remove(0);
|
||||
match frame_opcode(&packet) {
|
||||
Some(OP_INPUT) => {
|
||||
let _ = endpoint.send_hook_frame(
|
||||
|
||||
@@ -74,7 +74,6 @@ impl ShellSession {
|
||||
fn spawn(hook_id: HookID) -> Result<Self, SessionInitError> {
|
||||
let child = Command::new("/bin/bash")
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()
|
||||
.map_err(|_| SessionInitError::rejected())?;
|
||||
|
||||
@@ -116,7 +115,8 @@ impl Session<ShellState> for ShellSession {
|
||||
incoming: &mut PacketQueue,
|
||||
_endpoint: &mut Endpoint,
|
||||
) -> SessionStatus {
|
||||
while let Some(packet) = incoming.pop_front() {
|
||||
while !incoming.is_empty() {
|
||||
let packet = incoming.remove(0);
|
||||
if packet.end_hook {
|
||||
session.close_stdin();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user