Skip to content
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

Missing way to return failure from registerCallback method signatures #434

Open
thirtytwobits opened this issue Feb 3, 2025 · 3 comments

Comments

@thirtytwobits
Copy link
Contributor

In places where we call IExecutor::Callback::Any registerCallback(IExecutor::Callback::Function&& function) on object (e.g. IRxSocket in the udp transport) there is no well-defined way to return a failure.

@pavel-kirienko
Copy link
Member

It is designed to be infallible. In particular, implementations are not expected to allocate memory. What failure modes do you think are missing?

@thirtytwobits
Copy link
Contributor Author

I'm using flyweight objects which are not real sockets. There is a chance that the real socket got deleted which leaves the flyweights as orphans. I have no way to signal that the object is no longer initialized even if the C++ object remains well-formed.

Additionally, the only way I can schedule sockets after the registerCallback method was called is to save a pointer to the callback's interface. getInterface can return null and I have no way to signal that this isn't acceptable; that the callback created by the IExecutor is not valid for the socket.

@pavel-kirienko
Copy link
Member

Let us please look at your code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants