From 3492ba16317524ffbfd9503aade46e0d61903d29 Mon Sep 17 00:00:00 2001 From: by <123456@qq.com> Date: Thu, 12 Sep 2024 09:00:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=BF=83=E8=B7=B3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/action/action_machine.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gamesrv/action/action_machine.go b/gamesrv/action/action_machine.go index de05608..0ce6132 100644 --- a/gamesrv/action/action_machine.go +++ b/gamesrv/action/action_machine.go @@ -4,6 +4,7 @@ import ( "mongo.games.com/game/protocol/machine" "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" + "mongo.games.com/goserver/srvlib" "sync" ) @@ -73,7 +74,12 @@ func MSDollMachineHeartBeatHandler(session *netlib.Session, packetId int, data i //fmt.Println("收到娃娃机服务心跳!!!") //返回心跳 pack := &machine.SMDollMachineHeartBeat{} - session.Send(int(machine.DollMachinePacketID_Packet_SMDollMachineHeartBeat), pack) + machineConn := srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001) + if machineConn != nil { + machineConn.Send(int(machine.DollMachinePacketID_Packet_SMDollMachineHeartBeat), pack) + } else { + logger.Logger.Error("MSDollMachineHeartBeatHandler:MachineConn is nil !") + } return nil } From 58d15e767d2bf93790979f3966e0f1c3a6531f47 Mon Sep 17 00:00:00 2001 From: by <123456@qq.com> Date: Fri, 13 Sep 2024 09:38:58 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A8=83=E5=A8=83=E6=9C=BA=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- machine/{machineConfig.json => machineIPConfig.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename machine/{machineConfig.json => machineIPConfig.json} (100%) diff --git a/machine/machineConfig.json b/machine/machineIPConfig.json similarity index 100% rename from machine/machineConfig.json rename to machine/machineIPConfig.json From 3c3fcbb920abe3ab7cedf799962ea4476a7593da Mon Sep 17 00:00:00 2001 From: by <123456@qq.com> Date: Fri, 13 Sep 2024 09:51:41 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A8=83=E5=A8=83=E6=9C=BA=E6=89=93?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/build.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/build.bat b/shell/build.bat index 0120fb7..5d98f1f 100644 --- a/shell/build.bat +++ b/shell/build.bat @@ -4,4 +4,5 @@ call shell/build_sub.bat gatesrv call shell/build_sub.bat worldsrv call shell/build_sub.bat gamesrv call shell/build_sub.bat robot -call shell/build_sub.bat ranksrv \ No newline at end of file +call shell/build_sub.bat ranksrv +call shell/build_sub.bat machine \ No newline at end of file From 31db1865649c3857cdb3b8559737e1fe9e0be49e Mon Sep 17 00:00:00 2001 From: by <123456@qq.com> Date: Fri, 13 Sep 2024 10:51:16 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A8=83=E5=A8=83=E6=9C=BA=E5=BF=83?= =?UTF-8?q?=E8=B7=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/action/action_machine.go | 2 + machine/machinedoll/machinemgr.go | 1 + protocol/machine/machine.pb.go | 84 +++++++++++++++++++------------ protocol/machine/machine.proto | 4 +- 4 files changed, 58 insertions(+), 33 deletions(-) diff --git a/gamesrv/action/action_machine.go b/gamesrv/action/action_machine.go index 0ce6132..7fbf164 100644 --- a/gamesrv/action/action_machine.go +++ b/gamesrv/action/action_machine.go @@ -6,6 +6,7 @@ import ( "mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/srvlib" "sync" + "time" ) var MachineMap = make(map[int]*DollMachine) @@ -74,6 +75,7 @@ func MSDollMachineHeartBeatHandler(session *netlib.Session, packetId int, data i //fmt.Println("收到娃娃机服务心跳!!!") //返回心跳 pack := &machine.SMDollMachineHeartBeat{} + pack.TimeStamp = time.Now().UnixMilli() machineConn := srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001) if machineConn != nil { machineConn.Send(int(machine.DollMachinePacketID_Packet_SMDollMachineHeartBeat), pack) diff --git a/machine/machinedoll/machinemgr.go b/machine/machinedoll/machinemgr.go index 384c901..b4cbf18 100644 --- a/machine/machinedoll/machinemgr.go +++ b/machine/machinedoll/machinemgr.go @@ -131,6 +131,7 @@ func (this *MachineManager) CreateConn(key int) *Conn { func (this *MachineManager) Update() { //向游戏服发送心跳包 pack := &machine.MSDollMachineHeartBeat{} + pack.TimeStamp = time.Now().UnixMilli() SendToGameServer(int(machine.DollMachinePacketID_Packet_MSDollMachineHeartBeat), pack) /* var delConn []*Conn task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { diff --git a/protocol/machine/machine.pb.go b/protocol/machine/machine.pb.go index daedf50..ff5cea9 100644 --- a/protocol/machine/machine.pb.go +++ b/protocol/machine/machine.pb.go @@ -507,6 +507,8 @@ type MSDollMachineHeartBeat struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + TimeStamp int64 `protobuf:"varint,1,opt,name=TimeStamp,proto3" json:"TimeStamp,omitempty"` } func (x *MSDollMachineHeartBeat) Reset() { @@ -541,10 +543,19 @@ func (*MSDollMachineHeartBeat) Descriptor() ([]byte, []int) { return file_machine_proto_rawDescGZIP(), []int{7} } +func (x *MSDollMachineHeartBeat) GetTimeStamp() int64 { + if x != nil { + return x.TimeStamp + } + return 0 +} + type SMDollMachineHeartBeat struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + TimeStamp int64 `protobuf:"varint,1,opt,name=TimeStamp,proto3" json:"TimeStamp,omitempty"` } func (x *SMDollMachineHeartBeat) Reset() { @@ -579,6 +590,13 @@ func (*SMDollMachineHeartBeat) Descriptor() ([]byte, []int) { return file_machine_proto_rawDescGZIP(), []int{8} } +func (x *SMDollMachineHeartBeat) GetTimeStamp() int64 { + if x != nil { + return x.TimeStamp + } + return 0 +} + var File_machine_proto protoreflect.FileDescriptor var file_machine_proto_rawDesc = []byte{ @@ -616,37 +634,41 @@ var file_machine_proto_rawDesc = []byte{ 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, - 0x64, 0x64, 0x72, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, - 0x68, 0x69, 0x6e, 0x65, 0x48, 0x65, 0x61, 0x72, 0x74, 0x42, 0x65, 0x61, 0x74, 0x22, 0x18, 0x0a, - 0x16, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x48, 0x65, - 0x61, 0x72, 0x74, 0x42, 0x65, 0x61, 0x74, 0x2a, 0x83, 0x03, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, - 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, - 0x1c, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, - 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5a, 0x65, 0x72, 0x6f, 0x10, 0x00, 0x12, 0x1e, 0x0a, - 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x69, - 0x6e, 0x6b, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x10, 0xa0, 0x9c, 0x01, 0x12, 0x20, 0x0a, - 0x1a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, - 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, 0x65, 0x72, 0x61, 0x74, 0x65, 0x10, 0xa1, 0x9c, 0x01, 0x12, - 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, - 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x10, 0xa2, 0x9c, 0x01, 0x12, - 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, - 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xa3, 0x9c, 0x01, 0x12, - 0x26, 0x0a, 0x20, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x10, 0xa4, 0x9c, 0x01, 0x12, 0x27, 0x0a, 0x21, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x6f, - 0x50, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x10, 0xa5, 0x9c, 0x01, - 0x12, 0x17, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x47, 0x65, 0x74, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa6, 0x9c, 0x01, 0x12, 0x18, 0x0a, 0x12, 0x50, 0x41, 0x43, - 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, - 0xa7, 0x9c, 0x01, 0x12, 0x23, 0x0a, 0x1d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x4d, 0x53, - 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x48, 0x65, 0x61, 0x72, 0x74, - 0x42, 0x65, 0x61, 0x74, 0x10, 0xa8, 0x9c, 0x01, 0x12, 0x23, 0x0a, 0x1d, 0x50, 0x61, 0x63, 0x6b, - 0x65, 0x74, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, - 0x48, 0x65, 0x61, 0x72, 0x74, 0x42, 0x65, 0x61, 0x74, 0x10, 0xa9, 0x9c, 0x01, 0x42, 0x27, 0x5a, - 0x25, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6d, - 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x64, 0x72, 0x22, 0x36, 0x0a, 0x16, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, + 0x68, 0x69, 0x6e, 0x65, 0x48, 0x65, 0x61, 0x72, 0x74, 0x42, 0x65, 0x61, 0x74, 0x12, 0x1c, 0x0a, + 0x09, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x36, 0x0a, 0x16, 0x53, + 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x48, 0x65, 0x61, 0x72, + 0x74, 0x42, 0x65, 0x61, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x74, 0x61, + 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x74, + 0x61, 0x6d, 0x70, 0x2a, 0x83, 0x03, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x18, 0x50, + 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x5a, 0x65, 0x72, 0x6f, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, + 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x75, + 0x63, 0x63, 0x65, 0x65, 0x64, 0x10, 0xa0, 0x9c, 0x01, 0x12, 0x20, 0x0a, 0x1a, 0x50, 0x41, 0x43, + 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, + 0x65, 0x50, 0x65, 0x72, 0x61, 0x74, 0x65, 0x10, 0xa1, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, + 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x10, 0xa2, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, + 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xa3, 0x9c, 0x01, 0x12, 0x26, 0x0a, 0x20, 0x50, + 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, + 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x10, + 0xa4, 0x9c, 0x01, 0x12, 0x27, 0x0a, 0x21, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, + 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x6f, 0x50, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x10, 0xa5, 0x9c, 0x01, 0x12, 0x17, 0x0a, 0x11, + 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x10, 0xa6, 0x9c, 0x01, 0x12, 0x18, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, + 0x4d, 0x53, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa7, 0x9c, 0x01, 0x12, + 0x23, 0x0a, 0x1d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, + 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x48, 0x65, 0x61, 0x72, 0x74, 0x42, 0x65, 0x61, 0x74, + 0x10, 0xa8, 0x9c, 0x01, 0x12, 0x23, 0x0a, 0x1d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x53, + 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x48, 0x65, 0x61, 0x72, + 0x74, 0x42, 0x65, 0x61, 0x74, 0x10, 0xa9, 0x9c, 0x01, 0x42, 0x27, 0x5a, 0x25, 0x6d, 0x6f, 0x6e, + 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, + 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/protocol/machine/machine.proto b/protocol/machine/machine.proto index db5e50b..7a21f5a 100644 --- a/protocol/machine/machine.proto +++ b/protocol/machine/machine.proto @@ -63,8 +63,8 @@ message MSUpdateDollMachineStatus{ } //心跳 message MSDollMachineHeartBeat{ - + int64 TimeStamp = 1; } message SMDollMachineHeartBeat{ - + int64 TimeStamp = 1; }