diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2010-01-20 08:57:20 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2010-01-20 08:57:20 +0300 |
commit | e0e85ef8ce6a524b42fad404070868f9a0217b9d (patch) | |
tree | a4cd32af89e5f618abea9706089f486ce33dc3b1 /mcs | |
parent | 8555feeefdcbabfef146e913ab3380c1e49f13fb (diff) |
2010-01-20 Atsushi Enomoto <atsushi@ximian.com>
* CommunicationObject.cs : in Fault(), do similar work as previous
change does.
svn path=/trunk/mcs/; revision=149879
Diffstat (limited to 'mcs')
-rwxr-xr-x | mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System.ServiceModel/System.ServiceModel.Channels/CommunicationObject.cs | 21 |
2 files changed, 21 insertions, 5 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog index 4ad13df6cde..ad3ba79580c 100755 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog @@ -1,3 +1,8 @@ +2010-01-20 Atsushi Enomoto <atsushi@ximian.com> + + * CommunicationObject.cs : in Fault(), do similar work as previous + change does. + 2010-01-19 Atsushi Enomoto <atsushi@ximian.com> * CommunicationObject.cs : when process state changes, lock the diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/CommunicationObject.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/CommunicationObject.cs index 4c8418fdecc..d44adf6e68b 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/CommunicationObject.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/CommunicationObject.cs @@ -93,11 +93,9 @@ namespace System.ServiceModel.Channels } } - [MonoTODO] protected void Fault () { - state = CommunicationState.Faulted; - OnFaulted (); + ProcessFaulted (); } public IAsyncResult BeginClose (AsyncCallback callback, @@ -229,11 +227,24 @@ namespace System.ServiceModel.Channels protected abstract void OnEndOpen (IAsyncResult result); - [MonoTODO] + void ProcessFaulted () + { + lock (ThisLock) { + if (State == CommunicationState.Faulted) + throw new CommunicationObjectFaultedException (); + OnFaulted (); + if (state != CommunicationState.Faulted) { + throw new InvalidOperationException (String.Format ("Communication object {0} has an overriden OnFaulted method that does not call base OnFaulted method (declared in {1} type).", this.GetType (), GetType ().GetMethod ("OnFaulted", BindingFlags.NonPublic | BindingFlags.Instance).DeclaringType)); + state = CommunicationState.Faulted; // FIXME: am not sure if this makes sense ... + } + } + } + protected virtual void OnFaulted () { + state = CommunicationState.Faulted; // This means, if this method is overriden, then - // Opened event is surpressed. + // Faulted event is surpressed. if (Faulted != null) Faulted (this, new EventArgs ()); } |