Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -34,9 +34,6 @@
namespace System.Net.Sockets {
#if ONLY_1_1
[Serializable]
#endif
public enum AddressFamily {
Unknown = -1,
Unspecified = 0,

View File

@@ -42,9 +42,7 @@ namespace System.Net.Sockets
int in_progress;
internal Socket.Worker Worker;
EndPoint remote_ep;
#if NET_4_0
public Exception ConnectByNameError { get; internal set; }
#endif
public event EventHandler<SocketAsyncEventArgs> Completed;
@@ -82,7 +80,6 @@ namespace System.Net.Sockets
public SocketFlags SocketFlags { get; set; }
public object UserToken { get; set; }
internal Socket curSocket;
#if (NET_2_1 || NET_4_0)
public Socket ConnectSocket {
get {
switch (SocketError) {
@@ -101,7 +98,6 @@ namespace System.Net.Sockets
{
PolicyRestricted = policy;
}
#endif
public SocketAsyncEventArgs ()
{

View File

@@ -952,13 +952,11 @@ namespace System.Net.Sockets {
#endif
}
#if NET_4_5
[MonoTODO ("Currently hardcoded to IPv4. Ideally, support v4/v6 dual-stack.")]
public Socket (SocketType socketType, ProtocolType protocolType)
: this (AddressFamily.InterNetwork, socketType, protocolType)
{
}
#endif
~Socket ()
{
@@ -1188,11 +1186,7 @@ namespace System.Net.Sockets {
}
}
#if NET_4_0
public void Dispose ()
#else
void IDisposable.Dispose ()
#endif
{
Dispose (true);
GC.SuppressFinalize (this);
@@ -1589,7 +1583,6 @@ namespace System.Net.Sockets {
bool GetCheckedIPs (SocketAsyncEventArgs e, out IPAddress [] addresses)
{
addresses = null;
#if NET_4_0
// Connect to the first address that match the host name, like:
// http://blogs.msdn.com/ncl/archive/2009/07/20/new-ncl-features-in-net-4-0-beta-2.aspx
// while skipping entries that do not match the address family
@@ -1601,18 +1594,13 @@ namespace System.Net.Sockets {
e.ConnectByNameError = null;
return false;
}
#else
return false; // < NET_4_0 -> use remote endpoint
#endif
}
bool ConnectAsyncReal (SocketAsyncEventArgs e)
{
bool use_remoteep = true;
#if NET_4_0
IPAddress [] addresses = null;
use_remoteep = !GetCheckedIPs (e, out addresses);
#endif
e.curSocket = this;
Worker w = e.Worker;
w.Init (this, e, SocketOperation.Connect);
@@ -1623,7 +1611,6 @@ namespace System.Net.Sockets {
result.EndPoint = e.RemoteEndPoint;
ares = BeginConnect (e.RemoteEndPoint, SocketAsyncEventArgs.Dispatcher, e);
}
#if NET_4_0
else {
DnsEndPoint dep = (e.RemoteEndPoint as DnsEndPoint);
@@ -1632,7 +1619,6 @@ namespace System.Net.Sockets {
ares = BeginConnect (addresses, dep.Port, SocketAsyncEventArgs.Dispatcher, e);
}
#endif
if (ares.IsCompleted && ares.CompletedSynchronously) {
((SocketAsyncResult) ares).CheckIfThrowDelayedException ();
return false;

View File

@@ -34,9 +34,7 @@
using System;
using System.Net;
#if NET_4_5
using System.Threading.Tasks;
#endif
namespace System.Net.Sockets
{
@@ -428,7 +426,6 @@ namespace System.Net.Sockets
finally { CheckDisposed (); }
}
#if NET_4_5
public Task ConnectAsync (IPAddress address, int port)
{
return Task.Factory.FromAsync (BeginConnect, EndConnect, address, port, null);
@@ -443,7 +440,6 @@ namespace System.Net.Sockets
{
return Task.Factory.FromAsync (BeginConnect, EndConnect, host, port, null);
}
#endif
private void CheckDisposed ()
{
if (disposed)

View File

@@ -38,9 +38,7 @@
using System;
using System.Net;
#if NET_4_5
using System.Threading.Tasks;
#endif
namespace System.Net.Sockets
{
@@ -302,7 +300,6 @@ namespace System.Net.Sockets
Init (AddressFamily.InterNetwork, savedEP);
}
#if NET_4_5
public Task<Socket> AcceptSocketAsync ()
{
return Task<Socket>.Factory.FromAsync (BeginAcceptSocket, EndAcceptSocket, null);
@@ -312,6 +309,5 @@ namespace System.Net.Sockets
{
return Task<TcpClient>.Factory.FromAsync (BeginAcceptTcpClient, EndAcceptTcpClient, null);
}
#endif
}
}

View File

@@ -33,9 +33,7 @@
using System;
using System.Net;
#if NET_4_5
using System.Threading.Tasks;
#endif
namespace System.Net.Sockets
{
@@ -604,7 +602,6 @@ namespace System.Net.Sockets
}
#endregion
#if NET_4_5
public Task<UdpReceiveResult> ReceiveAsync ()
{
@@ -634,7 +631,6 @@ namespace System.Net.Sockets
}, EndSend, t);
}
#endif
}
}