@@ -88,13 +88,19 @@ fn limit_by_node_id(allowed_nodes: HashSet<NodeId>) -> EventSender {
88
88
n0_future:: task:: spawn ( async move {
89
89
while let Some ( msg) = rx. recv ( ) . await {
90
90
if let ProviderMessage :: ClientConnected ( msg) = msg {
91
- let node_id = msg. node_id ;
92
- let res = if allowed_nodes. contains ( & node_id) {
93
- println ! ( "Client connected: {node_id}" ) ;
94
- Ok ( ( ) )
95
- } else {
96
- println ! ( "Client rejected: {node_id}" ) ;
97
- Err ( AbortReason :: Permission )
91
+ let res = match msg. node_id {
92
+ Some ( node_id) if allowed_nodes. contains ( & node_id) => {
93
+ println ! ( "Client connected: {node_id}" ) ;
94
+ Ok ( ( ) )
95
+ }
96
+ Some ( node_id) => {
97
+ println ! ( "Client rejected: {node_id}" ) ;
98
+ Err ( AbortReason :: Permission )
99
+ }
100
+ None => {
101
+ println ! ( "Client rejected: no node id" ) ;
102
+ Err ( AbortReason :: Permission )
103
+ }
98
104
} ;
99
105
msg. tx . send ( res) . await . ok ( ) ;
100
106
}
@@ -202,7 +208,7 @@ fn limit_max_connections(max_connections: usize) -> EventSender {
202
208
let connection_id = msg. connection_id ;
203
209
let node_id = msg. node_id ;
204
210
let res = if let Ok ( n) = requests. inc ( ) {
205
- println ! ( "Accepting connection {n}, node_id {node_id}, connection_id {connection_id}" ) ;
211
+ println ! ( "Accepting connection {n}, node_id {node_id:? }, connection_id {connection_id}" ) ;
206
212
Ok ( ( ) )
207
213
} else {
208
214
Err ( AbortReason :: RateLimited )
0 commit comments