I create your handler and pass it into several transports on game launch. During soft restarts, which I do for network errors, network mode switches(wifi, cellular) etc. , I would like to be able to kill all previous requests because they will eventually fail in an awkward state.
var serviceHost = $"https://{args.Host}:{args.Port}";
var channel = GrpcChannel.ForAddress(serviceHost, new GrpcChannelOptions
{
HttpHandler = _httpHandler,
});
_grpcContext = new GrpcContext(channel, _cancellationTokenSource.Token);
_healthCheckServiceTransport = new HealthCheckServiceTransport(_grpcContext);
_authSrv = new AuthServiceTransport(_grpcContext);
Since I still want to reuse the GrpcChannel, it only makes sense to dispose and reinstantiate the handler. However current structure of YetAnotherHttpHandler does not allow that.
To fix this issue I had to clone the repo into my project and added this small tweak to YetAnotherHttpHandler.cs. It was impossible to solve this with extending due to private fields.
Calling Dispose(false) during soft restarts works completely fine now, even though it feels a bit dirty.
I can open a MR for this or if you have a cleaner idea to like maybe adding a void Restart into handler it would be great. I would rather keep this repo as a package.
I create your handler and pass it into several transports on game launch. During soft restarts, which I do for network errors, network mode switches(wifi, cellular) etc. , I would like to be able to kill all previous requests because they will eventually fail in an awkward state.
Since I still want to reuse the
GrpcChannel
, it only makes sense to dispose and reinstantiate the handler. However current structure ofYetAnotherHttpHandler
does not allow that.To fix this issue I had to clone the repo into my project and added this small tweak to
YetAnotherHttpHandler.cs
. It was impossible to solve this with extending due toprivate
fields.Calling
Dispose(false)
during soft restarts works completely fine now, even though it feels a bit dirty.I can open a MR for this or if you have a cleaner idea to like maybe adding a
void Restart
into handler it would be great. I would rather keep this repo as a package.