Developing lightweight computation at the DSG edge
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LightKone
go-ping
Commits
ef3ab45e
Unverified
Commit
ef3ab45e
authored
Nov 06, 2018
by
Cameron Sparr
Browse files
Don't oversend packets
fixes part of #6
parent
3a0b5a7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
ping.go
View file @
ef3ab45e
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment