diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2009-08-06 15:41:46 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2009-08-06 15:41:46 +0400 |
commit | bbe1510f778972449edfffd64ac78b61ee776009 (patch) | |
tree | 946398aee1aeb6eaffe7a5d63e10b00b856db531 /mcs/class | |
parent | 9e4d364a6d10ab8c4a5adb103bf8d8098cdf7863 (diff) |
2009-08-06 Atsushi Enomoto <atsushi@ximian.com>
* ReplyChannelBase.cs, TcpReplyChannel.cs, HttpReplyChannel.cs:
implement remaining async methods and LocalAddress.
svn path=/trunk/mcs/; revision=139466
Diffstat (limited to 'mcs/class')
4 files changed, 38 insertions, 21 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog index 3ffcc4eedc6..c9b465b1055 100755 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog @@ -1,3 +1,8 @@ +2009-08-06 Atsushi Enomoto <atsushi@ximian.com> + + * ReplyChannelBase.cs, TcpReplyChannel.cs, HttpReplyChannel.cs: + implement remaining async methods and LocalAddress. + 2009-08-05 Atsushi Enomoto <atsushi@ximian.com> * PeerDuplexChannel.cs : ongoing listener refactoring. Now it uses diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpReplyChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpReplyChannel.cs index d30f8c30f6e..2c41fefda46 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpReplyChannel.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpReplyChannel.cs @@ -157,11 +157,10 @@ w.Close (); } } - internal abstract class HttpReplyChannel : ReplyChannelBase + internal abstract class HttpReplyChannel : InternalReplyChannelBase { HttpChannelListenerBase<IReplyChannel> source; List<HttpListenerContext> waiting = new List<HttpListenerContext> (); - EndpointAddress local_address; public HttpReplyChannel (HttpChannelListenerBase<IReplyChannel> listener) : base (listener) @@ -173,11 +172,6 @@ w.Close (); get { return source.MessageEncoder; } } - // FIXME: where is it set? - public override EndpointAddress LocalAddress { - get { return local_address; } - } - internal MessageVersion MessageVersion { get { return source.MessageEncoder.MessageVersion; } } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs index 069c17e49cb..6c2c81db3d6 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs @@ -37,6 +37,21 @@ using System.Threading; namespace System.ServiceModel.Channels { + internal abstract class InternalReplyChannelBase : ReplyChannelBase + { + public InternalReplyChannelBase (ChannelListenerBase listener) + : base (listener) + { + local_address = new EndpointAddress (listener.Uri); + } + + EndpointAddress local_address; + + public override EndpointAddress LocalAddress { + get { return local_address; } + } + } + internal abstract class ReplyChannelBase : ChannelBase, IReplyChannel { public ReplyChannelBase (ChannelListenerBase listener) @@ -119,13 +134,12 @@ namespace System.ServiceModel.Channels public abstract bool WaitForRequest (TimeSpan timeout); - delegate bool WaitDelegate (TimeSpan timeout); - WaitDelegate wait_delegate; + Func<TimeSpan,bool> wait_delegate; public virtual IAsyncResult BeginWaitForRequest (TimeSpan timeout, AsyncCallback callback, object state) { if (wait_delegate == null) - wait_delegate = new WaitDelegate (WaitForRequest); + wait_delegate = new Func<TimeSpan,bool> (WaitForRequest); return wait_delegate.BeginInvoke (timeout, callback, state); } @@ -163,28 +177,36 @@ namespace System.ServiceModel.Channels return recv_delegate.EndInvoke (result); } + Action<TimeSpan> open_delegate, close_delegate; + protected override IAsyncResult OnBeginOpen (TimeSpan timeout, AsyncCallback callback, object state) { - throw new NotImplementedException (); + if (open_delegate == null) + open_delegate = new Action<TimeSpan> (OnOpen); + return open_delegate.BeginInvoke (timeout, callback, state); } protected override void OnEndOpen (IAsyncResult result) { - throw new NotImplementedException (); + if (open_delegate == null) + throw new InvalidOperationException ("async open operation has not started"); + open_delegate.EndInvoke (result); } - [MonoTODO] protected override IAsyncResult OnBeginClose (TimeSpan timeout, AsyncCallback callback, object state) { - throw new NotImplementedException (); + if (close_delegate == null) + close_delegate = new Action<TimeSpan> (OnClose); + return close_delegate.BeginInvoke (timeout, callback, state); } - [MonoTODO] protected override void OnEndClose (IAsyncResult result) { - throw new NotImplementedException (); + if (close_delegate == null) + throw new InvalidOperationException ("async close operation has not started"); + close_delegate.EndInvoke (result); } } } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpReplyChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpReplyChannel.cs index cd5b0d33756..e0a01b57024 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpReplyChannel.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TcpReplyChannel.cs @@ -36,7 +36,7 @@ using System.Threading; namespace System.ServiceModel.Channels { - internal class TcpReplyChannel : ReplyChannelBase + internal class TcpReplyChannel : InternalReplyChannelBase { TcpClient client; TcpChannelInfo info; @@ -127,10 +127,6 @@ namespace System.ServiceModel.Channels throw new NotImplementedException (); } - public override EndpointAddress LocalAddress { - get { throw new NotImplementedException (); } - } - protected override void OnClose (TimeSpan timeout) { } |