public static AcceptSocket Bind(FileHandleEndPoint fileHandleEndPoint, ChannelWriter <ConnectionContext> acceptQueue, IoUringOptions options) { LinuxSocket s = (int)fileHandleEndPoint.FileHandle; var endPoint = s.GetLocalAddress(); return(new AcceptSocket(s, endPoint ?? fileHandleEndPoint, acceptQueue, null, options, null)); }
public async Task SocketTransportCallsCreateBoundListenSocketForFileHandleEndpoint() { using var fileHandleSocket = CreateBoundSocket(); var endpoint = new FileHandleEndPoint((ulong)fileHandleSocket.Handle, FileHandleType.Auto); await VerifySocketTransportCallsCreateBoundListenSocketAsync(endpoint); }
public EndPoint Bind(FileHandleEndPoint fileHandleEndPoint, ChannelWriter <ConnectionContext> acceptQueue) { var context = AcceptSocket.Bind(fileHandleEndPoint, acceptQueue, _options); Bind(context); return(context.EndPoint); }
internal virtual string GetDisplayName() { return(EndPoint switch { IPEndPoint _ => $"{Scheme}://{IPEndPoint}", UnixDomainSocketEndPoint _ => $"{Scheme}://unix:{EndPoint}", FileHandleEndPoint _ => $"{Scheme}://<file handle>", _ => throw new InvalidOperationException() });
/// <summary> /// Creates the socket used to listen for incoming connections /// </summary> private UvStreamHandle CreateListenSocket() { return(EndPoint switch { IPEndPoint _ => ListenTcp(false), UnixDomainSocketEndPoint _ => ListenPipe(false), FileHandleEndPoint _ => ListenHandle(), _ => throw new NotSupportedException() });
public void CreateDefaultBoundListenSocket_PreservesLocalEndpointFromFileHandleEndpoint() { using var fileHandleSocket = CreateBoundSocket(); var endpoint = new FileHandleEndPoint((ulong)fileHandleSocket.Handle, FileHandleType.Auto); using var listenSocket = SocketTransportOptions.CreateDefaultBoundListenSocket(endpoint); Assert.NotNull(fileHandleSocket.LocalEndPoint); Assert.Equal(fileHandleSocket.LocalEndPoint, listenSocket.LocalEndPoint); }
private UvStreamHandle ListenHandle() { var handleEndPoint = (FileHandleEndPoint)EndPoint; switch (handleEndPoint.FileHandleType) { case FileHandleType.Auto: break; case FileHandleType.Tcp: return(ListenTcp(useFileHandle: true)); case FileHandleType.Pipe: return(ListenPipe(useFileHandle: true)); default: throw new NotSupportedException(); } UvStreamHandle handle; try { handle = ListenTcp(useFileHandle: true); EndPoint = new FileHandleEndPoint(handleEndPoint.FileHandle, FileHandleType.Tcp); return(handle); } catch (UvException exception) when(exception.StatusCode == LibuvConstants.ENOTSUP) { Log.LogDebug(0, exception, "Listener.ListenHandle"); } handle = ListenPipe(useFileHandle: true); EndPoint = new FileHandleEndPoint(handleEndPoint.FileHandle, FileHandleType.Pipe); return(handle); }
internal ListenOptions(ulong fileHandle, FileHandleType handleType) { EndPoint = new FileHandleEndPoint(fileHandle, handleType); }