From b49ab40b223aaea4f3449106323be1df0152457b Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Fri, 7 May 2021 21:13:34 +0530 Subject: [PATCH] Fix #2 --- src/local.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/local.rs b/src/local.rs index 4057851..d5a3dcd 100644 --- a/src/local.rs +++ b/src/local.rs @@ -79,7 +79,7 @@ impl Local { /// Insert VALUEs onto Global in either a single packet or as a stream as per it's size pub async fn insert(&mut self, key: Bytes, value: Bytes) -> Result<(), Box> { - if value.len() > MAX_BYTE_SIZE { + if value.len() < MAX_BYTE_SIZE { self.insert_single(key, value).await } else { self.insert_file(key, value).await @@ -195,10 +195,10 @@ impl Local { Err(e) => return Err(Box::new(DstoreError(format!("Global: {}", e)))), } as usize; // If VALUE sized larger than single packet transportable, use get_file(), else use get_single() - if size > MAX_BYTE_SIZE { - self.get_file(key).await - } else { + if size < MAX_BYTE_SIZE { self.get_single(key).await + } else { + self.get_file(key).await } } }