1
This commit is contained in:
parent
38a8b35364
commit
b8eb286d0a
@ -82,16 +82,7 @@ impl MyWs {
|
||||
tmp_bytes.put_u16_le(magic_code);
|
||||
tmp_bytes.put_u16_le(ext_len);
|
||||
tmp_bytes.put_i32_le(0);
|
||||
//tmp_bytes.put_u16_le(0);
|
||||
//tmp_bytes.put_u16_le(0);
|
||||
tmp_bytes.put_i64_le(0);
|
||||
/*tmp_bytes.put_u16(0);
|
||||
tmp_bytes.put_u16(0);
|
||||
tmp_bytes.put_i32(0);
|
||||
tmp_bytes.put_u16(0);
|
||||
tmp_bytes.put_u16(0);
|
||||
tmp_bytes.put_i32(0);
|
||||
tmp_bytes.put_i64(0);*/
|
||||
for i in 24..tmp_bytes.capacity() {
|
||||
tmp_bytes.put_i8(0);
|
||||
}
|
||||
@ -146,7 +137,6 @@ impl StreamHandler<Result<ws::Message, ws::ProtocolError>> for MyWs {
|
||||
data: a_bytes
|
||||
};
|
||||
a.send(msg);
|
||||
//ctx.binary(a_bytes);
|
||||
}
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(10)).await;
|
||||
@ -235,7 +225,11 @@ async fn index(req: HttpRequest, stream: web::Payload, data: web::Data<AppStateW
|
||||
match down_stream.try_read(&mut data) {
|
||||
Ok(n) => {
|
||||
println!("read {} bytes", n);
|
||||
let mut tmp_bytes = BytesMut::with_capacity((n + 24) as usize);
|
||||
let mut tmp_bytes = BytesMut::with_capacity((n + 0) as usize);
|
||||
for i in 0..n {
|
||||
tmp_bytes.put_u8(data[i]);
|
||||
}
|
||||
Arc::downgrade(&mut recv_queue).upgrade().unwrap().lock().unwrap().borrow_mut().insert(0, tmp_bytes);
|
||||
}
|
||||
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
|
||||
println!("read error 1");
|
||||
|
Loading…
x
Reference in New Issue
Block a user