1
This commit is contained in:
parent
35740b3891
commit
6405a233fd
@ -6,7 +6,7 @@ import (
|
||||
"mt"
|
||||
"cs"
|
||||
"ss"
|
||||
. "main/common"
|
||||
"main/constant"
|
||||
. "main/global"
|
||||
)
|
||||
|
||||
@ -46,7 +46,7 @@ func (this *app) Update() {
|
||||
handler := ss.GetNetMsgHandler(hdr.MsgId)
|
||||
if handler != nil {
|
||||
switch handler.HandlerId {
|
||||
case WSP_LISTENER_HANDLER_ID:
|
||||
case constant.WSP_LISTENER_HANDLER_ID:
|
||||
GetWspListener().ProcessSSMMsg(handler, hdr)
|
||||
}
|
||||
}
|
||||
@ -54,8 +54,8 @@ func (this *app) Update() {
|
||||
handler := cs.GetNetMsgHandler(hdr.MsgId)
|
||||
if handler != nil {
|
||||
switch handler.HandlerId {
|
||||
case PLAYER_MGR_HANDLER_ID:
|
||||
case PLAYER_HANDLER_ID:
|
||||
case constant.PLAYER_MGR_HANDLER_ID:
|
||||
case constant.PLAYER_HANDLER_ID:
|
||||
GetPlayerMgr().ProcessCMMsg(handler, hdr)
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ func (this *app) addNetMsg(hdr *f5.MsgHdr) {
|
||||
|
||||
func (this *app) registerDataSources() {
|
||||
f5.GetJsStyleDb().RegisterDataSource(
|
||||
GAME_DB,
|
||||
constant.GAME_DB,
|
||||
mt.Table.GameDb.GetById(0).GetHost(),
|
||||
mt.Table.GameDb.GetById(0).GetPort(),
|
||||
mt.Table.GameDb.GetById(0).GetUser(),
|
||||
@ -80,7 +80,7 @@ func (this *app) registerDataSources() {
|
||||
mt.Table.GameDb.GetById(0).GetDatabase(),
|
||||
30)
|
||||
f5.GetJsStyleDb().RegisterDataSource(
|
||||
FRIEND_DB,
|
||||
constant.FRIEND_DB,
|
||||
mt.Table.FriendDb.GetById(0).GetHost(),
|
||||
mt.Table.FriendDb.GetById(0).GetPort(),
|
||||
mt.Table.FriendDb.GetById(0).GetUser(),
|
||||
|
@ -1,4 +1,4 @@
|
||||
package common
|
||||
package constant
|
||||
|
||||
const (
|
||||
PLAYER_MGR_HANDLER_ID = 1
|
@ -4,18 +4,18 @@ import (
|
||||
"cs"
|
||||
"ss"
|
||||
|
||||
. "main/common"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
type HandlerMgr struct {
|
||||
}
|
||||
|
||||
func (this *HandlerMgr) Init() {
|
||||
ss.RegHandlerId(int(ss.SSMessageIdE__SS_Ping), WSP_LISTENER_HANDLER_ID)
|
||||
ss.RegHandlerId(int(ss.SSMessageIdE__SS_WSP_SocketDisconnect), WSP_LISTENER_HANDLER_ID)
|
||||
ss.RegHandlerId(int(ss.SSMessageIdE__SS_Ping), constant.WSP_LISTENER_HANDLER_ID)
|
||||
ss.RegHandlerId(int(ss.SSMessageIdE__SS_WSP_SocketDisconnect), constant.WSP_LISTENER_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__CMPing), constant.PLAYER_MGR_HANDLER_ID)
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMLogin), constant.PLAYER_MGR_HANDLER_ID)
|
||||
}
|
||||
|
||||
func (this *HandlerMgr) UnInit() {
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"ss"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
. "main/common"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
type WSPListener struct {
|
||||
@ -65,8 +65,8 @@ func (this *WSPListener) socketRead(conn net.Conn) {
|
||||
for {
|
||||
{
|
||||
readBytes := bufLen - alreadyReadBytes
|
||||
if readBytes > MAX_PACKET_LEN-recvBufLen {
|
||||
readBytes = MAX_PACKET_LEN - recvBufLen
|
||||
if readBytes > constant.MAX_PACKET_LEN-recvBufLen {
|
||||
readBytes = constant.MAX_PACKET_LEN - recvBufLen
|
||||
}
|
||||
|
||||
if readBytes > 0 {
|
||||
@ -91,7 +91,7 @@ func (this *WSPListener) socketRead(conn net.Conn) {
|
||||
copy(recvBuf[:], recvBuf[offset:])
|
||||
}
|
||||
recvBufLen -= offset
|
||||
if recvBufLen >= MAX_PACKET_LEN {
|
||||
if recvBufLen >= constant.MAX_PACKET_LEN {
|
||||
panic("recv max packet")
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
"mt"
|
||||
"q5"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
)
|
||||
|
||||
type playerMgr struct {
|
||||
@ -140,9 +140,9 @@ func (this *playerMgr) addSocketHash(wsp f5.WspCliConn, p *Player) {
|
||||
|
||||
func (this* playerMgr) ProcessCMMsg(handler *cs.CsNetMsgHandler, hdr *f5.MsgHdr) {
|
||||
switch handler.HandlerId {
|
||||
case common.PLAYER_MGR_HANDLER_ID:
|
||||
case constant.PLAYER_MGR_HANDLER_ID:
|
||||
cs.DispatchMsg(handler, hdr, this)
|
||||
case common.PLAYER_HANDLER_ID:
|
||||
case constant.PLAYER_HANDLER_ID:
|
||||
player := this.getPlayerBySocket(hdr.GetSocket())
|
||||
if player != nil {
|
||||
cs.DispatchMsg(handler, hdr, player)
|
||||
|
Loading…
x
Reference in New Issue
Block a user