11use std:: fmt:: { Display , Error as FmtError , Formatter } ;
22
3- use futures:: channel:: mpsc;
3+ use futures:: channel:: { mpsc, oneshot } ;
44use log:: { debug, info} ;
55
66use crate :: network:: clique:: {
@@ -40,6 +40,7 @@ async fn manage_incoming<SK: SecretKey, D: Data, S: Splittable>(
4040 stream : S ,
4141 result_for_parent : mpsc:: UnboundedSender < ResultForService < SK :: PublicKey , D > > ,
4242 data_for_user : mpsc:: UnboundedSender < D > ,
43+ authorization_requests_sender : mpsc:: UnboundedSender < ( SK :: PublicKey , oneshot:: Sender < bool > ) > ,
4344) -> Result < ( ) , IncomingError < SK :: PublicKey > > {
4445 debug ! (
4546 target: LOG_TARGET ,
@@ -48,7 +49,13 @@ async fn manage_incoming<SK: SecretKey, D: Data, S: Splittable>(
4849 let ( stream, protocol) = protocol ( stream) . await ?;
4950 debug ! ( target: LOG_TARGET , "Negotiated protocol, running." ) ;
5051 Ok ( protocol
51- . manage_incoming ( stream, secret_key, result_for_parent, data_for_user)
52+ . manage_incoming (
53+ stream,
54+ secret_key,
55+ result_for_parent,
56+ data_for_user,
57+ authorization_requests_sender,
58+ )
5259 . await ?)
5360}
5461
@@ -62,9 +69,18 @@ pub async fn incoming<SK: SecretKey, D: Data, S: Splittable>(
6269 stream : S ,
6370 result_for_parent : mpsc:: UnboundedSender < ResultForService < SK :: PublicKey , D > > ,
6471 data_for_user : mpsc:: UnboundedSender < D > ,
72+ authorization_requests_sender : mpsc:: UnboundedSender < ( SK :: PublicKey , oneshot:: Sender < bool > ) > ,
6573) {
6674 let addr = stream. peer_address_info ( ) ;
67- if let Err ( e) = manage_incoming ( secret_key, stream, result_for_parent, data_for_user) . await {
75+ if let Err ( e) = manage_incoming (
76+ secret_key,
77+ stream,
78+ result_for_parent,
79+ data_for_user,
80+ authorization_requests_sender,
81+ )
82+ . await
83+ {
6884 info ! (
6985 target: LOG_TARGET ,
7086 "Incoming connection from {} failed: {}." , addr, e
0 commit comments