1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-28 19:10:36 +00:00

fix io handling code

This commit is contained in:
Nikolay Kim 2018-12-21 13:00:26 -08:00
parent 37d28304c9
commit 48a1c7320c

View file

@ -187,7 +187,7 @@ where
enum TransportState<S: Service<Request<U>>, U: Encoder + Decoder> { enum TransportState<S: Service<Request<U>>, U: Encoder + Decoder> {
Processing, Processing,
Error(FramedTransportError<S::Error, U>), Error(FramedTransportError<S::Error, U>),
EncoderError(FramedTransportError<S::Error, U>), FramedError(FramedTransportError<S::Error, U>),
Stopping, Stopping,
} }
@ -263,7 +263,7 @@ where
Ok(Async::Ready(Some(el))) => el, Ok(Async::Ready(Some(el))) => el,
Err(err) => { Err(err) => {
self.state = self.state =
TransportState::Error(FramedTransportError::Decoder(err)); TransportState::FramedError(FramedTransportError::Decoder(err));
return true; return true;
} }
Ok(Async::NotReady) => return false, Ok(Async::NotReady) => return false,
@ -310,7 +310,7 @@ where
Ok(Async::Ready(Some(msg))) => match msg { Ok(Async::Ready(Some(msg))) => match msg {
Ok(msg) => { Ok(msg) => {
if let Err(err) = self.framed.force_send(msg) { if let Err(err) = self.framed.force_send(msg) {
self.state = TransportState::EncoderError( self.state = TransportState::FramedError(
FramedTransportError::Encoder(err), FramedTransportError::Encoder(err),
); );
return true; return true;
@ -334,7 +334,7 @@ where
Err(err) => { Err(err) => {
debug!("Error sending data: {:?}", err); debug!("Error sending data: {:?}", err);
self.state = self.state =
TransportState::EncoderError(FramedTransportError::Encoder(err)); TransportState::FramedError(FramedTransportError::Encoder(err));
return true; return true;
} }
Ok(Async::Ready(_)) => (), Ok(Async::Ready(_)) => (),
@ -378,7 +378,7 @@ where
Ok(Async::NotReady) Ok(Async::NotReady)
} }
} }
TransportState::EncoderError(err) => Err(err), TransportState::FramedError(err) => Err(err),
TransportState::Stopping => Ok(Async::Ready(())), TransportState::Stopping => Ok(Async::Ready(())),
} }
} }