prep samples simplification
This commit is contained in:
parent
e1028b8523
commit
5733789514
@ -1,19 +1,4 @@
|
|||||||
#include <iostream>
|
#include...
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#include <linux/if.h>
|
|
||||||
#include <linux/if_tun.h>
|
|
||||||
#include <zconf.h>
|
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <thread>
|
|
||||||
#include <csignal>
|
|
||||||
#include <queue>
|
|
||||||
#include <mutex>
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
struct Packet {
|
struct Packet {
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -8,8 +8,6 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
var PacketOverhead = 0
|
|
||||||
|
|
||||||
type Packet struct {
|
type Packet struct {
|
||||||
Data []byte
|
Data []byte
|
||||||
}
|
}
|
||||||
@ -23,7 +21,7 @@ func main() {
|
|||||||
inboundPackets := make(chan Packet, 128)
|
inboundPackets := make(chan Packet, 128)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
bufferSize := 1500 - PacketOverhead
|
bufferSize := 1500
|
||||||
buffer := make([]byte, bufferSize)
|
buffer := make([]byte, bufferSize)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@ -53,9 +51,4 @@ func main() {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
signals := make(chan os.Signal)
|
|
||||||
signal.Notify(signals, syscall.SIGTERM, syscall.SIGINT)
|
|
||||||
|
|
||||||
<-signals
|
|
||||||
}
|
}
|
||||||
|
4
import-code.sh
Normal file → Executable file
4
import-code.sh
Normal file → Executable file
@ -6,7 +6,9 @@ rm /home/jake/repos/dissertation/4-dissertation/Preparation/Samples/* || true
|
|||||||
rm /home/jake/repos/dissertation/4-dissertation/Implementation/Samples/* || true
|
rm /home/jake/repos/dissertation/4-dissertation/Implementation/Samples/* || true
|
||||||
|
|
||||||
# Copy code samples for preparation
|
# Copy code samples for preparation
|
||||||
cp /home/jake/repos/dissertation/1-language-tests/cpp/main.cpp /home/jake/repos/dissertation/4-dissertation/Preparation/Samples/
|
printf "#include...\\n" > /home/jake/repos/dissertation/4-dissertation/Preparation/Samples/main.cpp
|
||||||
|
tail -n +17 /home/jake/repos/dissertation/1-language-tests/cpp/main.cpp >> /home/jake/repos/dissertation/4-dissertation/Preparation/Samples/main.cpp
|
||||||
|
|
||||||
cp /home/jake/repos/dissertation/1-language-tests/go/main.go /home/jake/repos/dissertation/4-dissertation/Preparation/Samples/
|
cp /home/jake/repos/dissertation/1-language-tests/go/main.go /home/jake/repos/dissertation/4-dissertation/Preparation/Samples/
|
||||||
cp /home/jake/repos/dissertation/1-language-tests/rust/src/main.rs /home/jake/repos/dissertation/4-dissertation/Preparation/Samples/
|
cp /home/jake/repos/dissertation/1-language-tests/rust/src/main.rs /home/jake/repos/dissertation/4-dissertation/Preparation/Samples/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user