1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-28 18:00:37 +02:00

express spawn fn as spawn fut (#256)

This commit is contained in:
Rob Ede
2021-01-29 15:16:30 +00:00
committed by GitHub
parent 2924419905
commit 1b35ff8ee6
8 changed files with 130 additions and 111 deletions

View File

@ -1,8 +1,10 @@
use std::time::Duration;
use std::{io, thread};
use actix_rt::time::{sleep_until, Instant};
use actix_rt::System;
use actix_rt::{
time::{sleep_until, Instant},
System,
};
use log::{error, info};
use mio::{Interest, Poll, Token as MioToken};
use slab::Slab;
@ -401,10 +403,11 @@ impl Accept {
// after the sleep a Timer interest is sent to Accept Poll
let waker = self.waker.clone();
System::current().arbiter().spawn(Box::pin(async move {
System::current().worker().spawn(async move {
sleep_until(Instant::now() + Duration::from_millis(510)).await;
waker.wake(WakerInterest::Timer);
}));
});
return;
}
}