Commit 536b10b1 authored by Marc Gravell's avatar Marc Gravell

only need to take the write lock if the connection has subscriptions; don't...

only need to take the write lock if the connection has subscriptions; don't need to impact regular connections
parent eb406a70
...@@ -339,9 +339,11 @@ void WritePrefix(PipeWriter ooutput, char pprefix) ...@@ -339,9 +339,11 @@ void WritePrefix(PipeWriter ooutput, char pprefix)
if (value.IsNil) return; // not actually a request (i.e. empty/whitespace request) if (value.IsNil) return; // not actually a request (i.e. empty/whitespace request)
if (client != null && client.ShouldSkipResponse()) return; // intentionally skipping the result if (client != null && client.ShouldSkipResponse()) return; // intentionally skipping the result
if (client != null) bool haveLock = false;
if (client != null && client.SubscriptionCount != 0)
{ {
await client.TakeWriteLockAsync(); await client.TakeWriteLockAsync();
haveLock = true;
} }
try try
{ {
...@@ -396,7 +398,7 @@ void WritePrefix(PipeWriter ooutput, char pprefix) ...@@ -396,7 +398,7 @@ void WritePrefix(PipeWriter ooutput, char pprefix)
} }
finally finally
{ {
if (client != null) if (haveLock)
{ {
client.ReleaseWriteLock(); client.ReleaseWriteLock();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment