Skip to content

Some questions about the code. #2

@zysaaa

Description

@zysaaa

Hi, I have some questions about the code.
First, in AbstractPacketWorker#addData:
I notice that you use a tempArray to copy the array, would it be better to copy between bytebuffers directly? Like this:

data.flip();
// Make a copy of the data
buffer.put(data);

Besides, in this method, this.pendingData.remove(socket); should be able to be removed.

Second, in VariableLengthPacketWorker#prepareForWait, It looks like there's some duplication of work, I used the following code , it seems work well as well.

data.position(data.limit());
data.limit(data.capacity());
pendingSockets.removeFirst();

Looking forward to your reply, and thank you very much for your good code and comments~~~

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