Remove Negotiated from upgrade traits (#1388)

* Remove Negotiated from upgrade traits

* Remove import
This commit is contained in:
Pierre Krieger
2020-01-13 14:34:43 +01:00
committed by GitHub
parent ff780b5bff
commit 42a45e2630
31 changed files with 218 additions and 220 deletions

View File

@ -59,7 +59,7 @@ where
next_connec_unique_id: UniqueConnecId,
/// List of active substreams with the state they are in.
substreams: Vec<SubstreamState<Negotiated<TSubstream>, TUserData>>,
substreams: Vec<SubstreamState<TSubstream, TUserData>>,
/// Until when to keep the connection alive.
keep_alive: KeepAlive,
@ -75,29 +75,29 @@ where
OutPendingOpen(KadRequestMsg, Option<TUserData>),
/// Waiting to send a message to the remote.
OutPendingSend(
KadOutStreamSink<TSubstream>,
KadOutStreamSink<Negotiated<TSubstream>>,
KadRequestMsg,
Option<TUserData>,
),
/// Waiting to flush the substream so that the data arrives to the remote.
OutPendingFlush(KadOutStreamSink<TSubstream>, Option<TUserData>),
OutPendingFlush(KadOutStreamSink<Negotiated<TSubstream>>, Option<TUserData>),
/// Waiting for an answer back from the remote.
// TODO: add timeout
OutWaitingAnswer(KadOutStreamSink<TSubstream>, TUserData),
OutWaitingAnswer(KadOutStreamSink<Negotiated<TSubstream>>, TUserData),
/// An error happened on the substream and we should report the error to the user.
OutReportError(KademliaHandlerQueryErr, TUserData),
/// The substream is being closed.
OutClosing(KadOutStreamSink<TSubstream>),
OutClosing(KadOutStreamSink<Negotiated<TSubstream>>),
/// Waiting for a request from the remote.
InWaitingMessage(UniqueConnecId, KadInStreamSink<TSubstream>),
InWaitingMessage(UniqueConnecId, KadInStreamSink<Negotiated<TSubstream>>),
/// Waiting for the user to send a `KademliaHandlerIn` event containing the response.
InWaitingUser(UniqueConnecId, KadInStreamSink<TSubstream>),
InWaitingUser(UniqueConnecId, KadInStreamSink<Negotiated<TSubstream>>),
/// Waiting to send an answer back to the remote.
InPendingSend(UniqueConnecId, KadInStreamSink<TSubstream>, KadResponseMsg),
InPendingSend(UniqueConnecId, KadInStreamSink<Negotiated<TSubstream>>, KadResponseMsg),
/// Waiting to flush an answer back to the remote.
InPendingFlush(UniqueConnecId, KadInStreamSink<TSubstream>),
InPendingFlush(UniqueConnecId, KadInStreamSink<Negotiated<TSubstream>>),
/// The substream is being closed.
InClosing(KadInStreamSink<TSubstream>),
InClosing(KadInStreamSink<Negotiated<TSubstream>>),
}
impl<TSubstream, TUserData> SubstreamState<TSubstream, TUserData>
@ -450,7 +450,7 @@ where
fn inject_fully_negotiated_outbound(
&mut self,
protocol: <Self::OutboundProtocol as OutboundUpgrade<TSubstream>>::Output,
protocol: <Self::OutboundProtocol as OutboundUpgrade<Negotiated<TSubstream>>>::Output,
(msg, user_data): Self::OutboundOpenInfo,
) {
self.substreams
@ -459,7 +459,7 @@ where
fn inject_fully_negotiated_inbound(
&mut self,
protocol: <Self::InboundProtocol as InboundUpgrade<TSubstream>>::Output,
protocol: <Self::InboundProtocol as InboundUpgrade<Negotiated<TSubstream>>>::Output,
) {
// If `self.allow_listening` is false, then we produced a `DeniedUpgrade` and `protocol`
// is a `Void`.