serve command exiting when web socket port is already in use (#1179)
* Handled web socket port used issue * Lint
This commit is contained in:
parent
b313c97ceb
commit
41e436f331
|
@ -326,10 +326,17 @@ pub fn serve(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let broadcaster = ws_server.broadcaster();
|
let broadcaster = ws_server.broadcaster();
|
||||||
|
|
||||||
|
let ws_server = ws_server
|
||||||
|
.bind(&*ws_address)
|
||||||
|
.map_err(|_| format!("Address {} is already in use.", &ws_address))?;
|
||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
ws_server.listen(&*ws_address).unwrap();
|
ws_server.run().unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
Some(broadcaster)
|
Some(broadcaster)
|
||||||
} else {
|
} else {
|
||||||
println!("Watching in watch only mode, no web server will be started");
|
println!("Watching in watch only mode, no web server will be started");
|
||||||
|
|
Loading…
Reference in a new issue