Skip to content

Commit

Permalink
remove need for nightly toolchain
Browse files Browse the repository at this point in the history
Nightly toolchain was previously required since the non-stabilized
feature "let-chains" was used. Although the corresponding code is now a
bit uglier, we do not need Nightly toolchain anymore.

Signed-off-by: Jonas Jelonek <[email protected]>
  • Loading branch information
jonasjelonek committed Jun 7, 2024
1 parent f34ab15 commit dfc83e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ Of course, this all is limited by my current knowledge of Rust. This project is

If you think there is room for improvement, please open an issue or a pull request.

## Disclaimer

**This currently needs Rust nightly compiler since I implemented some things with the help of currently non-stabilized features.**

## Supported TFTP features

- [x] Server mode
Expand All @@ -30,7 +26,7 @@ If you think there is room for improvement, please open an issue or a pull reque
- [x] Transfer size
- [ ] Window size

It supports parallel operation with a arbitrary number of peers.
It supports parallel operation with an arbitrary number of peers.

## Supported RFCs
- [x] RFC 1350 - TFTP protocol
Expand All @@ -39,7 +35,3 @@ It supports parallel operation with a arbitrary number of peers.
- [x] RFC 2349 - TFTP timeout and transfer size options
- [ ] RFC 7440 - TFTP windowsize option

## Big TODOs

- remove need for nightly toolchain
- improve general output, especially for debugging
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(let_chains)]

pub mod cli;
pub mod tftp;
Expand Down
8 changes: 5 additions & 3 deletions src/tftp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,11 @@ impl TftpConnection {

pub fn receive_packet<'a>(&self, buf: &'a mut [u8]) -> Result<packet::TftpPacket<'a>> {
let recv = self.receive_packet_from(buf)?;
if let Ok(peer) = self.socket.peer_addr() && peer != recv.1 { /* IP and port must be the same for whole connection */
self.send_error(ErrorCode::UnknownTid, "").ok();
return Err(ConnectionError::UnknownTid);
if let Ok(peer) = self.socket.peer_addr() {
if peer != recv.1 { /* IP and port must be the same for whole connection */
self.send_error(ErrorCode::UnknownTid, "").ok();
return Err(ConnectionError::UnknownTid);
}
}

Ok(recv.0)
Expand Down

0 comments on commit dfc83e3

Please sign in to comment.