Developing lightweight computation at the DSG edge

Unverified Commit ef3ab45e authored by Cameron Sparr's avatar Cameron Sparr
Browse files

Don't oversend packets

fixes part of #6
parent 3a0b5a7d
......@@ -310,6 +310,9 @@ func (p *Pinger) run() {
wg.Wait()
return
case <-interval.C:
if p.Count > 0 && p.PacketsSent >= p.Count {
continue
}
err = p.sendICMP(conn)
if err != nil {
fmt.Println("FATAL: ", err.Error())
......@@ -514,7 +517,7 @@ func (p *Pinger) sendICMP(conn *icmp.PacketConn) error {
data, err := json.Marshal(IcmpData{Bytes: t, Tracker: p.Tracker})
if err != nil {
fmt.Errorf("Unable to marshal data")
return fmt.Errorf("Unable to marshal data %s", err)
}
body := &icmp.Echo{
ID: p.id,
......
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