This commit is contained in:
crusader 2018-09-22 11:37:10 +09:00
parent b126c5502d
commit d615ab9524

View File

@ -2,6 +2,7 @@ package service
import ( import (
"crypto/tls" "crypto/tls"
"log"
"net" "net"
"strings" "strings"
"time" "time"
@ -47,6 +48,7 @@ func processPing(service *omd.Service, pingOption ounp.Option, _pingFunc pingFun
for indexR := 0; indexR < pingOption.GetCount(); indexR++ { for indexR := 0; indexR < pingOption.GetCount(); indexR++ {
summary.SendCount = summary.SendCount + 1 summary.SendCount = summary.SendCount + 1
startTime := time.Now() startTime := time.Now()
log.Print("startTime ", startTime)
_res = &ounp.PingResponse{} _res = &ounp.PingResponse{}
if 0 < indexR { if 0 < indexR {
select { select {
@ -55,14 +57,14 @@ func processPing(service *omd.Service, pingOption ounp.Option, _pingFunc pingFun
} }
ttl, err := _pingFunc(service, pingOption) ttl, err := _pingFunc(service, pingOption)
elapsedTime := time.Since(startTime).Seconds() * 1E3 elapsedTime := float64(time.Since(startTime).Nanoseconds()) / float64(1E6)
log.Print("elapsedTime ", time.Since(startTime).Nanoseconds())
if 0 == indexR { if 0 == indexR {
summary.MinTime = elapsedTime summary.MinTime = elapsedTime
summary.MaxTime = elapsedTime summary.MaxTime = elapsedTime
} }
if nil == err { if nil == err {
_sum = _sum + elapsedTime _sum = _sum + elapsedTime
summary.ReceiveCount = summary.ReceiveCount + 1 summary.ReceiveCount = summary.ReceiveCount + 1
if summary.MinTime > elapsedTime { if summary.MinTime > elapsedTime {