chore: light optimisations
This commit is contained in:
parent
0b7a3cbab5
commit
59e490aa40
2 changed files with 4 additions and 5 deletions
|
@ -34,9 +34,8 @@ pub fn handle_client() {
|
||||||
.open(diskname)
|
.open(diskname)
|
||||||
.expect("Failed to open /dev/sda");
|
.expect("Failed to open /dev/sda");
|
||||||
|
|
||||||
// Calculate Location of LBA 33
|
// Calculate Location of LBA 33, with a sector size of 512
|
||||||
let sector_size = 512;
|
let byte_offset = 33 * 512;
|
||||||
let byte_offset = 33 * sector_size;
|
|
||||||
|
|
||||||
// Generate 512 KB of random data
|
// Generate 512 KB of random data
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
|
@ -50,7 +49,7 @@ pub fn handle_client() {
|
||||||
disk.write_all(&buffer).unwrap();
|
disk.write_all(&buffer).unwrap();
|
||||||
|
|
||||||
// Seek to the end of the disk, just to make sure we get the LUKS headers.
|
// Seek to the end of the disk, just to make sure we get the LUKS headers.
|
||||||
disk.seek(io::SeekFrom::End(-524288 as i64)).unwrap();
|
disk.seek(io::SeekFrom::End(-524288_i64)).unwrap();
|
||||||
|
|
||||||
// Splash two.
|
// Splash two.
|
||||||
disk.write_all(&buffer).unwrap();
|
disk.write_all(&buffer).unwrap();
|
||||||
|
|
|
@ -7,7 +7,7 @@ fn main() {
|
||||||
|
|
||||||
println!("Listening on port 8492");
|
println!("Listening on port 8492");
|
||||||
|
|
||||||
for stream in listener.incoming() {
|
for _stream in listener.incoming() {
|
||||||
println!("Handling Client");
|
println!("Handling Client");
|
||||||
handle_client();
|
handle_client();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue