mirror of
https://github.com/htrefil/rkvm.git
synced 2024-12-26 09:58:32 +01:00
Update deps, use consistent rkvm- prefix for crates
This commit is contained in:
parent
2d45ae6e5a
commit
ae5ce0bed7
38 changed files with 508 additions and 392 deletions
856
Cargo.lock
generated
856
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,2 +1,2 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["client", "server", "input", "net", "certificate-gen"]
|
members = ["rkvm-client", "rkvm-server", "rkvm-input", "rkvm-net", "rkvm-certificate-gen"]
|
0
client/.gitignore → rkvm-client/.gitignore
vendored
0
client/.gitignore → rkvm-client/.gitignore
vendored
|
@ -9,8 +9,8 @@ edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tokio = { version = "1.0.1", features = ["macros", "time", "fs", "net", "signal", "rt-multi-thread", "sync"] }
|
tokio = { version = "1.0.1", features = ["macros", "time", "fs", "net", "signal", "rt-multi-thread", "sync"] }
|
||||||
input = { path = "../input" }
|
rkvm-input = { path = "../rkvm-input" }
|
||||||
net = { path = "../net" }
|
rkvm-net = { path = "../rkvm-net" }
|
||||||
serde = { version = "1.0.117", features = ["derive"] }
|
serde = { version = "1.0.117", features = ["derive"] }
|
||||||
toml = "0.5.7"
|
toml = "0.5.7"
|
||||||
structopt = "0.3.20"
|
structopt = "0.3.20"
|
|
@ -2,9 +2,9 @@ mod config;
|
||||||
|
|
||||||
use anyhow::{Context, Error};
|
use anyhow::{Context, Error};
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use input::EventWriter;
|
use rkvm_input::EventWriter;
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use net::{self, Message, PROTOCOL_VERSION};
|
use rkvm_net::{self, Message, PROTOCOL_VERSION};
|
||||||
use std::convert::Infallible;
|
use std::convert::Infallible;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process;
|
use std::process;
|
||||||
|
@ -38,9 +38,9 @@ async fn run(server: &str, port: u16, certificate_path: &Path) -> Result<Infalli
|
||||||
|
|
||||||
log::info!("Connected to {}:{}", server, port);
|
log::info!("Connected to {}:{}", server, port);
|
||||||
|
|
||||||
net::write_version(&mut stream, PROTOCOL_VERSION).await?;
|
rkvm_net::write_version(&mut stream, PROTOCOL_VERSION).await?;
|
||||||
|
|
||||||
let version = net::read_version(&mut stream).await?;
|
let version = rkvm_net::read_version(&mut stream).await?;
|
||||||
if version != PROTOCOL_VERSION {
|
if version != PROTOCOL_VERSION {
|
||||||
return Err(anyhow::anyhow!(
|
return Err(anyhow::anyhow!(
|
||||||
"Incompatible protocol version (got {}, expecting {})",
|
"Incompatible protocol version (got {}, expecting {})",
|
||||||
|
@ -51,7 +51,7 @@ async fn run(server: &str, port: u16, certificate_path: &Path) -> Result<Infalli
|
||||||
|
|
||||||
let mut writer = EventWriter::new().await?;
|
let mut writer = EventWriter::new().await?;
|
||||||
loop {
|
loop {
|
||||||
let message = time::timeout(net::MESSAGE_TIMEOUT, net::read_message(&mut stream))
|
let message = time::timeout(rkvm_net::MESSAGE_TIMEOUT, rkvm_net::read_message(&mut stream))
|
||||||
.await
|
.await
|
||||||
.context("Read timed out")??;
|
.context("Read timed out")??;
|
||||||
match message {
|
match message {
|
0
input/.gitignore → rkvm-input/.gitignore
vendored
0
input/.gitignore → rkvm-input/.gitignore
vendored
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "input"
|
name = "rkvm-input"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
authors = ["Jan Trefil <8711792+htrefil@users.noreply.github.com>"]
|
authors = ["Jan Trefil <8711792+htrefil@users.noreply.github.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
0
net/.gitignore → rkvm-net/.gitignore
vendored
0
net/.gitignore → rkvm-net/.gitignore
vendored
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "net"
|
name = "rkvm-net"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
authors = ["Jan Trefil <8711792+htrefil@users.noreply.github.com>"]
|
authors = ["Jan Trefil <8711792+htrefil@users.noreply.github.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
input = { path = "../input" }
|
rkvm-input = { path = "../rkvm-input" }
|
||||||
serde = { version = "1.0.117", features = ["derive"] }
|
serde = { version = "1.0.117", features = ["derive"] }
|
||||||
bincode = "1.3.1"
|
bincode = "1.3.1"
|
||||||
tokio = { version = "1.0.1", features = ["io-util"] }
|
tokio = { version = "1.0.1", features = ["io-util"] }
|
|
@ -1,4 +1,4 @@
|
||||||
use input::Event;
|
use rkvm_input::Event;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::io::{Error, ErrorKind};
|
use std::io::{Error, ErrorKind};
|
0
server/.gitignore → rkvm-server/.gitignore
vendored
0
server/.gitignore → rkvm-server/.gitignore
vendored
|
@ -9,8 +9,8 @@ edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tokio = { version = "1.0.1", features = ["macros", "time", "fs", "net", "signal", "rt-multi-thread", "sync"] }
|
tokio = { version = "1.0.1", features = ["macros", "time", "fs", "net", "signal", "rt-multi-thread", "sync"] }
|
||||||
input = { path = "../input" }
|
rkvm-input = { path = "../rkvm-input" }
|
||||||
net = { path = "../net" }
|
rkvm-net = { path = "../rkvm-net" }
|
||||||
serde = { version = "1.0.117", features = ["derive"] }
|
serde = { version = "1.0.117", features = ["derive"] }
|
||||||
toml = "0.5.7"
|
toml = "0.5.7"
|
||||||
structopt = "0.3.20"
|
structopt = "0.3.20"
|
|
@ -1,4 +1,4 @@
|
||||||
use input::Key;
|
use rkvm_input::Key;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
|
@ -2,9 +2,9 @@ mod config;
|
||||||
|
|
||||||
use anyhow::{Context, Error};
|
use anyhow::{Context, Error};
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use input::{Direction, Event, EventManager, Key, KeyKind};
|
use rkvm_input::{Direction, Event, EventManager, Key, KeyKind};
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use net::{self, Message, PROTOCOL_VERSION};
|
use rkvm_net::{self, Message, PROTOCOL_VERSION};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::convert::Infallible;
|
use std::convert::Infallible;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
@ -25,9 +25,9 @@ async fn handle_connection<T>(
|
||||||
where
|
where
|
||||||
T: AsyncRead + AsyncWrite + Unpin,
|
T: AsyncRead + AsyncWrite + Unpin,
|
||||||
{
|
{
|
||||||
net::write_version(&mut stream, PROTOCOL_VERSION).await?;
|
rkvm_net::write_version(&mut stream, PROTOCOL_VERSION).await?;
|
||||||
|
|
||||||
let version = net::read_version(&mut stream).await?;
|
let version = rkvm_net::read_version(&mut stream).await?;
|
||||||
if version != PROTOCOL_VERSION {
|
if version != PROTOCOL_VERSION {
|
||||||
return Err(anyhow::anyhow!(
|
return Err(anyhow::anyhow!(
|
||||||
"Incompatible protocol version (got {}, expecting {})",
|
"Incompatible protocol version (got {}, expecting {})",
|
||||||
|
@ -38,15 +38,15 @@ where
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
// Send a keep alive message in intervals of half of the timeout just to be on the safe side.
|
// Send a keep alive message in intervals of half of the timeout just to be on the safe side.
|
||||||
let message = match time::timeout(net::MESSAGE_TIMEOUT / 2, receiver.recv()).await {
|
let message = match time::timeout(rkvm_net::MESSAGE_TIMEOUT / 2, receiver.recv()).await {
|
||||||
Ok(Some(message)) => Message::Event(message),
|
Ok(Some(message)) => Message::Event(message),
|
||||||
Ok(None) => return Ok(()),
|
Ok(None) => return Ok(()),
|
||||||
Err(_) => Message::KeepAlive,
|
Err(_) => Message::KeepAlive,
|
||||||
};
|
};
|
||||||
|
|
||||||
time::timeout(
|
time::timeout(
|
||||||
net::MESSAGE_TIMEOUT,
|
rkvm_net::MESSAGE_TIMEOUT,
|
||||||
net::write_message(&mut stream, &message),
|
rkvm_net::write_message(&mut stream, &message),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.context("Write timeout")??;
|
.context("Write timeout")??;
|
Loading…
Reference in a new issue