Developing lightweight computation at the DSG edge

Commit 5740bb1f authored by keeZey's avatar keeZey Committed by Cameron Sparr
Browse files

Change size to Size to make it exportable (#18)

I have made Size exportable as i require the ability to change the
packetsize on a per host basis
parent 68a45b48
...@@ -93,7 +93,7 @@ func NewPinger(addr string) (*Pinger, error) { ...@@ -93,7 +93,7 @@ func NewPinger(addr string) (*Pinger, error) {
network: "udp", network: "udp",
ipv4: ipv4, ipv4: ipv4,
size: timeSliceLength, Size: timeSliceLength,
done: make(chan bool), done: make(chan bool),
}, nil }, nil
...@@ -131,15 +131,18 @@ type Pinger struct { ...@@ -131,15 +131,18 @@ type Pinger struct {
// OnFinish is called when Pinger exits // OnFinish is called when Pinger exits
OnFinish func(*Statistics) OnFinish func(*Statistics)
// Size of packet being sent
Size int
// stop chan bool // stop chan bool
done chan bool done chan bool
ipaddr *net.IPAddr ipaddr *net.IPAddr
addr string addr string
ipv4 bool ipv4 bool
source string source string
size int
sequence int sequence int
network string network string
} }
...@@ -466,8 +469,8 @@ func (p *Pinger) sendICMP(conn *icmp.PacketConn) error { ...@@ -466,8 +469,8 @@ func (p *Pinger) sendICMP(conn *icmp.PacketConn) error {
} }
t := timeToBytes(time.Now()) t := timeToBytes(time.Now())
if p.size-timeSliceLength != 0 { if p.Size-timeSliceLength != 0 {
t = append(t, byteSliceOfSize(p.size-timeSliceLength)...) t = append(t, byteSliceOfSize(p.Size-timeSliceLength)...)
} }
bytes, err := (&icmp.Message{ bytes, err := (&icmp.Message{
Type: typ, Code: 0, Type: typ, Code: 0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment