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()