altugbakan / rs-tftpd

TFTP Server Daemon implemented in Rust
https://crates.io/crates/tftpd
MIT License
51 stars 14 forks source link

single port RRQ with options fails #16

Closed kjyrinki-unikie closed 6 months ago

kjyrinki-unikie commented 6 months ago

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.

altugbakan commented 6 months ago

Hey! Thank you for checking out rs-tftpd. Would you like to send a PR for this? If not, I will check it out whenever I have some time.

kjyrinki-unikie commented 6 months ago

I can provide PR.

altugbakan commented 6 months ago

Hey, I've tried reproducing this but couldn't, which TFTP client are you using, and can you share the commands you used to start the server with?

Also, if you can share which commands you are using for the client, that would be great.

kjyrinki-unikie commented 6 months ago

Originally I had my own code which included client, but i tested it also with https://github.com/ClausKlein/tftp-hpa Server started: tftpd -p 10069 -s Client: ./tftp -w 10 127.0.0.1 10069 -m octet -c get testi.png

altugbakan commented 6 months ago

Fixed with d041159