Kotlin / kotlinx-rpc

Add asynchronous RPC services to your multiplatform applications.
https://kotlin.github.io/kotlinx-rpc/
Apache License 2.0
702 stars 16 forks source link

Added cancellations for requests and services with no streams #47

Closed Mr3zee closed 5 months ago

Mr3zee commented 5 months ago

Problem Description Lifetimes in kRPC were not well handled, which led to leaks and undefined behavior.

Solution This PR introduces cancellation mechanism, which has three levels: request, service and endpoint. Each of these entities can be cancelled and cancellation notice will be sent to a peer endpoint. Cancellation cases are handles according to the design doc.

This PR covers cases of plain requests, excluding streamings, though providing base for further work with streams.

As PR is quite big, it is divided into 3 main parts (by commits):