LAPTOP-PC6VHEF0\XIONGHUY 1 год назад
Родитель
Сommit
dd21a4b736

+ 21 - 21
RO_Server_Trunk-branch_0.1.39/rocommon/socket/procrpc.go

@@ -46,7 +46,7 @@ func SetProcessorRPC(node rocommon.ServerNode, procName string, callback rocommo
 	}
 }
 
-//加入回调队列或者直接执行回调操作
+// 加入回调队列或者直接执行回调操作
 func QueueEventCall(cb rocommon.EventCallBack) rocommon.EventCallBack {
 	return func(e rocommon.ProcEvent) {
 		if cb != nil {
@@ -65,7 +65,7 @@ func QueueEventCall(cb rocommon.EventCallBack) rocommon.EventCallBack {
 	}
 }
 
-//在会话上执行事件回调,有队列则加入队列,没有就直接执行回调
+// 在会话上执行事件回调,有队列则加入队列,没有就直接执行回调
 func SessionQueueCall(s rocommon.Session, cb func()) {
 	if s == nil {
 		return
@@ -79,7 +79,7 @@ func SessionQueueCall(s rocommon.Session, cb func()) {
 	}
 }
 
-//注册和回掉函数相关操作
+// 注册和回掉函数相关操作
 func init() {
 	RegisterProcessRPC("tcp.pb",
 		func(b rocommon.ProcessorRPCBundle, usercb rocommon.EventCallBack, arg ...interface{}) {
@@ -89,13 +89,13 @@ func init() {
 		})
 }
 
-/////////////////////////////////////////////
-//NetProcessorRPC
+// ///////////////////////////////////////////
+// NetProcessorRPC
 func (this *NetProcessorRPC) GetRPC() *NetProcessorRPC {
 	return this
 }
 
-//收到消息后调用该函数入队列操作
+// 收到消息后调用该函数入队列操作
 func (this *NetProcessorRPC) ProcEvent(e rocommon.ProcEvent) {
 	//todo... hooker callback
 	if this.Hooker != nil {
@@ -137,8 +137,8 @@ func (self *NetProcessorRPC) SetCallback(ecb rocommon.EventCallBack) {
 	self.Callback = ecb
 }
 
-/////////////////////////////////////////////
-//EventHook interface def.go
+// ///////////////////////////////////////////
+// EventHook interface def.go
 type TCPEventHook struct {
 }
 
@@ -158,7 +158,7 @@ func (this *TCPEventHook) InEvent(e rocommon.ProcEvent) rocommon.ProcEvent {
 	return inEvent
 }
 
-//获得发送事件
+// 获得发送事件
 func (this *TCPEventHook) OutEvent(out rocommon.ProcEvent) rocommon.ProcEvent {
 	//todo...
 	handled, err := RPCResloveOutEvent(out)
@@ -173,7 +173,7 @@ func (this *TCPEventHook) OutEvent(out rocommon.ProcEvent) rocommon.ProcEvent {
 	return out
 }
 
-//multiHook 例如game server有多个处理操作
+// multiHook 例如game server有多个处理操作
 type MultiTCPEventHook []rocommon.EventHook
 
 func (this MultiTCPEventHook) InEvent(in rocommon.ProcEvent) rocommon.ProcEvent {
@@ -186,7 +186,7 @@ func (this MultiTCPEventHook) InEvent(in rocommon.ProcEvent) rocommon.ProcEvent
 	return in
 }
 
-//获得发送事件
+// 获得发送事件
 func (this MultiTCPEventHook) OutEvent(out rocommon.ProcEvent) rocommon.ProcEvent {
 	for _, ev := range this {
 		out = ev.OutEvent(out)
@@ -201,8 +201,8 @@ func NewMultiTCPEventHook(args ...rocommon.EventHook) rocommon.EventHook {
 	return MultiTCPEventHook(args)
 }
 
-//根据收到的消息类型进行过滤处理,例如如果是RecvMsgEvent事件,那么说明经过了protobuf解析,直接返回
-//例如远程过程调用的方式 / RPC消息解析
+// 根据收到的消息类型进行过滤处理,例如如果是RecvMsgEvent事件,那么说明经过了protobuf解析,直接返回
+// 例如远程过程调用的方式 / RPC消息解析
 func RPCResolveInEvent(inEvent rocommon.ProcEvent) (rocommon.ProcEvent, bool, error) {
 	//是接收处理消息
 	if _, ok := inEvent.(*rocommon.RecvMsgEvent); ok {
@@ -218,12 +218,12 @@ func RPCResloveOutEvent(outEvent rocommon.ProcEvent) (bool, error) {
 	return true, nil
 }
 
-/////////////////////////////////////////////
-//MessageProcessor interface def.go
+// ///////////////////////////////////////////
+// MessageProcessor interface def.go
 type TCPMessageProcessor struct {
 }
 
-//recv
+// recv
 func (this *TCPMessageProcessor) OnRecvMsg(s rocommon.Session) (msg interface{}, msgSeqId uint32, err error) {
 	//todo...
 	reader, ok := s.Raw().(io.Reader)
@@ -239,11 +239,11 @@ func (this *TCPMessageProcessor) OnRecvMsg(s rocommon.Session) (msg interface{},
 	return
 }
 
-//send
+// send
 var tmpClient = []byte("client")
 
 func (this *TCPMessageProcessor) OnSendMsg(s rocommon.Session, msg interface{}) (err error) {
-	util.InfoF("[TCPMessageProcessor] OnSendMsg session=%v msg=%v", s, msg)
+	util.DebugF("[TCPMessageProcessor] OnSendMsg session=%v msg=%v", s, msg)
 	//todo...
 	writer, ok := s.Raw().(io.Writer)
 	if !ok || writer == nil {
@@ -264,8 +264,8 @@ func (this *TCPMessageProcessor) OnSendMsg(s rocommon.Session, msg interface{})
 	return
 }
 
-/////////////////////////////////////////////
-//MessageProcessor interface def.go
+// ///////////////////////////////////////////
+// MessageProcessor interface def.go
 type WSMessageProcessor struct {
 }
 
@@ -276,7 +276,7 @@ const (
 	msgFlaglen = 2 //暂定标记,加解密 1表示RSA,2表示AES
 )
 
-//recv
+// recv
 func (this *WSMessageProcessor) OnRecvMsg(s rocommon.Session) (msg interface{}, msgSeqId uint32, err error) {
 	conn, ok := s.Raw().(*websocket.Conn)
 	if !ok || conn == nil {

+ 17 - 17
RO_Server_Trunk-branch_0.1.39/roserver/baseserver/hook_event.go

@@ -12,16 +12,16 @@ import (
 	"strconv"
 )
 
-///////////////////////////////////////////ServerTCPEventHook
-//game.backend
-//服务器之间的消息处理派发
+// /////////////////////////////////////////ServerTCPEventHook
+// game.backend
+// 服务器之间的消息处理派发
 type ServerTCPEventHook struct {
 	recvPingNum int32
 }
 
-//def.go EventHook interface
+// def.go EventHook interface
 func (this *ServerTCPEventHook) InEvent(in rocommon.ProcEvent) rocommon.ProcEvent {
-	util.InfoF("hook_event in_event msg=%v in=%v", in.Msg(), in)
+	util.DebugF("hook_event in_event msg=%v in=%v", in.Msg(), in)
 	switch msg := in.Msg().(type) {
 	case *serverproto.ServiceIdentifyACK: //来自其他服务器的连接确认信息
 		util.InfoF("[RecvServiceIdentifyACK]%v id=%v", msg.ServiceId, in.Session().ID())
@@ -87,15 +87,15 @@ func (this *ServerTCPEventHook) OutEvent(out rocommon.ProcEvent) rocommon.ProcEv
 	return out
 }
 
-///////////////////////////////////////////BackendTCPEventHook
+// /////////////////////////////////////////BackendTCPEventHook
 type BackendTCPEventHook struct {
 	selectRouterIdx int
 }
 
-//def.go EventHook interface
-//后端服务器接收到来自gate/db/auth的消息
+// def.go EventHook interface
+// 后端服务器接收到来自gate/db/auth的消息
 func (this *BackendTCPEventHook) InEvent(in rocommon.ProcEvent) rocommon.ProcEvent {
-	util.InfoF("BackendTCPhook_event BackendTCPin_event msg=%v in=%v", in.Msg(), in)
+	util.DebugF("BackendTCPhook_event BackendTCPin_event msg=%v in=%v", in.Msg(), in)
 	switch inMsg := in.Msg().(type) {
 	case *serverproto.GateTransmitAck:
 		userMsg, _, err := rpc.DecodeMessage(int(inMsg.MsgId), inMsg.MsgData)
@@ -210,7 +210,7 @@ func (this *BackendTCPEventHook) InEvent(in rocommon.ProcEvent) rocommon.ProcEve
 	return in
 }
 
-//后端服务器发送到gate/db的消息
+// 后端服务器发送到gate/db的消息
 func (this *BackendTCPEventHook) OutEvent(out rocommon.ProcEvent) rocommon.ProcEvent {
 	//todo...
 	switch out.Msg().(type) {
@@ -220,9 +220,9 @@ func (this *BackendTCPEventHook) OutEvent(out rocommon.ProcEvent) rocommon.ProcE
 	return out
 }
 
-///////////////////////////////////////////BackendTCPEventHook
-//跨服router节点处理
-//收到social节点的消息,或者收到跨服功能节点的消息
+// /////////////////////////////////////////BackendTCPEventHook
+// 跨服router节点处理
+// 收到social节点的消息,或者收到跨服功能节点的消息
 type BackendTCPEventForCrossRouterHook struct {
 	selectRouterIdx int
 }
@@ -304,8 +304,8 @@ func (this *BackendTCPEventForCrossRouterHook) OutEvent(out rocommon.ProcEvent)
 	return out
 }
 
-///////////////////////////////////////////DBTCPEventHook
-//处理game和db之间的消息
+// /////////////////////////////////////////DBTCPEventHook
+// 处理game和db之间的消息
 type ServiceTCPEventHook struct {
 	kvTimeMsgNumList []serverproto.KeyValueType
 	CurTime          uint64
@@ -339,7 +339,7 @@ func (this *ServiceTCPEventHook) kvTimeMsgLog(msgId int32) {
 	}
 }
 
-//db接收来自其他服务器的消息
+// db接收来自其他服务器的消息
 func (this *ServiceTCPEventHook) InEvent(in rocommon.ProcEvent) rocommon.ProcEvent {
 	switch inMsg := in.Msg().(type) {
 	case *serverproto.ServiceTransmitAck:
@@ -364,7 +364,7 @@ func (this *ServiceTCPEventHook) InEvent(in rocommon.ProcEvent) rocommon.ProcEve
 	return in
 }
 
-//db发送到其他服务器的消息
+// db发送到其他服务器的消息
 func (this *ServiceTCPEventHook) OutEvent(out rocommon.ProcEvent) rocommon.ProcEvent {
 	//todo...
 	switch out.Msg().(type) {

+ 12 - 12
RO_Server_Trunk-branch_0.1.39/roserver/baseserver/model/service_con.go

@@ -27,9 +27,9 @@ var (
 	bossSelectIndex   = 0
 )
 
-//服务器节点类型枚举
-//服务器类型节点Type:[1 gate] [2 game] [3 db] [4 auth] [5 social chat mail] [10 map] [11 map router] [12 pev] [13 boss]
-//20 crossrouter跨服路由  21crossserver跨服玩家节点
+// 服务器节点类型枚举
+// 服务器类型节点Type:[1 gate] [2 game] [3 db] [4 auth] [5 social chat mail] [10 map] [11 map router] [12 pev] [13 boss]
+// 20 crossrouter跨服路由  21crossserver跨服玩家节点
 const (
 	SERVICE_NODE_TYPE_GATE     = 1
 	SERVICE_NODE_TYPE_GATE_STR = "gate"
@@ -86,7 +86,7 @@ const (
 	SERVICE_NODE_TYPE_GLOBALCROSSMAP_STR    = "gcrossmap"
 )
 
-//需要加锁处理(后续放到主线程队列中做处理)
+// 需要加锁处理(后续放到主线程队列中做处理)
 func AddServiceNode(session rocommon.Session, sid, name string, from string) {
 	serviceNode.Lock()
 	defer serviceNode.Unlock()
@@ -176,7 +176,7 @@ func RemoveServiceNodeByName(sid string) {
 	serviceNode.Unlock()
 }
 
-//给定sid获得和服务器节点连接的session
+// 给定sid获得和服务器节点连接的session
 func GetServiceNode(sid string) rocommon.Session {
 	serviceNode.RLock()
 	defer serviceNode.RUnlock()
@@ -187,7 +187,7 @@ func GetServiceNode(sid string) rocommon.Session {
 	return nil
 }
 
-//获取指定服务器的节点名称列表
+// 获取指定服务器的节点名称列表
 func GetAllServiceNodeByName(serviceName string) []string {
 	serviceNode.RLock()
 	defer serviceNode.RUnlock()
@@ -204,7 +204,7 @@ func GetAllServiceNodeByName(serviceName string) []string {
 	return serviceNodeList
 }
 
-//获取指定服务器的index列表
+// 获取指定服务器的index列表
 func GetAllServiceNodeIdByName(serviceName string) []int32 {
 	serviceNode.RLock()
 	defer serviceNode.RUnlock()
@@ -244,7 +244,7 @@ func GetAllZoneSocialServiceNode(serviceName string) []string {
 	return retNodeList
 }
 
-//根据区组中的ID来获取对应服务器类型节点
+// 根据区组中的ID来获取对应服务器类型节点
 func GetServiceNodeById(serviceName string, id int) string {
 	serviceNode.RLock()
 	defer serviceNode.RUnlock()
@@ -270,9 +270,9 @@ func GetServiceNodeAndSession(serviceName string, serviceTypeName string, id uin
 		}
 	}
 
-	util.WarnF("GetServiceNodeAndSession serviceTypeName=%v id=%v", serviceTypeName, id)
+	util.DebugF("GetServiceNodeAndSession serviceTypeName=%v id=%v", serviceTypeName, id)
 	tmpServiceName, tmpSess := SelectServiceNodeAndSession(serviceTypeName, id)
-	util.WarnF("GetServiceNodeAndSession tmpServiceName=%v tmpSess=%v", tmpServiceName, tmpSess)
+	util.DebugF("GetServiceNodeAndSession tmpServiceName=%v tmpSess=%v", tmpServiceName, tmpSess)
 	if tmpServiceName != "" {
 		return tmpServiceName, tmpSess
 	} else {
@@ -339,7 +339,7 @@ func SelectServiceNode(serviceName string, id uint64) string {
 	return ""
 }
 
-//id确定的某一个服务器节点
+// id确定的某一个服务器节点
 func selectServiceNode(serviceName string, id uint64) string {
 	serviceNode.RLock()
 	defer serviceNode.RUnlock()
@@ -385,7 +385,7 @@ func SelectAuthServiceNode(serviceName string, sessionId uint64) string {
 	return ""
 }
 
-//todo..
+// todo..
 // 选择负载较低的节点进入
 func selectAoiServiceNode(serviceName string) string {
 	serviceNode.RLock()