public SslManagedSocketConnection(BsdContext bsdContext, SslVersion sslVersion, int socketFd, ISocket socket) { _bsdContext = bsdContext; _sslVersion = sslVersion; SocketFd = socketFd; Socket = socket; }
// SetSocketDescriptor(u32) -> u32 public ResultCode SetSocketDescriptor(ServiceCtx context) { if (_connection != null) { return(ResultCode.AlreadyInUse); } _bsdContext = BsdContext.GetContext(_processId); if (_bsdContext == null) { return(ResultCode.InvalidSocket); } int inputFd = context.RequestData.ReadInt32(); int internalFd = _bsdContext.DuplicateFileDescriptor(inputFd); if (internalFd == -1) { return(ResultCode.InvalidSocket); } InitializeConnection(internalFd); int outputFd = inputFd; if (_doNotClockSocket) { outputFd = -1; } context.ResponseData.Write(outputFd); return(ResultCode.Success); }