mirror of https://github.com/fafhrd91/actix-net
Add changelog
This commit is contained in:
parent
5f98d65717
commit
e01c6a4bb8
|
@ -1,6 +1,12 @@
|
||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2021-xx-xx
|
## Unreleased - 2021-xx-xx
|
||||||
|
* Server can start regardless what runtime it's in. [#266]
|
||||||
|
* Remove `Future` impl for `ServerBuilder`. [#266]
|
||||||
|
* Rename `Server` to `ServerHandle`. `ServerHandle` must be explicitly constructed with `Server::handle` API. [#266]
|
||||||
|
* Add `Server` type that can be `await` for blocking until server stop. [#266]
|
||||||
|
|
||||||
|
[#266]: https://github.com/actix/actix-net/pull/266
|
||||||
|
|
||||||
|
|
||||||
## 2.0.0-beta.4 - 2021-04-01
|
## 2.0.0-beta.4 - 2021-04-01
|
||||||
|
|
|
@ -188,12 +188,12 @@ impl ServerWorker {
|
||||||
availability: WorkerAvailability,
|
availability: WorkerAvailability,
|
||||||
config: ServerWorkerConfig,
|
config: ServerWorkerConfig,
|
||||||
) -> io::Result<WorkerHandle> {
|
) -> io::Result<WorkerHandle> {
|
||||||
|
assert!(!availability.available());
|
||||||
|
|
||||||
let (tx1, rx) = unbounded_channel();
|
let (tx1, rx) = unbounded_channel();
|
||||||
let (tx2, rx2) = unbounded_channel();
|
let (tx2, rx2) = unbounded_channel();
|
||||||
let avail = availability.clone();
|
let avail = availability.clone();
|
||||||
|
|
||||||
availability.set(false);
|
|
||||||
|
|
||||||
// Try to get actix system when have one.
|
// Try to get actix system when have one.
|
||||||
let system = System::try_current();
|
let system = System::try_current();
|
||||||
|
|
||||||
|
@ -208,16 +208,7 @@ impl ServerWorker {
|
||||||
System::set_current(system);
|
System::set_current(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut wrk = ServerWorker {
|
let mut services = Vec::new();
|
||||||
rx,
|
|
||||||
rx2,
|
|
||||||
services: Vec::new(),
|
|
||||||
availability,
|
|
||||||
conns: Counter::new(config.max_concurrent_connections),
|
|
||||||
factories,
|
|
||||||
state: Default::default(),
|
|
||||||
shutdown_timeout: config.shutdown_timeout,
|
|
||||||
};
|
|
||||||
|
|
||||||
// use a custom tokio runtime builder to change the settings of runtime.
|
// use a custom tokio runtime builder to change the settings of runtime.
|
||||||
let local = tokio::task::LocalSet::new();
|
let local = tokio::task::LocalSet::new();
|
||||||
|
@ -227,7 +218,7 @@ impl ServerWorker {
|
||||||
.build()
|
.build()
|
||||||
.and_then(|rt| {
|
.and_then(|rt| {
|
||||||
local.block_on(&rt, async {
|
local.block_on(&rt, async {
|
||||||
for (idx, factory) in wrk.factories.iter().enumerate() {
|
for (idx, factory) in factories.iter().enumerate() {
|
||||||
let service = factory.create().await.map_err(|_| {
|
let service = factory.create().await.map_err(|_| {
|
||||||
io::Error::new(
|
io::Error::new(
|
||||||
io::ErrorKind::Other,
|
io::ErrorKind::Other,
|
||||||
|
@ -236,8 +227,8 @@ impl ServerWorker {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
for (token, service) in service {
|
for (token, service) in service {
|
||||||
assert_eq!(token.0, wrk.services.len());
|
assert_eq!(token.0, services.len());
|
||||||
wrk.services.push(WorkerService {
|
services.push(WorkerService {
|
||||||
factory: idx,
|
factory: idx,
|
||||||
service,
|
service,
|
||||||
status: WorkerServiceStatus::Unavailable,
|
status: WorkerServiceStatus::Unavailable,
|
||||||
|
@ -253,7 +244,19 @@ impl ServerWorker {
|
||||||
match res {
|
match res {
|
||||||
Ok(rt) => {
|
Ok(rt) => {
|
||||||
factory_tx.send(None).unwrap();
|
factory_tx.send(None).unwrap();
|
||||||
local.block_on(&rt, wrk)
|
|
||||||
|
let worker = ServerWorker {
|
||||||
|
rx,
|
||||||
|
rx2,
|
||||||
|
services,
|
||||||
|
availability,
|
||||||
|
conns: Counter::new(config.max_concurrent_connections),
|
||||||
|
factories,
|
||||||
|
state: Default::default(),
|
||||||
|
shutdown_timeout: config.shutdown_timeout,
|
||||||
|
};
|
||||||
|
|
||||||
|
local.block_on(&rt, worker)
|
||||||
}
|
}
|
||||||
Err(e) => factory_tx.send(Some(e)).unwrap(),
|
Err(e) => factory_tx.send(Some(e)).unwrap(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue