Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static partial class Sys
{
[Flags]
internal enum HandleEvents : int
{
None = 0x00,
Read = 0x01,
Write = 0x02,
ReadClose = 0x04,
Close = 0x08,
Error = 0x10
}

[StructLayout(LayoutKind.Sequential)]
internal struct HandleEvent
{
public IntPtr Data;
public HandleEvents Events;
private int _padding;
}

[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_CreateHandleEventPort")]
internal static unsafe partial Error CreateHandleEventPort(IntPtr* port);

[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_CloseHandleEventPort")]
internal static partial Error CloseHandleEventPort(IntPtr port);

[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_CreateHandleEventBuffer")]
internal static unsafe partial Error CreateHandleEventBuffer(int count, HandleEvent** buffer);

[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_FreeHandleEventBuffer")]
internal static unsafe partial Error FreeHandleEventBuffer(HandleEvent* buffer);

[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_TryChangeHandleEventRegistration")]
internal static partial Error TryChangeHandleEventRegistration(IntPtr port, SafeHandle socket, HandleEvents currentEvents, HandleEvents newEvents, IntPtr data);

[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_TryChangeHandleEventRegistration")]
internal static partial Error TryChangeHandleEventRegistration(IntPtr port, IntPtr socket, HandleEvents currentEvents, HandleEvents newEvents, IntPtr data);

[LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_WaitForHandleEvents")]
internal static unsafe partial Error WaitForHandleEvents(IntPtr port, HandleEvent* buffer, int* count);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static partial class Interop
internal static partial class Sys
{
[Flags]
internal enum SocketEvents : int
internal enum HandleEvents : int
{
None = 0x00,
Read = 0x01,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
<!-- Don't generate [assembly: SupportedOSPlatform] from the TFM.
The attribute does not exist on ref assemblies and it causes false CA1416 warnings when projects reference CoreLib directly. -->
<GenerateSupportedOSPlatformAttribute>false</GenerateSupportedOSPlatformAttribute>
</PropertyGroup>

<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
System.Net.Internals namespace. -->
<DefineConstants>$(DefineConstants);SYSTEM_NET_PRIMITIVES_DLL</DefineConstants>
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
<!-- Don't generate [assembly: SupportedOSPlatform] from the TFM.
The attribute does not exist on ref assemblies and it causes false CA1416 warnings when projects reference CoreLib directly. -->
<GenerateSupportedOSPlatformAttribute>false</GenerateSupportedOSPlatformAttribute>
</PropertyGroup>

<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,10 @@

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'wasi'">
<Compile Include="System\Net\Sockets\UnixDomainSocketEndPoint.Wasi.cs" />
<Compile Include="System\Net\Sockets\SocketAsyncContext.Wasi.cs" />
<Compile Include="System\Net\Sockets\SocketAsyncEngine.Wasi.cs"/>
<Compile Include="System\Net\Sockets\SocketPal.Wasi.cs" />
<Compile Include="$(CommonPath)Interop\Wasi\System.Native\Interop.SocketEvent.cs"
Link="Common\Interop\Wasi\System.Native\Interop.SocketEvent.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'unix' or '$(TargetPlatformIdentifier)' == 'osx' or '$(TargetPlatformIdentifier)' == 'ios' or '$(TargetPlatformIdentifier)' == 'tvos'">
<Compile Include="System\Net\Sockets\UnixDomainSocketEndPoint.Unix.cs"/>
<Compile Include="System\Net\Sockets\SocketAsyncEngine.Unix.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.SocketEvent.cs"
Link="Common\Interop\Unix\System.Native\Interop.SocketEvent.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'unix' or '$(TargetPlatformIdentifier)' == 'wasi' or '$(TargetPlatformIdentifier)' == 'osx' or '$(TargetPlatformIdentifier)' == 'ios' or '$(TargetPlatformIdentifier)' == 'tvos'">
Expand Down Expand Up @@ -327,6 +319,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' != 'windows'">
<ProjectReference Include="$(CoreLibProject)" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Threading.Thread\src\System.Threading.Thread.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private enum Flags : byte
#endif
}

private Flags _flags = Flags.IsSocket | (SocketAsyncEngine.InlineSocketCompletionsEnabled ? Flags.PreferInlineCompletions : 0);
private Flags _flags = Flags.IsSocket | (SocketAsyncContext.InlineSocketCompletionsEnabled ? Flags.PreferInlineCompletions : 0);

private void SetFlag(Flags flag, bool value)
{
Expand Down Expand Up @@ -60,7 +60,11 @@ internal bool ExposedHandleOrUntrackedConfiguration
internal bool PreferInlineCompletions
{
get => (_flags & Flags.PreferInlineCompletions) != 0;
set => SetFlag(Flags.PreferInlineCompletions, value);
set
{
SetFlag(Flags.PreferInlineCompletions, value);
AsyncContext.SetInlineCompletions(value);
}
}

// (ab)use Socket class for performing async I/O on non-socket fds.
Expand Down Expand Up @@ -98,6 +102,7 @@ internal void TransferTrackedState(SafeSocketHandle target)
target.DualMode = DualMode;
target.ExposedHandleOrUntrackedConfiguration = ExposedHandleOrUntrackedConfiguration;
target.IsSocket = IsSocket;
target.PreferInlineCompletions = PreferInlineCompletions;
#if SYSTEM_NET_SOCKETS_APPLE_PLATFORM
target.TfoEnabled = TfoEnabled;
#endif
Expand Down
Loading
Loading