chiark / gitweb /
debugging
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 4 Jul 2020 15:57:06 +0000 (16:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 4 Jul 2020 15:57:06 +0000 (16:57 +0100)
src/global.rs
src/sse.rs

index 38d1b42d0a032ac4805079fbabe5ac4bc59ac843..1601067bc95248eb2b4333d9d330278d3f638a5b 100644 (file)
@@ -13,6 +13,7 @@ impl Borrow<str> for RawToken {
   fn borrow(&self) -> &str { &self.0 }
 }
 
+#[derive(Debug)] 
 pub struct Client {
   pub player : PlayerId,
 }
@@ -23,6 +24,7 @@ impl Client {
   }
 }
 
+#[derive(Debug)]
 pub struct PreparedUpdate {
   pub gen : Generation,
   pub client : ClientId,
@@ -31,24 +33,26 @@ pub struct PreparedUpdate {
   pub json : String,
 }
 
+#[derive(Debug)]
 pub struct PlayerUpdates {
   pub log : StableIndexVecDeque<Arc<PreparedUpdate>,sse::UpdateId>,
   pub cv : Arc<Condvar>,
 }
 
+#[derive(Debug)]
 pub struct Instance {
   pub gs : GameState,
   pub clients : DenseSlotMap<ClientId,Client>,
   pub updates : SecondarySlotMap<PlayerId, PlayerUpdates>,
 }
 
-#[derive(Clone)]
+#[derive(Clone,Debug)]
 pub struct InstanceAccessDetails<Id> {
   pub g : Arc<Mutex<Instance>>,
   pub ident : Id,
 }
 
-#[derive(Clone)]
+#[derive(Clone,Debug)]
 pub struct InstanceAccess<'i, Id> {
   pub raw_token : &'i str,
   pub i : InstanceAccessDetails<Id>,
index 228157bf73676c56c2f7c068ef5f5371be8a84e0..4075fdefe1f3cf79e1265b12308186f350f7736a 100644 (file)
@@ -179,6 +179,8 @@ pub fn content(iad : InstanceAccessDetails<ClientId>, gen: Generation)
     let _g = &mut ig.gs;
     let cl = ig.clients.byid(client)?;
     let player = cl.player;
+eprintln!("updates content iad={:?} player={:?} cl={:?} updates={:?}",
+          &iad, &player, &cl, &ig.updates);
     let ami = iad.g.clone();
 
     let log = &ig.updates.byid(player)?.log;