New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mqtt payload for publish message copied 2 times during lifetime #13844
Comments
@doom369 sounds like something we can change .. Do you want to do a PR ? I think it should be |
@normanmaurer I was thinking about:
In a typical use case you would do:
Do you think this |
I would allocate an ioBuffer and perform the copy into it, which will still happen later in the transport layers... |
That's what the current Also, from the netty-end-user point of view - buffers are not necessary, I just want to send a string message back into mqtt channel (most common use case). So for me, it would be more convenient to send String instead of ByteBuf. But that's another issue. |
PublishBuilder.build():
has
Unpooled.buffer().writeBytes(payload)
. This is one is not big deal as we can easily overcome it.MqttEncoder.encodePublishMessage:
ByteBuf payload = message.payload().duplicate();
My understanding, the authors were playing safe, however 2 copies, seems like overkill. WDYT? Should I fix it?
The text was updated successfully, but these errors were encountered: