mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-27 16:51:34 +00:00
Some Kademlia code cleanup. (#1101)
This commit is contained in:
@ -70,9 +70,6 @@ where
|
||||
/// We haven't started opening the outgoing substream yet.
|
||||
/// Contains the request we want to send, and the user data if we expect an answer.
|
||||
OutPendingOpen(KadRequestMsg, Option<TUserData>),
|
||||
/// We are waiting for the outgoing substream to be upgraded.
|
||||
/// Contains the request we want to send, and the user data if we expect an answer.
|
||||
OutPendingUpgrade(KadRequestMsg, Option<TUserData>),
|
||||
/// Waiting to send a message to the remote.
|
||||
OutPendingSend(
|
||||
KadOutStreamSink<TSubstream>,
|
||||
@ -111,7 +108,6 @@ where
|
||||
fn try_close(self) -> AsyncSink<Self> {
|
||||
match self {
|
||||
SubstreamState::OutPendingOpen(_, _)
|
||||
| SubstreamState::OutPendingUpgrade(_, _)
|
||||
| SubstreamState::OutReportError(_, _) => AsyncSink::Ready,
|
||||
SubstreamState::OutPendingSend(mut stream, _, _)
|
||||
| SubstreamState::OutPendingFlush(mut stream, _)
|
||||
@ -405,11 +401,8 @@ where
|
||||
request_id,
|
||||
} => {
|
||||
let pos = self.substreams.iter().position(|state| match state {
|
||||
SubstreamState::InWaitingUser(ref conn_id, _)
|
||||
if conn_id == &request_id.connec_unique_id =>
|
||||
{
|
||||
true
|
||||
}
|
||||
SubstreamState::InWaitingUser(ref conn_id, _) =>
|
||||
conn_id == &request_id.connec_unique_id,
|
||||
_ => false,
|
||||
});
|
||||
|
||||
@ -562,11 +555,6 @@ where
|
||||
};
|
||||
(None, Some(ev), false)
|
||||
}
|
||||
SubstreamState::OutPendingUpgrade(msg, user_data) => (
|
||||
Some(SubstreamState::OutPendingUpgrade(msg, user_data)),
|
||||
None,
|
||||
false,
|
||||
),
|
||||
SubstreamState::OutPendingSend(mut substream, msg, user_data) => {
|
||||
match substream.start_send(msg) {
|
||||
Ok(AsyncSink::Ready) => (
|
||||
|
Reference in New Issue
Block a user