diff options
| author | Fuwn <[email protected]> | 2021-05-20 12:50:02 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-20 12:50:02 +0000 |
| commit | 9cb847e64c7570d8a2ac330483f4299c182c4859 (patch) | |
| tree | 46d0054775eb0aae1f8d89186fe01e45fe6d741f | |
| parent | refactor(whirl_server): cut down on the clones (diff) | |
| download | whirl-9cb847e64c7570d8a2ac330483f4299c182c4859.tar.xz whirl-9cb847e64c7570d8a2ac330483f4299c182c4859.zip | |
feat(whirl_server): development testing environment variable
Useful when debugging certain session exit bugs. Make sure to use the `runw` task!
| -rw-r--r-- | Makefile.toml | 1 | ||||
| -rw-r--r-- | whirl_server/src/lib.rs | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Makefile.toml b/Makefile.toml index 7f1882f..ebb302b 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -3,6 +3,7 @@ # ------------- [env] CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true +EXIT_ON_CLIENT_DISCONNECT = true # This variable will vary depending on where you installed Worlds, ideally, you # should know the correct value for your own system. diff --git a/whirl_server/src/lib.rs b/whirl_server/src/lib.rs index 12080cd..9c3e9d0 100644 --- a/whirl_server/src/lib.rs +++ b/whirl_server/src/lib.rs @@ -71,6 +71,12 @@ pub trait Server { if let Err(e) = Self::handle(state, stream, address, counter).await { error!("an error occurred: {}", e); } + + if std::env::var("EXIT_ON_CLIENT_DISCONNECT").unwrap_or_else(|_| "false".to_string()) + == "true" + { + std::process::exit(0); + } }); } } |