dobyte / due

A lightweight distributed game server framework developed based on Go language.
MIT License
444 stars 72 forks source link

tcp客户端连续发送消息时服务端收到错误信息 #11

Closed priceou closed 1 year ago

priceou commented 1 year ago

客户端发送 err2 := r.Proxy().Push(3, route.UploadUserPosition, &pb.PlayerPositionUploadReq{ UserId: msg.GetUserId(), Data: &pb.PositionData{ Pos: &pb.Vector3{ X: 4, Y: 3, Z: 2, }, Rotation: &pb.Vector3{ X: 4, Y: 3, Z: 2, }, Speed: &pb.Vector3{ X: 4, Y: 3, Z: 2, }, }, }) if err2 != nil { log.Errorf("upload player position error: %v", err2) }

err4 := r.Proxy().Push(4, route.UploadUserPosition, &pb.PlayerPositionUploadReq{
    UserId: msg.GetUserId(),
    Data: &pb.PositionData{
        Pos: &pb.Vector3{
            X: 1,
            Y: 1,
            Z: 1,
        },
        Rotation:  &pb.Vector3{
            X: 1,
            Y: 1,
            Z: 1,
        },
        Speed:  &pb.Vector3{
            X: 4,
            Y: 3,
            Z: 2,
        },
    },
})
if err4 != nil {
    log.Errorf("upload player position error: %v", err4)
}

err4 = r.Proxy().Push(5, route.UploadUserPosition, &pb.PlayerPositionUploadReq{
    UserId: msg.GetUserId(),
    Data: &pb.PositionData{
        Pos: &pb.Vector3{
            X: 3,
            Y: 3,
            Z: 3,
        },
        Rotation:  &pb.Vector3{
            X: 3,
            Y: 3,
            Z: 4,
        },
        Speed:  &pb.Vector3{
            X: 4,
            Y: 3,
            Z: 2,
        },
    },
})
if err4 != nil {
    log.Errorf("upload player position error: %v", err4)
}

err4 = r.Proxy().Push(6, route.UploadUserPosition, &pb.PlayerPositionUploadReq{
    UserId: msg.GetUserId(),
    Data: &pb.PositionData{
        Pos: &pb.Vector3{
            X: 6,
            Y: 7,
            Z: 8,
        },
        Rotation:  &pb.Vector3{
            X: 23,
            Y: 32,
            Z: 24,
        },
        Speed:  &pb.Vector3{
            X: 4,
            Y: 3,
            Z: 2,
        },
    },
})
if err4 != nil {
    log.Errorf("upload player position error: %v", err4)
}

err4 = r.Proxy().Push(7, route.UploadUserPosition, &pb.PlayerPositionUploadReq{
    UserId: msg.GetUserId(),
    Data: &pb.PositionData{
        Pos: &pb.Vector3{
            X: 16,
            Y: 27,
            Z: 18,
        },
        Rotation:  &pb.Vector3{
            X: 3,
            Y: 3,
            Z: 2,
        },
        Speed:  &pb.Vector3{
            X: 4,
            Y: 3,
            Z: 2,
        },
    },
})
if err4 != nil {
    log.Errorf("upload player position error: %v", err4)
}

gate服务节点接收 get unpack, seq[4], route[30] , msg[12330a0f0d0000803f150000803f1d0000803f120f0d0000803f150000803f1d0000803f1a0f0d0000804015000040401d00000040]

get unpack, seq[5], route[30] , msg[12330a0f0d0000404015000040401d00004040120f0d0000404015000040401d000080401a0f0d0000804015000040401d00000040]

get unpack, seq[6], route[30] , msg[12330a0f0d0000c040150000e0401d00000041120f0d0000b84115000000421d0000c0411a0f0d0000804015000040401d00000040]

get unpack, seq[7], route[30] , msg[12330a0f0d0000c040150000e0401d00000041120f0d0000b84115000000421d0000c0411a0f0d0000804015000040401d00000040]

get unpack, seq[7], route[30] , msg[12330a0f0d00008041150000d8411d00009041120f0d0000404015000040401d000000401a0f0d0000804015000040401d00000040]

seq3少了,seq7多了一条 把pb消息换成别的pb消息也是一样 但是在发送消息之间增加一个time.sleep延时就正常了

dobyte commented 1 year ago

已修复此BUG