Skip to content

[BUG]消息丢失 #4

@ngtrio

Description

@ngtrio
while ((size = client.read(buf)) > 0) {
                    buf.flip();
                    baos.write(buf.array(), 0, size);
                    buf.clear();
 }

在ReadEventHandler中,TCP可能粘包,此处baos存入的可能是多条消息的字节流,反序列化会导致客户端到达的部分消息丢失。(在ReadEventHandler中sleep一下就能看到此bug)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions