···26 - [x] Lobby tests
27 - [x] Game end test for actual return from loop
28 - [x] More transport crate tests
29- - [ ] Signaling is wrong, only kick everyone else on host leave if the lobby is open
30 - [x] Organize signalling and seperate out more logic
31 - [x] Signaling tests
32 - [ ] Testing crate for integration testing?
···26 - [x] Lobby tests
27 - [x] Game end test for actual return from loop
28 - [x] More transport crate tests
29+ - [x] Signaling is wrong, only kick everyone else on host leave if the lobby is open
30 - [x] Organize signalling and seperate out more logic
31 - [x] Signaling tests
32 - [ ] Testing crate for integration testing?
+21-1
manhunt-signaling/src/state.rs
···223 .unwrap_or_default();
224225 if host {
226- if let Some(mat) = matches.get_mut(&removed_peer.room) {
227 // If we're host, disconnect everyone else
228 mat.open_lobby = false;
229 mat.cancel.cancel();
···458 let matches = state.matches.lock().unwrap();
459 let mat = &matches[&code.to_string()];
460 assert!(mat.cancel.is_cancelled());
00000000000000000000461 assert!(!mat.open_lobby);
462 }
463
···223 .unwrap_or_default();
224225 if host {
226+ if let Some(mat) = matches.get_mut(&removed_peer.room).filter(|m| m.open_lobby) {
227 // If we're host, disconnect everyone else
228 mat.open_lobby = false;
229 mat.cancel.cancel();
···458 let matches = state.matches.lock().unwrap();
459 let mat = &matches[&code.to_string()];
460 assert!(mat.cancel.is_cancelled());
461+ assert!(!mat.open_lobby);
462+ }
463+464+ #[test]
465+ fn test_host_leave_with_players_but_started() {
466+ let mut state = ServerState::default();
467+468+ let code = "asdfasdfasdfasdf";
469+470+ quick_create(&mut state, code, 1);
471+ quick_join(&mut state, code, 2);
472+473+ state.mark_started(&code.to_string());
474+475+ let others = state.remove_peer(peer(1), true);
476+477+ assert_eq!(others, Some(vec![peer(2)]));
478+ let matches = state.matches.lock().unwrap();
479+ let mat = &matches[&code.to_string()];
480+ assert!(!mat.cancel.is_cancelled());
481 assert!(!mat.open_lobby);
482 }
483