File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -62,9 +62,12 @@ async fn main() -> Result<(), Error> {
6262 println ! ( "connecting {server}.." ) ;
6363
6464 let config = Config {
65- psk : Some ( Arc :: new ( |hint : & [ u8 ] | -> Result < Vec < u8 > , Error > {
66- println ! ( "Server's hint: {}" , String :: from_utf8( hint. to_vec( ) ) ?) ;
67- Ok ( vec ! [ 0xAB , 0xC1 , 0x23 ] )
65+ psk : Some ( Arc :: new ( |hint : & [ u8 ] | {
66+ let hint = hint. to_owned ( ) ;
67+ Box :: pin ( async move {
68+ println ! ( "Server's hint: {}" , String :: from_utf8( hint. to_vec( ) ) ?) ;
69+ Ok ( vec ! [ 0xAB , 0xC1 , 0x23 ] )
70+ } )
6871 } ) ) ,
6972 psk_identity_hint : Some ( "webrtc-rs DTLS Server" . as_bytes ( ) . to_vec ( ) ) ,
7073 cipher_suites : vec ! [ CipherSuiteId :: Tls_Psk_With_Aes_128_Ccm_8 ] ,
Original file line number Diff line number Diff line change @@ -57,9 +57,12 @@ async fn main() -> Result<(), Error> {
5757 let host = matches. value_of ( "host" ) . unwrap ( ) . to_owned ( ) ;
5858
5959 let cfg = Config {
60- psk : Some ( Arc :: new ( |hint : & [ u8 ] | -> Result < Vec < u8 > , Error > {
61- println ! ( "Client's hint: {}" , String :: from_utf8( hint. to_vec( ) ) ?) ;
62- Ok ( vec ! [ 0xAB , 0xC1 , 0x23 ] )
60+ psk : Some ( Arc :: new ( |hint : & [ u8 ] | {
61+ let hint = hint. to_owned ( ) ;
62+ Box :: pin ( async move {
63+ println ! ( "Client's hint: {}" , String :: from_utf8( hint. to_vec( ) ) ?) ;
64+ Ok ( vec ! [ 0xAB , 0xC1 , 0x23 ] )
65+ } )
6366 } ) ) ,
6467 psk_identity_hint : Some ( "webrtc-rs DTLS Client" . as_bytes ( ) . to_vec ( ) ) ,
6568 cipher_suites : vec ! [ CipherSuiteId :: Tls_Psk_With_Aes_128_Ccm_8 ] ,
You can’t perform that action at this time.
0 commit comments