summaryrefslogtreecommitdiff
path: root/csharp/src/Ice/Object.cs
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2019-07-18 18:09:15 +0200
committerGitHub <noreply@github.com>2019-07-18 18:09:15 +0200
commit2c036ca6ca7f39b6987135839a1a899cd080877d (patch)
tree71b429a5784a77ec41084ba84105930f537f195e /csharp/src/Ice/Object.cs
parentBumped invocation timeout in Objectice-C timeout test (diff)
downloadice-2c036ca6ca7f39b6987135839a1a899cd080877d.tar.bz2
ice-2c036ca6ca7f39b6987135839a1a899cd080877d.tar.xz
ice-2c036ca6ca7f39b6987135839a1a899cd080877d.zip
Fixed non-thread safe AMD dispatch, fixes #448 (#449)
The caching of the output stream which was added back to solve #414 made the dispatch of AMD requests non thread-safe if a dispatch interceptor was installed and if the interceptor retried the dispatch. Multiple continuation could run concurrently and eventually re-use the cached output stream to marshal multiple responses.
Diffstat (limited to 'csharp/src/Ice/Object.cs')
-rw-r--r--csharp/src/Ice/Object.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/csharp/src/Ice/Object.cs b/csharp/src/Ice/Object.cs
index dd9913ba5f3..78f776e671b 100644
--- a/csharp/src/Ice/Object.cs
+++ b/csharp/src/Ice/Object.cs
@@ -310,7 +310,7 @@ namespace Ice
byte[] inEncaps = inS.readParamEncaps();
byte[] outEncaps;
bool ok = ice_invoke(inEncaps, out outEncaps, current);
- inS.setResult(inS.writeParamEncaps(outEncaps, ok));
+ inS.setResult(inS.writeParamEncaps(inS.getAndClearCachedOutputStream(), outEncaps, ok));
return null;
}
}
@@ -323,10 +323,12 @@ namespace Ice
public override Task<Ice.OutputStream> iceDispatch(IceInternal.Incoming inS, Current current)
{
byte[] inEncaps = inS.readParamEncaps();
- return ice_invokeAsync(inEncaps, current).ContinueWith((Task<Object_Ice_invokeResult> t) =>
+ var task = ice_invokeAsync(inEncaps, current);
+ var cached = inS.getAndClearCachedOutputStream();
+ return task.ContinueWith((Task<Object_Ice_invokeResult> t) =>
{
var ret = t.GetAwaiter().GetResult();
- return Task.FromResult(inS.writeParamEncaps(ret.outEncaps, ret.returnValue));
+ return Task.FromResult(inS.writeParamEncaps(cached, ret.outEncaps, ret.returnValue));
}).Unwrap();
}
}