cwzx / nngpp

C++ wrapper around the nanomsg NNG API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect behavior of aio_view::set_msg(&&)

nagua opened this issue · comments

Hey everyone,

after a talk with gdamore I was informed, that nng only takes ownership of a msg if the
associated send operation was successful. If the operation wasn't successful the message
will no be free'd.

So I think the current move operator implementation in aio_view should be deleted.

I can hopefully do a pull request for that in the coming days.

I was made aware that you can recover from that situation with aio_view::release_msg.
Now I'm not so sure anymore, what the right path is.

It's my thinking that calling release_msg in the completion callback when some error has occurred is a best practice based on how the underlying library works. It's awfully easy to overlook, but on the upside it isn't an error to call release_msg on an AIO that doesn't own a message.