From eb97e925e6eabd113870658fbb6b92988559fefd Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Wed, 27 Feb 2019 14:54:05 -0800 Subject: [PATCH] Flip LiveSession::session_id private, add getter --- server/src/live_session.rs | 6 +++++- server/src/web/api.rs | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/server/src/live_session.rs b/server/src/live_session.rs index 50e83c9a..1b9db569 100644 --- a/server/src/live_session.rs +++ b/server/src/live_session.rs @@ -34,7 +34,7 @@ impl_from!(LiveSessionError { /// Contains all of the state for a Rojo live-sync session. pub struct LiveSession { project: Arc, - pub session_id: SessionId, + session_id: SessionId, pub message_queue: Arc>, pub rbx_session: Arc>, pub imfs: Arc>, @@ -85,6 +85,10 @@ impl LiveSession { Ok(()) } + pub fn session_id(&self) -> SessionId { + self.session_id + } + pub fn serve_place_ids(&self) -> &Option> { &self.project.serve_place_ids } diff --git a/server/src/web/api.rs b/server/src/web/api.rs index 58da6ecb..c66408c6 100644 --- a/server/src/web/api.rs +++ b/server/src/web/api.rs @@ -144,7 +144,7 @@ impl ApiService { response_json(&ServerInfoResponse { server_version: self.server_version, protocol_version: 2, - session_id: self.live_session.session_id, + session_id: self.live_session.session_id(), expected_place_ids: self.live_session.serve_place_ids().clone(), root_instance_id: tree.get_root_id(), }) @@ -173,7 +173,7 @@ impl ApiService { if !new_messages.is_empty() { return response_json(&SubscribeResponse { - session_id: self.live_session.session_id, + session_id: self.live_session.session_id(), messages: Cow::Borrowed(&new_messages), message_cursor: new_cursor, }) @@ -198,7 +198,7 @@ impl ApiService { let (new_cursor, new_messages) = message_queue.get_messages_since(cursor); return response_json(&SubscribeResponse { - session_id: self.live_session.session_id, + session_id: self.live_session.session_id(), messages: Cow::Owned(new_messages), message_cursor: new_cursor, }) @@ -255,7 +255,7 @@ impl ApiService { } response_json(&ReadResponse { - session_id: self.live_session.session_id, + session_id: self.live_session.session_id(), message_cursor, instances, })