connection err

main
JungJun 3 years ago
parent a13ce6d465
commit 18e4949ac2

@ -13,8 +13,8 @@ import (
"gitlab.com/ics_cinnamon/voiceStatistics/icsnet"
)
type SidVal struct {
Sid string
type SeqVal struct {
Seq string
M *sync.Mutex
}
@ -53,7 +53,7 @@ type StatInfos struct {
TtsText string // 1024
}
var gSidVal *SidVal
var gSeqVal *SeqVal
const (
//necessary value
@ -138,15 +138,15 @@ func ListenStatMNG1() (icserr *icserror.IcsError) {
func NewSidVal() {
timeN := time.Now()
nano := fmt.Sprintf("%d", timeN.UTC().Nanosecond())
sid := fmt.Sprintf("%02d%02d%02d%03s", timeN.Hour(), timeN.Minute(), timeN.Second(), nano[:3])
gSidVal = &SidVal{
Sid: sid,
seq := fmt.Sprintf("%02d%02d%02d%03s", timeN.Hour(), timeN.Minute(), timeN.Second(), nano[:3])
gSeqVal = &SeqVal{
Seq: seq,
}
gSidVal.M = &sync.Mutex{}
gSeqVal.M = &sync.Mutex{}
}
func GetIcsSid() *SidVal {
return gSidVal
func GetIcsSid() *SeqVal {
return gSeqVal
}
func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
@ -156,16 +156,18 @@ func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
s := GetIcsSid()
randNum := fmt.Sprintf("%d4", rand.Intn(9999))
defer func() {
if err := recover(); err != nil {
l.Printf(icslog.LOG_LEVEL_WARN, -1, "%s\n",
icserror.ICSERRNETNotConnectError.GetMessage())
if t != nil {
t.Close()
}
return
}
}()
// defer func() {
// if err := recover(); err != nil {
// l.Printf(icslog.LOG_LEVEL_WARN, -1, "%s\n",
// icserror.ICSERRNETNotConnectError.GetMessage())
// if t != nil {
// t.Close()
// }
// return
// }
// }()
defer t.Close()
l.Printf(icslog.LOG_LEVEL_INFO, -1, "Connected from - %s", t.RemoteAddr())
@ -179,7 +181,7 @@ func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
}
} else {
svc := statInfos.SvcType[0:1]
seqId := s.Sid + svc + randNum
seqId := s.Seq + svc + randNum
fmt.Printf("Recved Stat Command(%s) %d \n", statReads, rlen)
statInfos.ChangeByteToString(statReads)
@ -256,16 +258,18 @@ func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) {
s := GetIcsSid()
randNum := fmt.Sprintf("%d4", rand.Intn(9999))
defer func() {
if err := recover(); err != nil {
l.Printf(icslog.LOG_LEVEL_WARN, -1, "%s\n",
icserror.ICSERRNETNotConnectError.GetMessage())
if t != nil {
t.Close()
}
return
}
}()
// defer func() {
// if err := recover(); err != nil {
// l.Printf(icslog.LOG_LEVEL_WARN, -1, "%s\n",
// icserror.ICSERRNETNotConnectError.GetMessage())
// if t != nil {
// t.Close()
// }
// return
// }
// }()
defer t.Close()
l.Printf(icslog.LOG_LEVEL_INFO, -1, "Connected from - %s", t.RemoteAddr())
@ -279,7 +283,7 @@ func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) {
}
} else {
svc := statInfos.SvcType[0:1]
seqId := s.Sid + svc + randNum
seqId := s.Seq + svc + randNum
fmt.Printf("Recved Stat Command(%s) %d \n", statReads, rlen)
statInfos.ChangeByteToString(statReads)

Loading…
Cancel
Save