File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,21 +126,22 @@ pub(super) fn init() {
126126
127127 Executor :: spawn ( "[net_poll]" , async {
128128 loop {
129+ const MIN_WAIT_US : u64 = 1000 ;
129130 let wait = poll ( ) ;
130131 match wait {
131132 None => {
132133 Executor :: wait_for_interrupt ( ) . await ;
133134 }
134- Some ( wait) if wait < 200 => {
135+ Some ( wait) if wait < MIN_WAIT_US => {
135136 // Immediately wake if we want call poll() again in a very short time.
136137 Executor :: sched_yield ( ) . await ;
137138 }
138139 Some ( wait) => {
139140 futures:: future:: select (
140141 Executor :: wait_for_interrupt ( ) ,
141- // Halve the waiting time, to try to ensure that we don't exceed the suggested
142- // waiting time.
143- Executor :: sleep ( Duration :: from_micros ( wait / 2 ) ) ,
142+ // Reduce the waiting time, to try to ensure that we don't exceed the
143+ // suggested waiting time.
144+ Executor :: sleep ( Duration :: from_micros ( wait - MIN_WAIT_US ) ) ,
144145 )
145146 . await ;
146147 }
You can’t perform that action at this time.
0 commit comments