1
This commit is contained in:
parent
9315d393ce
commit
3ce0f6af2b
@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
|
||||||
|
|
||||||
"q5"
|
"q5"
|
||||||
"f5"
|
"f5"
|
||||||
@ -12,19 +11,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type App struct {
|
type App struct {
|
||||||
msgMutex sync.Mutex
|
netMsgQueue q5.Queue
|
||||||
msgList q5.ListHead
|
|
||||||
workList q5.ListHead
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var app = new (App)
|
var app = new (App)
|
||||||
|
|
||||||
|
func (this *App) GetPkgName() string {
|
||||||
|
return "imserver"
|
||||||
|
}
|
||||||
|
|
||||||
func (this *App) Init() {
|
func (this *App) Init() {
|
||||||
//f5.App = &this.F5App
|
this.netMsgQueue.Init()
|
||||||
//f5.App.SetPkgName("imserver")
|
|
||||||
//this.F5App.Init(this.Update)
|
|
||||||
this.msgList.Init(nil)
|
|
||||||
this.workList.Init(nil)
|
|
||||||
f5.LoadMetaTable(mt.Table)
|
f5.LoadMetaTable(mt.Table)
|
||||||
fmt.Println("listen_port", mt.Table.IMServer.GetById(0).GetListenPort())
|
fmt.Println("listen_port", mt.Table.IMServer.GetById(0).GetListenPort())
|
||||||
|
|
||||||
@ -36,19 +33,12 @@ func (this *App) Init() {
|
|||||||
func (this *App) UnInit() {
|
func (this *App) UnInit() {
|
||||||
handlerMgr.UnInit()
|
handlerMgr.UnInit()
|
||||||
wspListener.UnInit()
|
wspListener.UnInit()
|
||||||
//this.F5App.UnInit()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *App) Update() {
|
func (this *App) Update() {
|
||||||
if this.workList.Empty() {
|
this.netMsgQueue.Fetch()
|
||||||
this.msgMutex.Lock()
|
for !this.netMsgQueue.WorkList.Empty() {
|
||||||
defer this.msgMutex.Unlock()
|
next := this.netMsgQueue.WorkList.Next()
|
||||||
if !this.msgList.Empty() {
|
|
||||||
this.msgList.ReplaceInit(&this.workList)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for !this.workList.Empty() {
|
|
||||||
next := this.workList.Next()
|
|
||||||
hdr, ok := next.GetData().(*f5.MsgHdr)
|
hdr, ok := next.GetData().(*f5.MsgHdr)
|
||||||
if ok {
|
if ok {
|
||||||
handler := cs.GetNetMsgHandler(hdr.MsgId)
|
handler := cs.GetNetMsgHandler(hdr.MsgId)
|
||||||
@ -83,14 +73,6 @@ func (this *App) goReportServerState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *App) addNetMsg(hdr *f5.MsgHdr) {
|
func (this *App) addNetMsg(hdr *f5.MsgHdr) {
|
||||||
{
|
this.netMsgQueue.Push(&hdr.Entry)
|
||||||
this.msgMutex.Lock()
|
f5.GetApp().NotifyLoopCond()
|
||||||
defer this.msgMutex.Unlock()
|
|
||||||
this.msgList.AddTail(&hdr.Entry);
|
|
||||||
}
|
|
||||||
//this.NotifyLoopCond()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *App) GetPkgName() string {
|
|
||||||
return "imserver"
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ type table struct {
|
|||||||
|
|
||||||
var Table = f5.New(func (this* table) {
|
var Table = f5.New(func (this* table) {
|
||||||
this.IMServer = f5.New(func (this *IMServerTable) {
|
this.IMServer = f5.New(func (this *IMServerTable) {
|
||||||
this.FileName = "imserver.cluster.json"
|
this.FileName = "../config/imserver.cluster.json"
|
||||||
this.PrimKey = ""
|
this.PrimKey = ""
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
2
third_party/q5
vendored
2
third_party/q5
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 7bffd9a638a1888f22f68a8b191bc9e4b54e3e99
|
Subproject commit aecf26a45c74547bb724f59653331dcc34f16974
|
Loading…
x
Reference in New Issue
Block a user