Skip to content

Commit c52ae2b

Browse files
Start of async TCP
1 parent 2e6f9c7 commit c52ae2b

File tree

22 files changed

+408
-104
lines changed

22 files changed

+408
-104
lines changed

Cargo.lock

Lines changed: 164 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ rand = "0.8.4"
2222
regex = "1.5.4"
2323
socket2 = "0.3"
2424
time = "0.2"
25+
tokio = { version = "1.24.2", features = ["full"] }
2526
xml-rs = "0.8"
2627
yaserde = "0.3.16"
2728
yaserde_derive = "0.3.16"

crates/core/src/bc/de.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ use time::OffsetDateTime;
1313
type IResult<I, O, E = nom::error::VerboseError<I>> = Result<(I, O), nom::Err<E>>;
1414

1515
/// The error types used during deserialisation
16-
#[derive(Debug, Error)]
16+
#[derive(Debug, Error, Clone)]
1717
pub enum Error {
1818
/// A Nom parsing error usually a malformed packet
1919
#[error(display = "Parsing error: {}", _0)]
2020
NomError(String),
2121
/// An IO error such as the stream being dropped
2222
#[error(display = "I/O error")]
23-
IoError(#[error(source)] std::io::Error),
23+
IoError(#[error(source)] std::sync::Arc<std::io::Error>),
2424
}
2525
type NomErrorType<'a> = nom::error::VerboseError<&'a [u8]>;
2626

@@ -35,6 +35,12 @@ impl<'a> From<nom::Err<NomErrorType<'a>>> for Error {
3535
}
3636
}
3737

38+
impl From<std::io::Error> for Error {
39+
fn from(k: std::io::Error) -> Self {
40+
Error::IoError(std::sync::Arc::new(k))
41+
}
42+
}
43+
3844
fn read_from_reader<P, O, E, R>(mut parser: P, mut rdr: R) -> Result<O, E>
3945
where
4046
R: Read,

0 commit comments

Comments
 (0)