|
20 | 20 |
|
21 | 21 | use crate::multiaddr::{Multiaddr, Protocol};
|
22 | 22 |
|
23 |
| -/// Connection identifier. |
24 |
| -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] |
25 |
| -pub struct ConnectionId(usize); |
26 |
| - |
27 |
| -impl ConnectionId { |
28 |
| - /// Creates a `ConnectionId` from a non-negative integer. |
29 |
| - /// |
30 |
| - /// This is primarily useful for creating connection IDs |
31 |
| - /// in test environments. There is in general no guarantee |
32 |
| - /// that all connection IDs are based on non-negative integers. |
33 |
| - pub fn new(id: usize) -> Self { |
34 |
| - Self(id) |
35 |
| - } |
36 |
| -} |
37 |
| - |
38 |
| -impl std::ops::Add<usize> for ConnectionId { |
39 |
| - type Output = Self; |
40 |
| - |
41 |
| - fn add(self, other: usize) -> Self { |
42 |
| - Self(self.0 + other) |
43 |
| - } |
44 |
| -} |
45 |
| - |
46 | 23 | /// The endpoint roles associated with a peer-to-peer communication channel.
|
47 | 24 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
48 | 25 | pub enum Endpoint {
|
@@ -75,42 +52,6 @@ impl Endpoint {
|
75 | 52 | }
|
76 | 53 | }
|
77 | 54 |
|
78 |
| -/// The endpoint roles associated with a pending peer-to-peer connection. |
79 |
| -#[derive(Debug, Clone, PartialEq, Eq, Hash)] |
80 |
| -pub enum PendingPoint { |
81 |
| - /// The socket comes from a dialer. |
82 |
| - /// |
83 |
| - /// There is no single address associated with the Dialer of a pending |
84 |
| - /// connection. Addresses are dialed in parallel. Only once the first dial |
85 |
| - /// is successful is the address of the connection known. |
86 |
| - Dialer { |
87 |
| - /// Same as [`ConnectedPoint::Dialer`] `role_override`. |
88 |
| - role_override: Endpoint, |
89 |
| - }, |
90 |
| - /// The socket comes from a listener. |
91 |
| - Listener { |
92 |
| - /// Local connection address. |
93 |
| - local_addr: Multiaddr, |
94 |
| - /// Address used to send back data to the remote. |
95 |
| - send_back_addr: Multiaddr, |
96 |
| - }, |
97 |
| -} |
98 |
| - |
99 |
| -impl From<ConnectedPoint> for PendingPoint { |
100 |
| - fn from(endpoint: ConnectedPoint) -> Self { |
101 |
| - match endpoint { |
102 |
| - ConnectedPoint::Dialer { role_override, .. } => PendingPoint::Dialer { role_override }, |
103 |
| - ConnectedPoint::Listener { |
104 |
| - local_addr, |
105 |
| - send_back_addr, |
106 |
| - } => PendingPoint::Listener { |
107 |
| - local_addr, |
108 |
| - send_back_addr, |
109 |
| - }, |
110 |
| - } |
111 |
| - } |
112 |
| -} |
113 |
| - |
114 | 55 | /// The endpoint roles associated with an established peer-to-peer connection.
|
115 | 56 | #[derive(PartialEq, Eq, Debug, Clone, Hash)]
|
116 | 57 | pub enum ConnectedPoint {
|
|
0 commit comments