diff --git a/gamesrv/action/action_machine.go b/gamesrv/action/action_machine.go index de05608..7fbf164 100644 --- a/gamesrv/action/action_machine.go +++ b/gamesrv/action/action_machine.go @@ -4,7 +4,9 @@ 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" + "time" ) var MachineMap = make(map[int]*DollMachine) @@ -73,7 +75,13 @@ func MSDollMachineHeartBeatHandler(session *netlib.Session, packetId int, data i //fmt.Println("收到娃娃机服务心跳!!!") //返回心跳 pack := &machine.SMDollMachineHeartBeat{} - session.Send(int(machine.DollMachinePacketID_Packet_SMDollMachineHeartBeat), pack) + pack.TimeStamp = time.Now().UnixMilli() + 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 } diff --git a/machine/machineConfig.json b/machine/machineIPConfig.json similarity index 100% rename from machine/machineConfig.json rename to machine/machineIPConfig.json 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; } 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