Skip to content

Commit

Permalink
Merge commit '63cb882afa85ee0160999ab1c0b727e866a29aef'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirroring committed Jan 14, 2025
2 parents 5994663 + 63cb882 commit be62441
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3602,15 +3602,15 @@ internal void InternalSetBlocking(bool desired)
}

// CreateAcceptSocket - pulls unmanaged results and assembles them into a new Socket object.
internal Socket CreateAcceptSocket(SafeSocketHandle fd, EndPoint remoteEP)
internal Socket CreateAcceptSocket(SafeSocketHandle fd, EndPoint? remoteEP)
{
// Internal state of the socket is inherited from listener.
Debug.Assert(fd != null && !fd.IsInvalid);
Socket socket = new Socket(fd, loadPropertiesFromHandle: false);
return UpdateAcceptSocket(socket, remoteEP);
}

internal Socket UpdateAcceptSocket(Socket socket, EndPoint remoteEP)
internal Socket UpdateAcceptSocket(Socket socket, EndPoint? remoteEP)
{
// Internal state of the socket is inherited from listener.
socket._addressFamily = _addressFamily;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ private void CompleteAcceptOperation(IntPtr acceptedFileDescriptor, Memory<byte>
_acceptedFileDescriptor = acceptedFileDescriptor;
if (socketError == SocketError.Success)
{
Debug.Assert(socketAddress.Length > 0);
_acceptAddressBufferCount = socketAddress.Length;
}
else
Expand Down Expand Up @@ -348,9 +347,10 @@ private SocketError FinishOperationAccept(SocketAddress remoteSocketAddress)
new ReadOnlySpan<byte>(_acceptBuffer, 0, _acceptAddressBufferCount).CopyTo(remoteSocketAddress.Buffer.Span);
remoteSocketAddress.Size = _acceptAddressBufferCount;

// on macOS accept can sometimes return empty remote address even when it returns successfully.
Socket acceptedSocket = _currentSocket!.CreateAcceptSocket(
SocketPal.CreateSocket(_acceptedFileDescriptor),
_currentSocket._rightEndPoint!.Create(remoteSocketAddress));
remoteSocketAddress.Size > 0 ? _currentSocket._rightEndPoint!.Create(remoteSocketAddress) : null);
if (_acceptSocket is null)
{
// Store the accepted socket
Expand Down
1 change: 1 addition & 0 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ JS_ENGINES = [NODE_JS]
<ItemGroup Condition="'$(AotHostOS)' == 'linux'">
<_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib/libclang.so" Condition=" Exists('$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib/libclang.so') "/>
<_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib64/libclang.so.*" Condition=" '$(_LibClang)' == '' "/>
<_LibClang Include="/usr/local/lib/libclang.so" Condition="'$(_LibClang)' == ''" />
</ItemGroup>
<PropertyGroup Condition="'$(TargetsLinux)' == 'true' and '$(Platform)' == 'arm64'">
<MonoUseCrossTool>true</MonoUseCrossTool>
Expand Down
5 changes: 5 additions & 0 deletions src/native/libs/System.Native/pal_networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,11 @@ int32_t SystemNative_Connect(intptr_t socket, uint8_t* socketAddress, int32_t so
return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno);
}

#if defined(__linux__) && !defined(TCP_FASTOPEN_CONNECT)
// fixup if compiled against old Kernel headers.
// Can be removed once we have at least 4.11
#define TCP_FASTOPEN_CONNECT 30
#endif
int32_t SystemNative_Connectx(intptr_t socket, uint8_t* socketAddress, int32_t socketAddressLen, uint8_t* data, int32_t dataLen, int32_t tfo, int* sent)
{
if (socketAddress == NULL || socketAddressLen < 0 || sent == NULL)
Expand Down
2 changes: 2 additions & 0 deletions src/tests/JIT/Directed/tls/TestTLSWithLoadedDlls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<ReferenceXUnitWrapperGenerator>false</ReferenceXUnitWrapperGenerator>
<NativeAotIncompatible>true</NativeAotIncompatible>
<!-- Tracking issue: https://github.com/dotnet/runtime/issues/92129 -->
<CLRTestTargetUnsupported Condition="'$(TargetsAppleMobile)' == 'true'">true</CLRTestTargetUnsupported>
</PropertyGroup>
<PropertyGroup>
<DebugType>PdbOnly</DebugType>
Expand Down

0 comments on commit be62441

Please sign in to comment.