ice
ice copied to clipboard
Add support for serialized method execution
Consider a use case like this. A server allows a client to register a listener for receiving notifications of the server activity. The listener implements an interface like this:
interface ActivityListener
{
void on_activity_started();
void on_activity_finished();
};
The server is not interested in results of these notifications, and therefore it simply calls begin_on_activity_started()
and begin_on_activity_finished()
when the respective events happen. This allows the server to not block on notifications and continue with its operations.
The problem is that, presumably, these notifications may be reordered when they reach the client, even if the order of these calls in the server is correct. That is, the client may observe the on_activity_finished()
notification before the on_activity_started()
one. First, there may be multiple transports connecting the client and the server, and the two calls may get transported through different transports. Second, there may be multiple ICE threads in the client processing incoming ICE calls, and it is possible that the thread handling the on_activity_finished()
notification reaches the listener object before the one handling on_activity_started()
.
Provided that my understanding is correct, and reordering may indeed happen, it would be useful to have a way to guarantee the correct notification order in the above use case. For example, add a new option to ICE proxies so that a new call made through a proxy blocks (for synchronous calls) or enqueues for sending (for asynchronous calls) until the previous call through that proxy is complete. It would work on per-proxy granularity, so that calls made through different proxies, even if the proxies represent the same object, would still be unordered.