aboutsummaryrefslogtreecommitdiff
path: root/src/proto.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-02-21 16:43:17 +0100
committerAlex Auvolat <alex@adnab.me>2022-02-21 16:43:17 +0100
commit8858c9428936534ef2b62d73283cd800f4b838d6 (patch)
treee3569aaabad79f14093b1e140c88770676840dea /src/proto.rs
parent96a3cc1e1f5c0c4e73ad1036a7e0add19d9a197e (diff)
downloadnetapp-8858c9428936534ef2b62d73283cd800f4b838d6.tar.gz
netapp-8858c9428936534ef2b62d73283cd800f4b838d6.zip
Implement version tag for application as well
Diffstat (limited to 'src/proto.rs')
-rw-r--r--src/proto.rs21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/proto.rs b/src/proto.rs
index 146211b..e843bff 100644
--- a/src/proto.rs
+++ b/src/proto.rs
@@ -1,7 +1,7 @@
use std::collections::{HashMap, VecDeque};
use std::sync::Arc;
-use log::{error, trace};
+use log::trace;
use futures::{AsyncReadExt, AsyncWriteExt};
use kuska_handshake::async_std::BoxStreamWrite;
@@ -12,10 +12,6 @@ use async_trait::async_trait;
use crate::error::*;
-/// Tag which is exchanged between client and server upon connection establishment
-/// to check that they are running compatible versions of Netapp
-pub const VERSION_TAG: [u8; 8] = [b'n', b'e', b't', b'a', b'p', b'p', 0x00, 0x04];
-
/// Priority of a request (click to read more about priorities).
///
/// This priority value is used to priorize messages
@@ -118,10 +114,6 @@ pub(crate) trait SendLoop: Sync {
where
W: AsyncWriteExt + Unpin + Send + Sync,
{
- // Before anything, send version tag, which is checked in recv_loop
- write.write_all(&VERSION_TAG[..]).await?;
- write.flush().await?;
-
let mut sending = SendQueue::new();
let mut should_exit = false;
while !should_exit || !sending.is_empty() {
@@ -198,17 +190,6 @@ pub(crate) trait RecvLoop: Sync + 'static {
where
R: AsyncReadExt + Unpin + Send + Sync,
{
- let mut their_version_tag = [0u8; 8];
- read.read_exact(&mut their_version_tag[..]).await?;
- if their_version_tag != VERSION_TAG {
- let msg = format!(
- "Different netapp versions: {:?} (theirs) vs. {:?} (ours)",
- their_version_tag, VERSION_TAG
- );
- error!("{}", msg);
- return Err(Error::VersionMismatch(msg));
- }
-
let mut receiving = HashMap::new();
loop {
trace!("recv_loop: reading packet");