node: Read with timeout from worker channel
This change ensures that if we're waiting on a Git request packetline that never arrives, we time out.
This commit is contained in:
parent
d758c4f203
commit
7037b52474
|
|
@ -131,7 +131,7 @@ impl Read for ChannelReader<Vec<u8>> {
|
|||
return Ok(read);
|
||||
}
|
||||
|
||||
match self.receiver.recv() {
|
||||
match self.receiver.recv_timeout(self.timeout) {
|
||||
Ok(ChannelEvent::Data(data)) => {
|
||||
self.buffer = io::Cursor::new(data);
|
||||
self.buffer.read(buf)
|
||||
|
|
@ -139,7 +139,11 @@ impl Read for ChannelReader<Vec<u8>> {
|
|||
Ok(ChannelEvent::Eof) => Err(io::ErrorKind::UnexpectedEof.into()),
|
||||
Ok(ChannelEvent::Close) => Err(io::ErrorKind::ConnectionReset.into()),
|
||||
|
||||
Err(_) => Err(io::Error::new(
|
||||
Err(chan::RecvTimeoutError::Timeout) => Err(io::Error::new(
|
||||
io::ErrorKind::TimedOut,
|
||||
"error reading from stream: channel timed out",
|
||||
)),
|
||||
Err(chan::RecvTimeoutError::Disconnected) => Err(io::Error::new(
|
||||
io::ErrorKind::BrokenPipe,
|
||||
"error reading from stream: channel is disconnected",
|
||||
)),
|
||||
|
|
|
|||
Loading…
Reference in New Issue