RpcEngine.RemoveImport should throw rather than just log a warning when import ID is wrong

This commit is contained in:
Christian Köllner 2019-08-23 22:53:49 +02:00
parent c8881f3482
commit 7ea1c5dd1d
2 changed files with 5 additions and 9 deletions

View File

@ -345,7 +345,7 @@ namespace Capnp.Net.Runtime.Tests
}));
}
// Ensure that all answers either return (probably in canceled state)
// Ensure that all answers return (probably in canceled state)
Assert.IsTrue(Task.WhenAll(taskList).Wait(LargeNonDbgTimeout));
// Not part of original test. "Terminate" sequence with

View File

@ -1453,16 +1453,12 @@ namespace Capnp.Rpc
void IRpcEndpoint.RemoveImport(uint importId)
{
bool exists;
lock (_reentrancyBlocker)
{
exists = _importTable.Remove(importId);
}
if (!exists)
{
Logger.LogError("Inconsistent import table detected");
if (!_importTable.Remove(importId))
{
throw new ArgumentException("Given ID does not exist in import table");
}
}
}