Skip to content

Commit

Permalink
QuickWit-Export branch merging
Browse files Browse the repository at this point in the history
  • Loading branch information
dabevlohn committed Sep 18, 2024
1 parent 7bb55f9 commit 5d4402e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
5 changes: 0 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ use modules::filereceiver::FileReceiver;
use modules::streamsender::StreamSender;
use modules::trackeractor::{TrackerActor, TrackerMessage};

//const PING: &[u8; 6] = b"zPING\0";
//const VERSION: &[u8; 9] = b"zVERSION\0";
const INSTREAM: &[u8; 10] = b"zINSTREAM\0";
const END_OF_STREAM: &[u8; 4] = &[0, 0, 0, 0];

async fn start() {
let args = Cli::parse();

Expand Down
13 changes: 2 additions & 11 deletions src/modules/filereceiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use tokio::io::{AsyncWriteExt, ErrorKind};
use tokio::net::TcpListener;
use tokio::sync::mpsc;

use crate::trackeractor::{GetTrackerActor, Status, TrackerMessage};

use super::END_OF_STREAM;
use super::trackeractor::{GetTrackerActor, Status, TrackerMessage};

pub struct FileReceiver {
pub socket: TcpListener,
Expand Down Expand Up @@ -64,7 +62,7 @@ impl FileReceiver {
}

if command.as_str() == "zINSTREAM" {
let last4 = cur_buffer.as_slice()[cur_buffer.len() - 4..].to_vec();
//let last4 = cur_buffer.as_slice()[cur_buffer.len() - 4..].to_vec();
cur_buffer.truncate(nr);
match file.write_all(&cur_buffer).await {
Ok(()) => {
Expand All @@ -73,13 +71,6 @@ impl FileReceiver {
}
Err(e) => println!("Error saving file: {}", e),
}

if last4 == END_OF_STREAM {
continue;
// !!! No breaks needed !!!
//println!("0000 EOF received");
//break;
}
}
}
Err(ref e)
Expand Down
5 changes: 4 additions & 1 deletion src/modules/streamsender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use std::str;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;

use super::{END_OF_STREAM, INSTREAM};
//const PING: &[u8; 6] = b"zPING\0";
//const VERSION: &[u8; 9] = b"zVERSION\0";
const INSTREAM: &[u8; 10] = b"zINSTREAM\0";
const END_OF_STREAM: &[u8; 4] = &[0, 0, 0, 0];

pub struct StreamSender {
pub stream: TcpStream,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/trackeractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::fs;
use tokio::sync::{mpsc, oneshot};

use crate::indexingestor::{DocIngestor, Document};
use super::indexingestor::{DocIngestor, Document};

#[derive(Debug, Clone)]
pub enum Status {
Expand Down

0 comments on commit 5d4402e

Please sign in to comment.