1
This commit is contained in:
parent
c0b745e42c
commit
1b28b28a3e
@ -130,7 +130,7 @@ func (this *WSPListener_) parseNetPkt() {
|
|||||||
hdr.Msg = cs.ParsePb(hdr.MsgId, hdr.Data)
|
hdr.Msg = cs.ParsePb(hdr.MsgId, hdr.Data)
|
||||||
if hdr.Msg != nil {
|
if hdr.Msg != nil {
|
||||||
hdr.Entry.Init(hdr)
|
hdr.Entry.Init(hdr)
|
||||||
App.addNetMsg(hdr)
|
app.addNetMsg(hdr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,16 @@ import (
|
|||||||
"mt"
|
"mt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type App_ struct {
|
type App struct {
|
||||||
f5.App_
|
f5.App_
|
||||||
msgMutex sync.Mutex
|
msgMutex sync.Mutex
|
||||||
msgList q5.ListHead
|
msgList q5.ListHead
|
||||||
workList q5.ListHead
|
workList q5.ListHead
|
||||||
}
|
}
|
||||||
|
|
||||||
var App = new (App_)
|
var app = new (App)
|
||||||
|
|
||||||
func (this *App_) Init() {
|
func (this *App) Init() {
|
||||||
f5.App = &this.App_
|
f5.App = &this.App_
|
||||||
f5.App.SetPkgName("imserver")
|
f5.App.SetPkgName("imserver")
|
||||||
this.App_.Init(this.Update)
|
this.App_.Init(this.Update)
|
||||||
@ -32,13 +32,13 @@ func (this *App_) Init() {
|
|||||||
go this.goReportServerState()
|
go this.goReportServerState()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *App_) UnInit() {
|
func (this *App) UnInit() {
|
||||||
HandlerMgr.UnInit()
|
HandlerMgr.UnInit()
|
||||||
WSPListener.UnInit()
|
WSPListener.UnInit()
|
||||||
this.App_.UnInit()
|
this.App_.UnInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *App_) Update() {
|
func (this *App) Update() {
|
||||||
if this.workList.Empty() {
|
if this.workList.Empty() {
|
||||||
this.msgMutex.Lock()
|
this.msgMutex.Lock()
|
||||||
defer this.msgMutex.Unlock()
|
defer this.msgMutex.Unlock()
|
||||||
@ -59,7 +59,7 @@ func (this *App_) Update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *App_) goReportServerState() {
|
func (this *App) goReportServerState() {
|
||||||
for {
|
for {
|
||||||
params := q5.NewMxoObject()
|
params := q5.NewMxoObject()
|
||||||
params.SetXValue("node_id", q5.NewXInt32(1))
|
params.SetXValue("node_id", q5.NewXInt32(1))
|
||||||
@ -80,7 +80,7 @@ func (this *App_) goReportServerState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (this *App_) addNetMsg(hdr *f5.MsgHdr) {
|
func (this *App) addNetMsg(hdr *f5.MsgHdr) {
|
||||||
{
|
{
|
||||||
this.msgMutex.Lock()
|
this.msgMutex.Lock()
|
||||||
defer this.msgMutex.Unlock()
|
defer this.msgMutex.Unlock()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
App.Init()
|
app.Init()
|
||||||
App.Run()
|
app.Run()
|
||||||
App.UnInit()
|
app.UnInit()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user