Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(/usr/share/games/fortunes/science) #89

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 117 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion rustpad-server/src/rustpad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use tokio::sync::{broadcast, Notify};
use warp::ws::{Message, WebSocket};

use crate::{database::PersistedDocument, ot::transform_index};

/// The main object representing a collaborative session.
pub struct Rustpad {
/// State modified by critical sections of the code.
Expand All @@ -31,6 +30,7 @@ pub struct Rustpad {
/// Shared state involving multiple users, protected by a lock.
#[derive(Default)]
struct State {
live_users: u128,
operations: Vec<UserOperation>,
text: String,
language: Option<String>,
Expand Down Expand Up @@ -118,6 +118,7 @@ impl From<PersistedDocument> for Rustpad {
let rustpad = Self::default();
{
let mut state = rustpad.state.write();
state.live_users += 1;
state.text = document.text;
state.language = document.language;
state.operations.push(UserOperation {
Expand Down
Loading