Skip to content

Commit

Permalink
(/usr/share/games/fortunes/science)
Browse files Browse the repository at this point in the history
%
The solution to a problem changes the nature of the problem.
		-- Peer
  • Loading branch information
nandhinianandj committed Nov 10, 2024
1 parent cbc5df8 commit cf267e3
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 2 deletions.
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

0 comments on commit cf267e3

Please sign in to comment.