@@ -74,9 +74,9 @@ async fn ping_one_0rtt(
74
74
node_id : NodeId ,
75
75
wait_for_ticket : bool ,
76
76
i : u64 ,
77
+ t0 : Instant ,
77
78
) -> Result < ( ) > {
78
79
let msg = i. to_be_bytes ( ) ;
79
- let t0 = Instant :: now ( ) ;
80
80
let data = api. echo_0rtt ( msg. to_vec ( ) ) . await ?;
81
81
let latency = endpoint. remote_info ( node_id) . and_then ( |x| x. latency ) ;
82
82
if wait_for_ticket {
@@ -105,9 +105,9 @@ async fn ping_one_no_0rtt(
105
105
endpoint : & Endpoint ,
106
106
node_id : NodeId ,
107
107
i : u64 ,
108
+ t0 : Instant ,
108
109
) -> Result < ( ) > {
109
110
let msg = i. to_be_bytes ( ) ;
110
- let t0 = Instant :: now ( ) ;
111
111
let data = api. echo ( msg. to_vec ( ) ) . await ?;
112
112
let latency = endpoint. remote_info ( node_id) . and_then ( |x| x. latency ) ;
113
113
drop ( api) ;
@@ -131,13 +131,14 @@ async fn ping_one(
131
131
wait_for_ticket : bool ,
132
132
) -> Result < ( ) > {
133
133
let node_id = addr. node_id ;
134
+ let t0 = Instant :: now ( ) ;
134
135
if !no_0rtt {
135
136
println ! ( "Connecting to {} with 0-RTT" , addr. node_id) ;
136
137
let api = EchoApi :: connect_0rtt ( endpoint. clone ( ) , addr. clone ( ) ) . await ?;
137
- ping_one_0rtt ( api, & endpoint, node_id, wait_for_ticket, i) . await ?;
138
+ ping_one_0rtt ( api, & endpoint, node_id, wait_for_ticket, i, t0 ) . await ?;
138
139
} else {
139
140
let api = EchoApi :: connect ( endpoint. clone ( ) , addr. clone ( ) ) . await ?;
140
- ping_one_no_0rtt ( api, & endpoint, node_id, i) . await ?;
141
+ ping_one_no_0rtt ( api, & endpoint, node_id, i, t0 ) . await ?;
141
142
}
142
143
Ok ( ( ) )
143
144
}
0 commit comments