[gnome] Fix version for gjsosk and gsconnect, add impatience
This commit is contained in:
@ -2,15 +2,23 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
const GObject = imports.gi.GObject;
|
||||
|
||||
const Config = imports.config;
|
||||
const Core = imports.service.core;
|
||||
import Config from '../../config.js';
|
||||
import * as Core from '../core.js';
|
||||
|
||||
// Retain compatibility with GLib < 2.80, which lacks GioUnix
|
||||
let GioUnix;
|
||||
try {
|
||||
GioUnix = (await import('gi://GioUnix')).default;
|
||||
} catch (e) {
|
||||
GioUnix = {
|
||||
InputStream: Gio.UnixInputStream,
|
||||
OutputStream: Gio.UnixOutputStream,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* TCP Port Constants
|
||||
@ -25,7 +33,7 @@ const TRANSFER_MAX = 1764;
|
||||
/*
|
||||
* One-time check for Linux/FreeBSD socket options
|
||||
*/
|
||||
var _LINUX_SOCKETS = true;
|
||||
export let _LINUX_SOCKETS = true;
|
||||
|
||||
try {
|
||||
// This should throw on FreeBSD
|
||||
@ -44,7 +52,7 @@ try {
|
||||
*
|
||||
* @param {Gio.SocketConnection} connection - The connection to configure
|
||||
*/
|
||||
function _configureSocket(connection) {
|
||||
export function _configureSocket(connection) {
|
||||
try {
|
||||
if (_LINUX_SOCKETS) {
|
||||
connection.socket.set_option(6, 4, 10); // TCP_KEEPIDLE
|
||||
@ -78,7 +86,7 @@ function _configureSocket(connection) {
|
||||
* include the TCP port, while the IP address is taken from the UDP packet
|
||||
* itself. We respond by opening a TCP connection to that address.
|
||||
*/
|
||||
var ChannelService = GObject.registerClass({
|
||||
export const ChannelService = GObject.registerClass({
|
||||
GTypeName: 'GSConnectLanChannelService',
|
||||
Properties: {
|
||||
'certificate': GObject.ParamSpec.object(
|
||||
@ -264,7 +272,7 @@ var ChannelService = GObject.registerClass({
|
||||
|
||||
// Input stream
|
||||
this._udp6_stream = new Gio.DataInputStream({
|
||||
base_stream: new Gio.UnixInputStream({
|
||||
base_stream: new GioUnix.InputStream({
|
||||
fd: this._udp6.fd,
|
||||
close_fd: false,
|
||||
}),
|
||||
@ -296,7 +304,7 @@ var ChannelService = GObject.registerClass({
|
||||
|
||||
// Input stream
|
||||
this._udp4_stream = new Gio.DataInputStream({
|
||||
base_stream: new Gio.UnixInputStream({
|
||||
base_stream: new GioUnix.InputStream({
|
||||
fd: this._udp4.fd,
|
||||
close_fd: false,
|
||||
}),
|
||||
@ -527,7 +535,7 @@ var ChannelService = GObject.registerClass({
|
||||
* This class essentially just extends Core.Channel to set TCP socket options
|
||||
* and negotiate TLS encrypted connections.
|
||||
*/
|
||||
var Channel = GObject.registerClass({
|
||||
export const Channel = GObject.registerClass({
|
||||
GTypeName: 'GSConnectLanChannel',
|
||||
}, class LanChannel extends Core.Channel {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user