-> impl response::Responder<'r> {
let gen = Generation(gen);
let iad = ctoken.i;
+ debug!("starting update stream {:?}", &iad);
+ let client = iad.ident;
let content = sse::content(iad, gen)?;
+ let content = DebugReader(content, client);
let content = response::Stream::chunked(content, 4096);
const CTYPE : &str = "text/event-stream; charset=utf-8";
let ctype = ContentType::parse_flexible(CTYPE).unwrap();
+
+use crate::imports::*;
+
#[derive(Debug)]
-pub struct DebugReader<T : Read>(pub T);
+pub struct DebugReader<T : Read>(pub T, pub ClientId);
impl<T : Read> Read for DebugReader<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize,io::Error> {
let l = buf.len();
- eprintln!("DebugReader({:?}).read()...", l);
+ trace!("{} read({})...", &self.1, l);
let r = self.0.read(buf);
- eprintln!("DebugReader({:?}).read() = {:?} {:?}", l, &r,
- r.as_ref().map(|&r| str::from_utf8(&buf[0..r])));
+ debug!("{} read({}) = {:?} {:?}", &self.1, l, &r,
+ r.as_ref().map(|&r| str::from_utf8(&buf[0..r])));
r
}
}
pub use crate::api::{Lens,TransparentLens};
pub use crate::utils::*;
pub use crate::spec::*;
+pub use crate::debugreader::DebugReader;
pub use nix::unistd::Uid;
pub mod commands;
pub mod utils;
pub mod mgmtchannel;
+pub mod debugreader;
#[path="slotmap-slot-idx.rs"] pub mod slotmap_slot_idx;
let tu = next.for_transmit(self.client);
// xxx handle overflow by allocating
write!(buf, "data: ")?;
- serde_json::to_writer(&mut buf, &tu)?;
+ serde_json::to_writer(&mut buf, &tu)
+ .map_err(|e| { error!("serde_json::to_write: {:?}", e); e })?;
write!(buf, "\n\
id: {}\n\n",
&self.to_send)?;