1
This commit is contained in:
parent
3ce0f6af2b
commit
9898df3536
@ -18,8 +18,6 @@ type WSPListener struct {
|
||||
msgList q5.ListHead
|
||||
}
|
||||
|
||||
var wspListener = new (WSPListener)
|
||||
|
||||
func (this *WSPListener) Init() {
|
||||
this.ch = make(chan *f5.MsgHdr)
|
||||
listener, err := net.Listen("tcp", "0.0.0.0:" +
|
||||
|
@ -1,9 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
"fmt"
|
||||
|
||||
"q5"
|
||||
"f5"
|
||||
"cs"
|
||||
@ -14,8 +11,6 @@ type App struct {
|
||||
netMsgQueue q5.Queue
|
||||
}
|
||||
|
||||
var app = new (App)
|
||||
|
||||
func (this *App) GetPkgName() string {
|
||||
return "imserver"
|
||||
}
|
||||
@ -23,11 +18,9 @@ func (this *App) GetPkgName() string {
|
||||
func (this *App) Init() {
|
||||
this.netMsgQueue.Init()
|
||||
f5.LoadMetaTable(mt.Table)
|
||||
fmt.Println("listen_port", mt.Table.IMServer.GetById(0).GetListenPort())
|
||||
|
||||
handlerMgr.Init()
|
||||
wspListener.Init()
|
||||
go this.goReportServerState()
|
||||
}
|
||||
|
||||
func (this *App) UnInit() {
|
||||
@ -50,28 +43,6 @@ func (this *App) Update() {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *App) goReportServerState() {
|
||||
for {
|
||||
/*
|
||||
params := q5.NewMxoObject()
|
||||
params.SetXValue("node_id", q5.NewXInt32(1))
|
||||
params.SetXValue("instance_id", q5.NewXInt32(1))
|
||||
params.SetXValue("ip", q5.NewXString("192.168.100.39"))
|
||||
params.SetXValue("port", q5.NewXInt32(8888))
|
||||
params.SetXValue("online_num", q5.NewXInt32(1))
|
||||
params.SetXValue("room_num", q5.NewXInt32(1))
|
||||
params.SetXValue("channel", q5.NewXInt32(0))
|
||||
params.SetXValue("alive_count", q5.NewXInt32(1))
|
||||
params.SetXValue("servicing", q5.NewXInt32(1))
|
||||
_, err := q5.HttpGet(
|
||||
"http://192.168.100.45:7821/webapp/index.php?c=GS&a=report&",
|
||||
params.AsXObject())
|
||||
fmt.Println(err);
|
||||
*/
|
||||
time.Sleep(time.Duration(1) * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
func (this *App) addNetMsg(hdr *f5.MsgHdr) {
|
||||
this.netMsgQueue.Push(&hdr.Entry)
|
||||
f5.GetApp().NotifyLoopCond()
|
||||
|
6
server/imserver/export.go
Normal file
6
server/imserver/export.go
Normal file
@ -0,0 +1,6 @@
|
||||
package main
|
||||
|
||||
var app = new (App)
|
||||
var wspListener = new (WSPListener)
|
||||
var playerMgr = new (PlayerMgr)
|
||||
var handlerMgr = new (HandlerMgr)
|
@ -7,8 +7,6 @@ import (
|
||||
type HandlerMgr struct {
|
||||
}
|
||||
|
||||
var handlerMgr = new (HandlerMgr)
|
||||
|
||||
func (this *HandlerMgr) Init() {
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMPing), PLAYER_MGR_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMLogin), PLAYER_MGR_HANDLER_ID)
|
||||
|
@ -3,17 +3,38 @@ package main
|
||||
import (
|
||||
"cs"
|
||||
"f5"
|
||||
"time"
|
||||
)
|
||||
|
||||
type PlayerMgr struct {
|
||||
cs.MsgHandlerImpl
|
||||
}
|
||||
|
||||
var playerMgr = new (PlayerMgr)
|
||||
|
||||
func (this *PlayerMgr) CMLogin(hdr *f5.MsgHdr, msg *cs.CMLogin) {
|
||||
serverInfo := "192.168.100.39:1000"
|
||||
rspMsg := &cs.SMLogin{}
|
||||
rspMsg.ServerInfo = &serverInfo
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
||||
func (this *PlayerMgr) goReportServerState() {
|
||||
for {
|
||||
/*
|
||||
params := q5.NewMxoObject()
|
||||
params.SetXValue("node_id", q5.NewXInt32(1))
|
||||
params.SetXValue("instance_id", q5.NewXInt32(1))
|
||||
params.SetXValue("ip", q5.NewXString("192.168.100.39"))
|
||||
params.SetXValue("port", q5.NewXInt32(8888))
|
||||
params.SetXValue("online_num", q5.NewXInt32(1))
|
||||
params.SetXValue("room_num", q5.NewXInt32(1))
|
||||
params.SetXValue("channel", q5.NewXInt32(0))
|
||||
params.SetXValue("alive_count", q5.NewXInt32(1))
|
||||
params.SetXValue("servicing", q5.NewXInt32(1))
|
||||
_, err := q5.HttpGet(
|
||||
"http://192.168.100.45:7821/webapp/index.php?c=GS&a=report&",
|
||||
params.AsXObject())
|
||||
fmt.Println(err);
|
||||
*/
|
||||
time.Sleep(time.Duration(1) * time.Second)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user