@@ -12,12 +12,13 @@ use std::{
12
12
13
13
use futures:: { FutureExt , Stream } ;
14
14
use tokio:: sync:: OwnedSemaphorePermit ;
15
- use tower:: { Service , ServiceExt } ;
15
+ use tower:: { MakeService , Service , ServiceExt } ;
16
16
17
+ use crate :: client:: PeerInformation ;
17
18
use crate :: {
18
19
client:: { handshaker:: HandShaker , Client , DoHandshakeRequest , HandshakeError , InternalPeerID } ,
19
20
AddressBook , BroadcastMessage , ConnectionDirection , CoreSyncSvc , NetworkZone , PeerSyncSvc ,
20
- ProtocolRequestHandler ,
21
+ ProtocolRequest , ProtocolRequestHandler , ProtocolResponse ,
21
22
} ;
22
23
23
24
/// A request to connect to a peer.
@@ -32,28 +33,36 @@ pub struct ConnectRequest<Z: NetworkZone> {
32
33
}
33
34
34
35
/// The connector service, this service connects to peer and returns the [`Client`].
35
- pub struct Connector < Z : NetworkZone , AdrBook , CSync , PSync , ProtoHdlr , BrdcstStrmMkr > {
36
- handshaker : HandShaker < Z , AdrBook , CSync , PSync , ProtoHdlr , BrdcstStrmMkr > ,
36
+ pub struct Connector < Z : NetworkZone , AdrBook , CSync , PSync , ProtoHdlrMkr , BrdcstStrmMkr > {
37
+ handshaker : HandShaker < Z , AdrBook , CSync , PSync , ProtoHdlrMkr , BrdcstStrmMkr > ,
37
38
}
38
39
39
- impl < Z : NetworkZone , AdrBook , CSync , PSync , ProtoHdlr , BrdcstStrmMkr >
40
- Connector < Z , AdrBook , CSync , PSync , ProtoHdlr , BrdcstStrmMkr >
40
+ impl < Z : NetworkZone , AdrBook , CSync , PSync , ProtoHdlrMkr , BrdcstStrmMkr >
41
+ Connector < Z , AdrBook , CSync , PSync , ProtoHdlrMkr , BrdcstStrmMkr >
41
42
{
42
43
/// Create a new connector from a handshaker.
43
44
pub const fn new (
44
- handshaker : HandShaker < Z , AdrBook , CSync , PSync , ProtoHdlr , BrdcstStrmMkr > ,
45
+ handshaker : HandShaker < Z , AdrBook , CSync , PSync , ProtoHdlrMkr , BrdcstStrmMkr > ,
45
46
) -> Self {
46
47
Self { handshaker }
47
48
}
48
49
}
49
50
50
- impl < Z : NetworkZone , AdrBook , CSync , PSync , ProtoHdlr , BrdcstStrmMkr , BrdcstStrm >
51
- Service < ConnectRequest < Z > > for Connector < Z , AdrBook , CSync , PSync , ProtoHdlr , BrdcstStrmMkr >
51
+ impl < Z : NetworkZone , AdrBook , CSync , PSync , ProtoHdlrMkr , BrdcstStrmMkr , BrdcstStrm >
52
+ Service < ConnectRequest < Z > > for Connector < Z , AdrBook , CSync , PSync , ProtoHdlrMkr , BrdcstStrmMkr >
52
53
where
53
54
AdrBook : AddressBook < Z > + Clone ,
54
55
CSync : CoreSyncSvc + Clone ,
55
56
PSync : PeerSyncSvc < Z > + Clone ,
56
- ProtoHdlr : ProtocolRequestHandler + Clone ,
57
+ ProtoHdlrMkr : MakeService <
58
+ PeerInformation < Z :: Addr > ,
59
+ ProtocolRequest ,
60
+ MakeError = tower:: BoxError ,
61
+ Service : ProtocolRequestHandler ,
62
+ Future : Send + ' static ,
63
+ > + Clone
64
+ + Send
65
+ + ' static ,
57
66
BrdcstStrm : Stream < Item = BroadcastMessage > + Send + ' static ,
58
67
BrdcstStrmMkr : Fn ( InternalPeerID < Z :: Addr > ) -> BrdcstStrm + Clone + Send + ' static ,
59
68
{
0 commit comments