mirror of
https://github.com/go-ping/ping.git
synced 2026-02-21 07:32:26 +00:00
add pinger reset to re-use instance
This commit is contained in:
10
ping.go
10
ping.go
@@ -518,6 +518,16 @@ func (p *Pinger) Stop() {
|
||||
}
|
||||
}
|
||||
|
||||
// Reset sets the RTTs and the sent and received counts
|
||||
// back to zero so that Run can be re-used on the same
|
||||
// instance.
|
||||
func (p *Pinger) Reset() {
|
||||
p.done = make(chan bool)
|
||||
p.rtts = make([]time.Duration, 0)
|
||||
p.PacketsSent = 0
|
||||
p.PacketsRecv = 0
|
||||
}
|
||||
|
||||
func (p *Pinger) finish() {
|
||||
handler := p.OnFinish
|
||||
if handler != nil {
|
||||
|
||||
Reference in New Issue
Block a user