serve command exiting when web socket port is already in use (#1179)

* Handled web socket port used issue

* Lint
This commit is contained in:
WhizSid 2020-09-22 15:29:57 +05:30 committed by GitHub
parent b313c97ceb
commit 41e436f331
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -326,10 +326,17 @@ pub fn serve(
}
})
.unwrap();
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 || {
ws_server.listen(&*ws_address).unwrap();
ws_server.run().unwrap();
});
Some(broadcaster)
} else {
println!("Watching in watch only mode, no web server will be started");