From dfa38338c9db8fde80cc964593d5c5c1b935d473 Mon Sep 17 00:00:00 2001 From: JungJun Date: Wed, 17 Aug 2022 11:53:39 +0900 Subject: [PATCH] =?UTF-8?q?=ED=86=B5=ED=95=A9=ED=86=B5=EA=B3=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- icsstat/icsstat.go | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/icsstat/icsstat.go b/icsstat/icsstat.go index 5de3a52..134691e 100644 --- a/icsstat/icsstat.go +++ b/icsstat/icsstat.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "math/rand" + "strings" "sync" "time" @@ -168,8 +169,10 @@ func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) { l := icslog.GetIcsLog() statInfos := new(StatInfos) - s := GetIcsSid() - randNum := fmt.Sprintf("%04d", rand.Intn(9999)) + // s := GetIcsSid() + rand.Seed(time.Now().UnixNano()) + randNum := fmt.Sprintf("%07d", rand.Intn(1000000)) + // randNum := fmt.Sprintf("%07d", rand.Intn(9999999)) // defer func() { // if err := recover(); err != nil { @@ -199,7 +202,13 @@ func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) { statInfos.ChangeByteToString(statReads) svc := statInfos.SvcType[0:1] - seqId := s.Seq + svc + randNum + now := fmt.Sprintf("%s", time.Now()) + b := now[:23] + c := strings.ReplaceAll(b, "-", "") + d := strings.ReplaceAll(c, ".", "") + e := strings.ReplaceAll(d, " ", "") + nowS := strings.ReplaceAll(e, ":", "") + seqId := nowS + svc + randNum ghost.M.Lock() hostName := ghost.HostName ghost.M.Unlock() @@ -273,8 +282,10 @@ func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) { l := icslog.GetIcsLog() statInfos := new(StatInfos) - s := GetIcsSid() - randNum := fmt.Sprintf("%04d", rand.Intn(9999)) + // s := GetIcsSid() + rand.Seed(time.Now().UnixNano()) + randNum := fmt.Sprintf("%07d", rand.Intn(1000000)) + // randNum := fmt.Sprintf("%04d", rand.Intn(9999)) defer t.Close() @@ -288,7 +299,13 @@ func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) { statInfos.ChangeByteToString(statReads) svc := statInfos.SvcType[0:1] - seqId := s.Seq + svc + randNum + now := fmt.Sprintf("%s", time.Now()) + b := now[:23] + c := strings.ReplaceAll(b, "-", "") + d := strings.ReplaceAll(c, ".", "") + e := strings.ReplaceAll(d, " ", "") + nowS := strings.ReplaceAll(e, ":", "") + seqId := nowS + svc + randNum ghost.M.Lock() hostName := ghost.HostName ghost.M.Unlock()