minor cleanup in ptyd
This commit is contained in:
@@ -18,8 +18,8 @@ pub struct PtyControlTerm {
|
||||
impl PtyControlTerm {
|
||||
pub fn new(pty: Rc<RefCell<Pty>>, flags: usize) -> Self {
|
||||
PtyControlTerm {
|
||||
pty: pty,
|
||||
flags: flags,
|
||||
pty,
|
||||
flags,
|
||||
notified_read: false,
|
||||
notified_write: false,
|
||||
}
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@ fn daemon(daemon: daemon::Daemon) -> ! {
|
||||
let mut timeout_count = 0u64;
|
||||
|
||||
scan_requests(&mut handler, &scheme).expect("pty: could not scan requests");
|
||||
issue_events(&socket, &mut *scheme.borrow_mut());
|
||||
issue_events(&socket, &mut scheme.borrow_mut());
|
||||
|
||||
for event_res in event_queue {
|
||||
let event = event_res.expect("pty: failed to read from event queue");
|
||||
@@ -87,7 +87,7 @@ fn daemon(daemon: daemon::Daemon) -> ! {
|
||||
}
|
||||
}
|
||||
|
||||
issue_events(&socket, &mut *scheme.borrow_mut());
|
||||
issue_events(&socket, &mut scheme.borrow_mut());
|
||||
}
|
||||
|
||||
std::process::exit(0);
|
||||
|
||||
+1
-4
@@ -15,10 +15,7 @@ pub struct PtyPgrp {
|
||||
|
||||
impl PtyPgrp {
|
||||
pub fn new(pty: Weak<RefCell<Pty>>, flags: usize) -> Self {
|
||||
PtyPgrp {
|
||||
pty: pty,
|
||||
flags: flags,
|
||||
}
|
||||
PtyPgrp { pty, flags }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-13
@@ -2,7 +2,6 @@ use std::collections::VecDeque;
|
||||
use std::io::{Cursor, Write};
|
||||
|
||||
use redox_termios::*;
|
||||
use syscall;
|
||||
use syscall::error::Result;
|
||||
|
||||
pub struct Pty {
|
||||
@@ -20,7 +19,7 @@ pub struct Pty {
|
||||
impl Pty {
|
||||
pub fn new(id: usize) -> Self {
|
||||
Pty {
|
||||
id: id,
|
||||
id,
|
||||
pgrp: 0,
|
||||
termios: Termios::default(),
|
||||
winsize: Winsize::default(),
|
||||
@@ -273,20 +272,18 @@ impl Pty {
|
||||
if !self.cooked.is_empty() {
|
||||
self.mosi.push_back(self.cooked.clone());
|
||||
self.cooked.clear();
|
||||
} else {
|
||||
if let Some(timeout_character) = self.timeout_character {
|
||||
if self.timeout_count >= timeout_character.wrapping_add(vtime) {
|
||||
self.timeout_character = None;
|
||||
} else if let Some(timeout_character) = self.timeout_character {
|
||||
if self.timeout_count >= timeout_character.wrapping_add(vtime) {
|
||||
self.timeout_character = None;
|
||||
|
||||
if self.mosi.is_empty() {
|
||||
self.mosi.push_back(self.cooked.clone());
|
||||
self.cooked.clear();
|
||||
}
|
||||
if self.mosi.is_empty() {
|
||||
self.mosi.push_back(self.cooked.clone());
|
||||
self.cooked.clear();
|
||||
}
|
||||
} else {
|
||||
// Start timer if not already started
|
||||
self.timeout_character = Some(self.timeout_count);
|
||||
}
|
||||
} else {
|
||||
// Start timer if not already started
|
||||
self.timeout_character = Some(self.timeout_count);
|
||||
}
|
||||
} else {
|
||||
// Return when min bytes are received or the timer expires
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@ pub struct PtySubTerm {
|
||||
impl PtySubTerm {
|
||||
pub fn new(pty: Weak<RefCell<Pty>>, flags: usize) -> Self {
|
||||
PtySubTerm {
|
||||
pty: pty,
|
||||
flags: flags,
|
||||
pty,
|
||||
flags,
|
||||
notified_read: false,
|
||||
notified_write: false,
|
||||
}
|
||||
|
||||
+1
-4
@@ -16,10 +16,7 @@ pub struct PtyTermios {
|
||||
|
||||
impl PtyTermios {
|
||||
pub fn new(pty: Weak<RefCell<Pty>>, flags: usize) -> Self {
|
||||
PtyTermios {
|
||||
pty: pty,
|
||||
flags: flags,
|
||||
}
|
||||
PtyTermios { pty, flags }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -16,10 +16,7 @@ pub struct PtyWinsize {
|
||||
|
||||
impl PtyWinsize {
|
||||
pub fn new(pty: Weak<RefCell<Pty>>, flags: usize) -> Self {
|
||||
PtyWinsize {
|
||||
pty: pty,
|
||||
flags: flags,
|
||||
}
|
||||
PtyWinsize { pty, flags }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user