1
0
Fork 0
mirror of https://gitlab.redox-os.org/CoffeeCode/redox-ssh.git synced 2025-12-28 13:22:19 +01:00

Flush stream after writing a packet

This commit is contained in:
Thomas Gatzweiler 2017-07-16 11:00:34 +02:00
parent 85203b1f61
commit ba376a9add
2 changed files with 3 additions and 0 deletions

View file

@ -44,6 +44,8 @@ impl<W: Write> Connection<W> {
pub fn run(&mut self, mut stream: &mut Read) -> io::Result<()> {
self.stream.write(self.my_id.as_bytes())?;
self.stream.flush()?;
self.peer_id = Some(self.read_id(stream)?);
if let Some(ref peer_id) = self.peer_id {

View file

@ -52,6 +52,7 @@ impl Packet {
stream.write_u8(padding_len as u8)?;
stream.write(&self.payload)?;
stream.write(&[0u8; 255][..padding_len])?;
stream.flush()?;
Ok(())
}