Allow return null from ConnectionListener.AcceptAsync (#41442)
authorNatalia Kondratyeva <knatalia@microsoft.com>
Thu, 27 Aug 2020 16:20:54 +0000 (19:20 +0300)
committerGitHub <noreply@github.com>
Thu, 27 Aug 2020 16:20:54 +0000 (19:20 +0300)
Changed API as it was proposed and approved in #41304

Closes #41304

src/libraries/System.Net.Connections/ref/System.Net.Connections.cs
src/libraries/System.Net.Connections/src/System/Net/Connections/ConnectionListener.cs

index ae1b002..1e8e72c 100644 (file)
@@ -52,7 +52,7 @@ namespace System.Net.Connections
         protected ConnectionListener() { }
         public abstract System.Net.Connections.IConnectionProperties ListenerProperties { get; }
         public abstract System.Net.EndPoint? LocalEndPoint { get; }
-        public abstract System.Threading.Tasks.ValueTask<System.Net.Connections.Connection> AcceptAsync(System.Net.Connections.IConnectionProperties? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+        public abstract System.Threading.Tasks.ValueTask<System.Net.Connections.Connection?> AcceptAsync(System.Net.Connections.IConnectionProperties? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
         public void Dispose() { }
         protected virtual void Dispose(bool disposing) { }
         public System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
index 299ba0d..e01b92a 100644 (file)
@@ -27,7 +27,7 @@ namespace System.Net.Connections
         /// <param name="options">Options used to create the connection, if any.</param>
         /// <param name="cancellationToken">A token used to cancel the asynchronous operation.</param>
         /// <returns>A <see cref="ValueTask{TResult}"/> for the <see cref="Connection"/>.</returns>
-        public abstract ValueTask<Connection> AcceptAsync(IConnectionProperties? options = null, CancellationToken cancellationToken = default);
+        public abstract ValueTask<Connection?> AcceptAsync(IConnectionProperties? options = null, CancellationToken cancellationToken = default);
 
         public void Dispose()
         {