mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Wrap RojoTree in Mutex
This commit is contained in:
parent
7a7e9087e6
commit
1d84d3e440
2 changed files with 10 additions and 7 deletions
|
|
@ -1,4 +1,7 @@
|
|||
use std::collections::HashSet;
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
sync::{Mutex, MutexGuard},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
imfs::new::{Imfs, ImfsFetcher},
|
||||
|
|
@ -12,7 +15,7 @@ use crate::{
|
|||
pub struct ServeSession<F> {
|
||||
root_project: Option<Project>,
|
||||
session_id: SessionId,
|
||||
tree: RojoTree,
|
||||
tree: Mutex<RojoTree>,
|
||||
message_queue: MessageQueue<()>, // TODO: Real message type
|
||||
imfs: Imfs<F>,
|
||||
}
|
||||
|
|
@ -25,14 +28,14 @@ impl<F: ImfsFetcher> ServeSession<F> {
|
|||
ServeSession {
|
||||
session_id,
|
||||
root_project,
|
||||
tree,
|
||||
tree: Mutex::new(tree),
|
||||
message_queue,
|
||||
imfs,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tree(&self) -> &RojoTree {
|
||||
&self.tree
|
||||
pub fn tree(&self) -> MutexGuard<'_, RojoTree> {
|
||||
self.tree.lock().unwrap()
|
||||
}
|
||||
|
||||
pub fn imfs(&self) -> &Imfs<F> {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ use crate::{
|
|||
serve_session::ServeSession,
|
||||
web::{
|
||||
interface::{
|
||||
Instance, NotFoundError, ReadResponse, ServerInfoResponse, SubscribeResponse,
|
||||
PROTOCOL_VERSION, SERVER_VERSION,
|
||||
Instance, NotFoundError, ReadResponse, ServerInfoResponse, PROTOCOL_VERSION,
|
||||
SERVER_VERSION,
|
||||
},
|
||||
util::{json, json_ok},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue