Skip to content

[manual] Merge release/9.0-staging into release/9.0 (second pass) #111422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 14, 2025
Merged
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
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
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
Loading