Git Product home page Git Product logo

rs-tftpd's People

Contributors

altugbakan avatar foorack avatar kjyrinki-unikie avatar lupyuen avatar shuyuimpossible avatar stappersg avatar vilheikk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rs-tftpd's Issues

Verify the size of data received based on tsize option

The tsize option can be used to verify the size of the received file after the transfer is complete. If the tsize does not match the number of octets received then the error packet can be sent as a response to the last data packet.

This is a second verification apart from ACK that the data received is complete.

I can contribute the changes if you think it is appropriate to include this.

New version rs-tftpd download become very slow

hi, Have you noticed that the download speed of the new version of tftp has become very slow?
I tested it, download 10M file, speet 30s
MicrosoftTeams-image (6)

The version is v0.2.8
Updating crates.io index
Downloaded tftpd v0.2.8
Downloaded 1 crate (15.2 KB) in 3.34s
Installing tftpd v0.2.8
Updating crates.io index
Compiling tftpd v0.2.8
Finished release [optimized] target(s) in 8.76s
Replacing /home/jinxsong/.cargo/bin/tftpd
Replaced package tftpd v0.2.6 with tftpd v0.2.8 (executable tftpd)

single port RRQ with options fails

This issue is visible with single socket case when you send READ request with option(s).
accept_request & check_response:
After sending OACK server starts to wait ACK as response from client, but in single socket case recv_with_size() waits data from mpsc channel. I guess a problem is that listen() which is maybe supposed to receive ACK and send data to channel don't get run. I.e. we don't have worker yet (or thread) to handle ACK response for OACK. So basically in impl Socket for ServerSocket function fn recv_with_size(&self, _size: usize) -> Result<Packet, Box<dyn Error>> hangs on if let Ok(packet) = receiver.recv_timeout(self.timeout) until timeout occurs.

window::tests::fills_and_removes_from_window failure

When running the tests with cargo test (in Fedora 37), window::tests::fills_and_removes_from_window fails.

RUST_BACKTRACE=1 cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.00s
     Running unittests src/lib.rs (target/debug/deps/tftpd-bc4c52d8dbe9f884)

running 28 tests
test config::tests::parses_full_config ... ok
test config::tests::parses_some_config ... ok
test config::tests::returns_error_on_invalid_directory ... ok
test config::tests::returns_error_on_invalid_port ... ok
test config::tests::returns_error_on_invalid_ip ... ok
test convert::tests::converts_to_string ... ok
test convert::tests::converts_to_string_with_index ... ok
test convert::tests::converts_to_u16 ... ok
test convert::tests::returns_error_on_short_array ... ok
test packet::tests::parses_ack ... ok
test packet::tests::parses_data ... ok
test packet::tests::parses_error ... ok
test packet::tests::parses_error_without_message ... ok
test packet::tests::parses_read_request ... ok
test packet::tests::parses_read_request_with_options ... ok
test packet::tests::parses_write_request ... ok
test packet::tests::parses_write_request_with_options ... ok
test packet::tests::serializes_ack ... ok
test packet::tests::serializes_data ... ok
test packet::tests::serializes_error ... ok
test packet::tests::serializes_oack ... ok
test server::tests::parses_default_options ... ok
test server::tests::parses_read_options ... ok
test server::tests::parses_write_options ... ok
test server::tests::validates_file_path ... ok
test socket::tests::test_recv ... ok
test window::tests::adds_to_and_empties_window ... ok
test window::tests::fills_and_removes_from_window ... FAILED

failures:

---- window::tests::fills_and_removes_from_window stdout ----
thread 'window::tests::fills_and_removes_from_window' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 17, kind: AlreadyExists, message: "File exists" }', src/window.rs:194:38
stack backtrace:
   0: rust_begin_unwind
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/panicking.rs:65:14
   2: core::result::unwrap_failed
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/result.rs:1791:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/result.rs:1113:23
   4: tftpd::window::tests::initialize
             at ./src/window.rs:194:13
   5: tftpd::window::tests::fills_and_removes_from_window
             at ./src/window.rs:132:24
   6: tftpd::window::tests::fills_and_removes_from_window::{{closure}}
             at ./src/window.rs:129:5
   7: core::ops::function::FnOnce::call_once
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/ops/function.rs:251:5
   8: core::ops::function::FnOnce::call_once
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    window::tests::fills_and_removes_from_window

test result: FAILED. 27 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

error: test failed, to rerun pass `--lib`

I was able to fix this by ignoring the error

diff --git a/src/window.rs b/src/window.rs
index 7aad4f1..2a40ade 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -191,7 +191,8 @@ mod tests {
     fn initialize(file_name: &str) -> File {
         let file_name = DIR_NAME.to_string() + "/" + file_name;
         if !Path::new(DIR_NAME).is_dir() {
-            fs::create_dir(DIR_NAME).unwrap();
+            if fs::create_dir(DIR_NAME).is_err() {
+            }
         }
 
         if File::open(&file_name).is_ok() {

But I don't know if it's the correct fix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.