[[package]]
name = "hyper"
version = "0.10.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273"
dependencies = [
"base64 0.9.3",
"httparse",
[[package]]
name = "rocket"
version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6130967b369cfb8411b0b73e96fcba1229c32a9cc6f295d144f879bfced13c6e"
dependencies = [
"atty",
"base64 0.12.3",
[[package]]
name = "rocket_codegen"
version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb852e6da168fb948a8f2b798ba2e2f0e4fc860eae0efa9cf2bf0f5466bb0425"
dependencies = [
"devise",
"glob 0.3.0",
[[package]]
name = "rocket_contrib"
version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3946ca815127041d8f64455561031d058c22ae1b135251502c5ea523cf9e14b"
dependencies = [
"glob 0.3.0",
"log 0.4.8",
[[package]]
name = "rocket_http"
version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1aff5a5480175f2f553a876b251e9350c74196128806d176da3a51c82aab5428"
dependencies = [
"cookie",
"hyper",
num-traits = "0.2"
-rocket = "0.4"
-rocket_contrib = { version = "0.4", default-features=false, features=["tera_templates","helmet","json"] }
+#rocket = "0.4"
+#rocket_contrib = { version = "0.4", default-features=false, features=["tera_templates","helmet","json"] }
+
+rocket = { path = "/home/ian/Rustup/Game/rocket/core/lib" }
+rocket_contrib = { path = "/home/ian/Rustup/Game/rocket/contrib/lib", default-features=false, features=["tera_templates","helmet","json"] }
vecdeque-stableix = "0"
+[patch.crates-io]
+hyper = { path = "/home/ian/Rustup/Game/hyper" }
+
#hmac = "0.7"
#base64 = "0.10"
#sha2 = "0.8"
let gen = Generation(gen);
let iad = ctoken.i;
let content = sse::content(iad, gen)?;
- let content = response::Stream::chunked(content, 1);
+ let content = response::Stream::chunked(content, 4096 /* xxx */);
const CTYPE : &str = "text/event-stream; charset=utf-8";
let ctype = ContentType::parse_flexible(CTYPE).unwrap();
// xxx set CORS allowed header
struct UpdateReader {
player : PlayerId,
client : ClientId,
+ need_flush : bool,
init_confirmation_send : iter::Once<()>,
to_send : UpdateId,
ami : Arc<Mutex<Instance>>,
cseq : ClientSequence,
}
+#[derive(Error,Debug)]
+#[error("WouldBlock error misreported!")]
+struct FlushWouldBlockError{}
+
impl Read for UpdateReader {
fn read(&mut self, orig_buf: &mut [u8]) -> Result<usize,io::Error> {
let em : fn(&'static str) -> io::Error =
if self.init_confirmation_send.next().is_some() {
write!(buf, r#"
-event: commsworking
data: server online
"#)?;
+/*event: commsworking*/
}
let pu = &mut amig.updates.get(self.player)
eprintln!("SENDING {} to {:?} {:?}:\n{}\n",
generated, &self.player, &self.client,
str::from_utf8(&orig_buf[0..generated]).unwrap());
+ self.need_flush = true;
return Ok(generated)
}
+ if self.need_flush {
+ self.need_flush = false;
+ return Err(io::Error::new(io::ErrorKind::WouldBlock,
+ FlushWouldBlockError{}));
+ }
+
amig = cv.wait_timeout(amig, UPDATE_KEEPALIVE)
.map_err(|_| em("poison"))?.0;
write!(buf,r#"
UpdateReader {
player, client, to_send, ami,
+ need_flush : false,
init_confirmation_send : iter::once(()),
}
};