bug fixes

This commit is contained in:
John Smith
2022-11-10 21:53:45 -05:00
parent 592c83d83a
commit 9c2a7488f1
13 changed files with 166 additions and 146 deletions

View File

@@ -4,6 +4,7 @@ use super::*;
use crate::xx::*;
use crate::*;
use core::convert::TryInto;
use crate::routing_table::VersionRange;
// #[repr(C, packed)]
// struct EnvelopeHeader {
@@ -271,8 +272,11 @@ impl Envelope {
self.version
}
pub fn get_min_max_version(&self) -> (u8, u8) {
(self.min_version, self.max_version)
pub fn get_min_max_version(&self) -> VersionRange {
VersionRange {
min: self.min_version,
max: self.max_version,
}
}
pub fn get_timestamp(&self) -> u64 {

View File

@@ -39,7 +39,7 @@ pub const DHT_SIGNATURE_LENGTH_ENCODED: usize = 86;
macro_rules! byte_array_type {
($name:ident, $size:expr) => {
#[derive(Clone, Copy, RkyvArchive, RkyvSerialize, RkyvDeserialize)]
#[archive_attr(repr(C), derive(CheckBytes))]
#[archive_attr(repr(C), derive(CheckBytes, Hash, Eq, PartialEq, PartialOrd, Ord))]
pub struct $name {
pub bytes: [u8; $size],
pub valid: bool,