@@ -2223,7 +2223,7 @@ async fn zero_byte_handshake(transport1: Transport, transport2: Transport, hands
2223
2223
) ;
2224
2224
2225
2225
// This step ensures we have not messed with the notification frames.
2226
- tracing:: info!( "Send async notification..." ) ;
2226
+ tracing:: info!( "Send sync notification..." ) ;
2227
2227
handle1. send_sync_notification ( peer2, vec ! [ 1 , 3 , 3 , 7 ] ) . unwrap ( ) ;
2228
2228
handle2. send_sync_notification ( peer1, vec ! [ 1 , 3 , 3 , 8 ] ) . unwrap ( ) ;
2229
2229
@@ -2241,6 +2241,46 @@ async fn zero_byte_handshake(transport1: Transport, transport2: Transport, hands
2241
2241
notification: BytesMut :: from( & [ 1 , 3 , 3 , 8 ] [ ..] ) ,
2242
2242
}
2243
2243
) ;
2244
+
2245
+ // Ensure the handle can send empty notifications.
2246
+ tracing:: info!( "Send empty sync notification..." ) ;
2247
+ handle1. send_sync_notification ( peer2, vec ! [ ] ) . unwrap ( ) ;
2248
+ handle2. send_sync_notification ( peer1, vec ! [ ] ) . unwrap ( ) ;
2249
+
2250
+ assert_eq ! (
2251
+ handle2. next( ) . await . unwrap( ) ,
2252
+ NotificationEvent :: NotificationReceived {
2253
+ peer: peer1,
2254
+ notification: BytesMut :: from( & [ ] [ ..] ) ,
2255
+ }
2256
+ ) ;
2257
+ assert_eq ! (
2258
+ handle1. next( ) . await . unwrap( ) ,
2259
+ NotificationEvent :: NotificationReceived {
2260
+ peer: peer2,
2261
+ notification: BytesMut :: from( & [ ] [ ..] ) ,
2262
+ }
2263
+ ) ;
2264
+
2265
+ // Double check non-empty notifications.
2266
+ tracing:: info!( "Send sync notification..." ) ;
2267
+ handle1. send_sync_notification ( peer2, vec ! [ 1 , 3 , 3 , 9 ] ) . unwrap ( ) ;
2268
+ handle2. send_sync_notification ( peer1, vec ! [ 1 , 3 , 3 , 4 ] ) . unwrap ( ) ;
2269
+
2270
+ assert_eq ! (
2271
+ handle2. next( ) . await . unwrap( ) ,
2272
+ NotificationEvent :: NotificationReceived {
2273
+ peer: peer1,
2274
+ notification: BytesMut :: from( & [ 1 , 3 , 3 , 9 ] [ ..] ) ,
2275
+ }
2276
+ ) ;
2277
+ assert_eq ! (
2278
+ handle1. next( ) . await . unwrap( ) ,
2279
+ NotificationEvent :: NotificationReceived {
2280
+ peer: peer2,
2281
+ notification: BytesMut :: from( & [ 1 , 3 , 3 , 4 ] [ ..] ) ,
2282
+ }
2283
+ ) ;
2244
2284
}
2245
2285
2246
2286
#[ tokio:: test]
0 commit comments