summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-01-20 08:17:27 -0800
committerAndrew <andrewarnott@gmail.com>2009-01-20 08:17:27 -0800
commit2d67dfd17c7222d16ac620ec667b32bb52b28a72 (patch)
treebd3df22748a17c651c2898ef9a06c71cdf7e7890 /src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
parent495d32a9098c06b223df2b5abd7e0411882dd293 (diff)
downloadDotNetOpenAuth-2d67dfd17c7222d16ac620ec667b32bb52b28a72.zip
DotNetOpenAuth-2d67dfd17c7222d16ac620ec667b32bb52b28a72.tar.gz
DotNetOpenAuth-2d67dfd17c7222d16ac620ec667b32bb52b28a72.tar.bz2
Added detection of multi-threading issues in the OpenIdCoordinator.
Diffstat (limited to 'src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs')
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
index d31dea7..f9a0270 100644
--- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
@@ -116,6 +116,7 @@ namespace DotNetOpenAuth.Test.Mocks {
}
internal void PostMessage(IProtocolMessage message) {
+ ErrorUtilities.VerifyInternal(this.incomingMessage == null, "Oops, a message is already waiting for the remote party!");
this.incomingMessage = CloneSerializedParts(message);
this.incomingMessageSignal.Set();
}
@@ -128,6 +129,7 @@ namespace DotNetOpenAuth.Test.Mocks {
this.ProcessMessageFilter(request, true);
HttpRequestInfo requestInfo = this.SpoofHttpMethod(request);
// Drop the outgoing message in the other channel's in-slot and let them know it's there.
+ ErrorUtilities.VerifyInternal(this.RemoteChannel.incomingMessage == null, "Oops, a message is already waiting for the remote party!");
this.RemoteChannel.incomingMessage = requestInfo.Message;
this.RemoteChannel.incomingMessageSignal.Set();
// Now wait for a response...
@@ -236,11 +238,10 @@ namespace DotNetOpenAuth.Test.Mocks {
lock (waitingForMessageCoordinationLock) {
this.waitingForMessage = false;
+ IProtocolMessage response = this.incomingMessage;
+ this.incomingMessage = null;
+ return response;
}
-
- IProtocolMessage response = this.incomingMessage;
- this.incomingMessage = null;
- return response;
}
private void ProcessMessageFilter(IProtocolMessage message, bool outgoing) {