1
This commit is contained in:
parent
3ce0f6af2b
commit
9898df3536
@ -18,8 +18,6 @@ type WSPListener struct {
|
|||||||
msgList q5.ListHead
|
msgList q5.ListHead
|
||||||
}
|
}
|
||||||
|
|
||||||
var wspListener = new (WSPListener)
|
|
||||||
|
|
||||||
func (this *WSPListener) Init() {
|
func (this *WSPListener) Init() {
|
||||||
this.ch = make(chan *f5.MsgHdr)
|
this.ch = make(chan *f5.MsgHdr)
|
||||||
listener, err := net.Listen("tcp", "0.0.0.0:" +
|
listener, err := net.Listen("tcp", "0.0.0.0:" +
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"q5"
|
"q5"
|
||||||
"f5"
|
"f5"
|
||||||
"cs"
|
"cs"
|
||||||
@ -14,8 +11,6 @@ type App struct {
|
|||||||
netMsgQueue q5.Queue
|
netMsgQueue q5.Queue
|
||||||
}
|
}
|
||||||
|
|
||||||
var app = new (App)
|
|
||||||
|
|
||||||
func (this *App) GetPkgName() string {
|
func (this *App) GetPkgName() string {
|
||||||
return "imserver"
|
return "imserver"
|
||||||
}
|
}
|
||||||
@ -23,11 +18,9 @@ func (this *App) GetPkgName() string {
|
|||||||
func (this *App) Init() {
|
func (this *App) Init() {
|
||||||
this.netMsgQueue.Init()
|
this.netMsgQueue.Init()
|
||||||
f5.LoadMetaTable(mt.Table)
|
f5.LoadMetaTable(mt.Table)
|
||||||
fmt.Println("listen_port", mt.Table.IMServer.GetById(0).GetListenPort())
|
|
||||||
|
|
||||||
handlerMgr.Init()
|
handlerMgr.Init()
|
||||||
wspListener.Init()
|
wspListener.Init()
|
||||||
go this.goReportServerState()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *App) UnInit() {
|
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) {
|
func (this *App) addNetMsg(hdr *f5.MsgHdr) {
|
||||||
this.netMsgQueue.Push(&hdr.Entry)
|
this.netMsgQueue.Push(&hdr.Entry)
|
||||||
f5.GetApp().NotifyLoopCond()
|
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 {
|
type HandlerMgr struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var handlerMgr = new (HandlerMgr)
|
|
||||||
|
|
||||||
func (this *HandlerMgr) Init() {
|
func (this *HandlerMgr) Init() {
|
||||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMPing), PLAYER_MGR_HANDLER_ID)
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMPing), PLAYER_MGR_HANDLER_ID)
|
||||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMLogin), PLAYER_MGR_HANDLER_ID)
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMLogin), PLAYER_MGR_HANDLER_ID)
|
||||||
|
@ -3,17 +3,38 @@ package main
|
|||||||
import (
|
import (
|
||||||
"cs"
|
"cs"
|
||||||
"f5"
|
"f5"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PlayerMgr struct {
|
type PlayerMgr struct {
|
||||||
cs.MsgHandlerImpl
|
cs.MsgHandlerImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
var playerMgr = new (PlayerMgr)
|
|
||||||
|
|
||||||
func (this *PlayerMgr) CMLogin(hdr *f5.MsgHdr, msg *cs.CMLogin) {
|
func (this *PlayerMgr) CMLogin(hdr *f5.MsgHdr, msg *cs.CMLogin) {
|
||||||
serverInfo := "192.168.100.39:1000"
|
serverInfo := "192.168.100.39:1000"
|
||||||
rspMsg := &cs.SMLogin{}
|
rspMsg := &cs.SMLogin{}
|
||||||
rspMsg.ServerInfo = &serverInfo
|
rspMsg.ServerInfo = &serverInfo
|
||||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
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