Rename Response::Ok to Response::Nil.
This is a better name because it signals "no data in response" rather than "Ok", which is semantically mixed with `Ok/Err` of `Result`.
This commit is contained in:
parent
5929e05e52
commit
29f901add3
|
@ -53,11 +53,11 @@ impl Handler {
|
|||
use Handler::*;
|
||||
let mut ignored_msg = None;
|
||||
// XXX can this be avoided?
|
||||
let tmp_state = std::mem::replace(self, Finished(Ok(Response::Ok)));
|
||||
let tmp_state = std::mem::replace(self, Finished(Ok(Response::Nil)));
|
||||
*self = match (tmp_state, msg) {
|
||||
(Ping(req_nonce), Message::Pong(rsp_nonce)) => {
|
||||
if req_nonce == rsp_nonce {
|
||||
Finished(Ok(Response::Ok))
|
||||
Finished(Ok(Response::Nil))
|
||||
} else {
|
||||
Ping(req_nonce)
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ where
|
|||
};
|
||||
|
||||
match rsp {
|
||||
Response::Ok => { /* generic success, do nothing */ }
|
||||
Response::Nil => { /* generic success, do nothing */ }
|
||||
Response::Error => {
|
||||
if let Err(e) = self.peer_tx.send(Message::from(PeerError::Rejected)).await {
|
||||
self.fail_with(e.into());
|
||||
|
|
|
@ -8,8 +8,8 @@ use crate::meta_addr::MetaAddr;
|
|||
/// A response to a network request, represented in internal format.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Response {
|
||||
/// Generic success.
|
||||
Ok,
|
||||
/// A response with no data.
|
||||
Nil,
|
||||
|
||||
/// Generic error.
|
||||
Error,
|
||||
|
|
|
@ -51,7 +51,7 @@ impl ConnectCmd {
|
|||
let node = Buffer::new(
|
||||
service_fn(|req| async move {
|
||||
info!(?req);
|
||||
Ok::<Response, Error>(Response::Ok)
|
||||
Ok::<Response, Error>(Response::Nil)
|
||||
}),
|
||||
1,
|
||||
);
|
||||
|
|
|
@ -92,7 +92,7 @@ impl Service<Request> for SeedService {
|
|||
}
|
||||
_ => {
|
||||
debug!("ignoring request");
|
||||
Ok(Response::Ok)
|
||||
Ok(Response::Nil)
|
||||
}
|
||||
};
|
||||
Box::pin(futures::future::ready(response))
|
||||
|
|
Loading…
Reference in New Issue