From d61f01451bc6913728bfae54a043372c18289ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Fri, 29 Dec 2017 16:51:44 +0100 Subject: [PATCH] Properly pass host to use --- src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index ada4111..863a4f8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,8 +35,8 @@ fn main() { /// /// The stream is returned as result. // TODO: Specify a host here! -fn create_stream() -> Result { - TcpStream::connect(HOST) +fn create_stream(host: String) -> Result { + TcpStream::connect(host) } @@ -75,9 +75,13 @@ impl PixCanvas { /// Spawn a single painter in a thread. fn spawn_painter(&mut self, area: Rect) { + // Get the host that will be used + let host = self.host.to_string(); + + // Create the painter thread let thread = thread::spawn(move || { // Create a new stream - let stream = create_stream() + let stream = create_stream(host) .expect("failed to open stream to pixelflut"); // Create a new client