Skip to content

Commit 37e193e

Browse files
committed
GH-525: fix the poll()
1 parent 8658aed commit 37e193e

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

node/src/server_initializer.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,16 @@ impl Future for ServerInitializerReal {
9393
type Error = ();
9494

9595
fn poll(&mut self) -> Result<Async<<Self as Future>::Item>, <Self as Future>::Error> {
96-
// try_ready!(self
97-
// .dns_socket_server
98-
// .as_mut()
99-
// .join(self.bootstrapper.as_mut())
100-
// .poll());
101-
try_ready!(self.bootstrapper.as_mut().poll());
96+
match self.is_entry_dns_enabled {
97+
true => {
98+
try_ready!(self
99+
.dns_socket_server
100+
.as_mut()
101+
.join(self.bootstrapper.as_mut())
102+
.poll());
103+
}
104+
false => try_ready!(self.bootstrapper.as_mut().poll()),
105+
}
102106
Ok(Async::Ready(()))
103107
}
104108
}
@@ -798,8 +802,7 @@ pub mod tests {
798802
}
799803

800804
#[test]
801-
// TODO: GH-525: It should panic
802-
// #[should_panic(expected = "EntryDnsServerMock was instructed to panic")]
805+
#[should_panic(expected = "EntryDnsServerMock was instructed to panic")]
803806
fn server_initializer_dns_socket_server_panics() {
804807
let bootstrapper = CrashTestDummy::new(CrashPoint::None, BootstrapperConfig::new());
805808
let privilege_dropper = PrivilegeDropperMock::new();
@@ -813,7 +816,7 @@ pub mod tests {
813816
bootstrapper: Box::new(bootstrapper),
814817
privilege_dropper: Box::new(privilege_dropper),
815818
dirs_wrapper: Box::new(dirs_wrapper),
816-
is_entry_dns_enabled: false,
819+
is_entry_dns_enabled: true,
817820
};
818821

819822
let _ = subject.poll();

0 commit comments

Comments
 (0)