Support for faulted channels

Apr 16, 2013 at 10:38 AM
Edited Apr 16, 2013 at 10:38 AM
When a channel is faulted, would be great some way to recover it.
I have been testing adding a piece of code in PersistentClientPool ReleaseProxy function. I think it could work.
        /// <summary>
        /// Releases a smart proxy to this manager.
        /// </summary>
        /// <param name="channel">The smart proxy instance to release.</param>
        public bool ReleaseProxy(TContract channel)
        {
            if (((ICommunicationObject)channel).State == CommunicationState.Faulted)
            {
                ((ICommunicationObject)channel).Abort();
                channel = factory.CreateChannel();
            }
            
            if (allChannels.Contains(channel) && !availableChannels.Contains(channel))
            {
                lock (availableChannels)
                    availableChannels.Add(channel);
                semaphore.Release(); // again, only release on success rather than in finally
                return true;
            }
            else
                return false;
        }
Coordinator
Apr 20, 2013 at 7:33 AM
Good point, if a persistent connection fails for some reason, it should be automatically replaced. I'll look into adding this feature soon.
Coordinator
May 6, 2013 at 3:14 AM
As with your other post regarding recursive parent interface support, I'll definitely accept a pull request which includes this fix. The only thing I'd like to mention is that it would be better to do this in the RequestProxy() method instead of the ReleaseProxy() method. That way, a faulted channel is only replaced when it's absolutely necessary.
Coordinator
Jun 8, 2013 at 2:50 AM
Well that's frustrating (probably for both of us): for some reason Codeplex never alerted me to your pull requests. This weekend I'll go over them and likely incorporate them. Thanks for submitting!!
Jun 10, 2013 at 1:47 PM
I was suspecting that was a CodePlex notifications matter or something similar. Don't worry.
After struggling for some time with Git and CodePlex, I decided to delete my forks and create a single one.
Sorry, I'm new in Git.
In this new fork and pull request, I try to solve what you commented in previous pull requests.
I wait your comments.
Thank you.