1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 19:12:56 +01:00

Fix wrong service to socket binding

This commit is contained in:
Nikolay Kim 2018-11-14 14:20:33 -08:00
parent dba86fbbf8
commit 741b3fb1c0
3 changed files with 24 additions and 5 deletions

View File

@ -2,10 +2,20 @@
## [0.2.2] - 2018-11-14
* Refactor Connector and Resolver services
### Added
* Add low/high caps to Framed
### Changed
* Refactor Connector and Resolver services
### Fixed
* Fix wrong service to socket binding
## [0.2.0] - 2018-11-08
### Added

View File

@ -40,7 +40,9 @@ impl Message for StopServer {
pub(crate) struct Token(usize);
impl Token {
pub(crate) fn next(&self) -> Token {
Token(self.0 + 1)
pub(crate) fn next(&mut self) -> Token {
let token = Token(self.0 + 1);
self.0 += 1;
token
}
}

View File

@ -144,8 +144,15 @@ impl Server {
{
let sockets = bind_addr(addr)?;
let token = self.token.next();
self.services.push(StreamNewService::create(
name.as_ref().to_string(),
token,
factory,
));
for lst in sockets {
self = self.listen(name.as_ref(), lst, factory.clone())
self.sockets.push((token, lst));
}
Ok(self)
}