hostname 수정

main
JungJun 2 years ago
parent 2f3ff220f8
commit 6546653bff

@ -18,6 +18,11 @@ type SeqVal struct {
M *sync.Mutex M *sync.Mutex
} }
type Host struct {
HostName string
M *sync.Mutex
}
type StatInfos struct { type StatInfos struct {
//necessary value //necessary value
SeqId string // 25 SeqId string // 25
@ -54,6 +59,7 @@ type StatInfos struct {
} }
var gSeqVal *SeqVal var gSeqVal *SeqVal
var ghost *Host
const ( const (
//necessary value //necessary value
@ -138,6 +144,7 @@ func ListenStatMNG1() (icserr *icserror.IcsError) {
} }
func NewSidVal() { func NewSidVal() {
conf := icsconf.GetIcsConfig()
timeN := time.Now() timeN := time.Now()
nano := fmt.Sprintf("%d", timeN.UTC().Nanosecond()) nano := fmt.Sprintf("%d", timeN.UTC().Nanosecond())
seq := fmt.Sprintf("%02d%02d%02d%03s", timeN.Hour(), timeN.Minute(), timeN.Second(), nano[:3]) seq := fmt.Sprintf("%02d%02d%02d%03s", timeN.Hour(), timeN.Minute(), timeN.Second(), nano[:3])
@ -145,6 +152,11 @@ func NewSidVal() {
Seq: seq, Seq: seq,
} }
gSeqVal.M = &sync.Mutex{} gSeqVal.M = &sync.Mutex{}
ghost = &Host{
HostName: conf.InfoConfig.HostName,
}
ghost.M = &sync.Mutex{}
} }
func GetIcsSid() *SeqVal { func GetIcsSid() *SeqVal {
@ -153,7 +165,6 @@ func GetIcsSid() *SeqVal {
func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) { func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
l := icslog.GetIcsLog() l := icslog.GetIcsLog()
conf := icsconf.GetIcsConfig()
statInfos := new(StatInfos) statInfos := new(StatInfos)
s := GetIcsSid() s := GetIcsSid()
@ -188,7 +199,9 @@ func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
svc := statInfos.SvcType[0:1] svc := statInfos.SvcType[0:1]
seqId := s.Seq + svc + randNum seqId := s.Seq + svc + randNum
hostName := conf.InfoConfig.HostName ghost.M.Lock()
hostName := ghost.HostName
ghost.M.Unlock()
insLog := "" insLog := ""
insLog += fmt.Sprintf("SEQ_ID=%s|", seqId) insLog += fmt.Sprintf("SEQ_ID=%s|", seqId)
@ -257,7 +270,6 @@ func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) { func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) {
l := icslog.GetIcsLog() l := icslog.GetIcsLog()
conf := icsconf.GetIcsConfig()
statInfos := new(StatInfos) statInfos := new(StatInfos)
s := GetIcsSid() s := GetIcsSid()
@ -276,7 +288,9 @@ func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) {
svc := statInfos.SvcType[0:1] svc := statInfos.SvcType[0:1]
seqId := s.Seq + svc + randNum seqId := s.Seq + svc + randNum
hostName := conf.InfoConfig.HostName ghost.M.Lock()
hostName := ghost.HostName
ghost.M.Unlock()
insLog := "" insLog := ""
insLog += fmt.Sprintf("SEQ_ID=%s|", seqId) insLog += fmt.Sprintf("SEQ_ID=%s|", seqId)

Loading…
Cancel
Save