From bb024247990062ec79ca1d1e2577818c6889c017 Mon Sep 17 00:00:00 2001 From: Maciek Borzecki Date: Tue, 27 Jun 2017 21:59:33 +0200 Subject: [PATCH] mconnect/utils: put helper code inside Utils namespace --- src/mconnect/device.vala | 14 ++++++++------ src/mconnect/devicechannel.vala | 2 +- src/mconnect/discovereddevice.vala | 8 ++++---- src/mconnect/transfer-download.vala | 2 +- src/mconnect/utils.vala | 5 +++++ 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/mconnect/device.vala b/src/mconnect/device.vala index 5337af5..9bb6376 100644 --- a/src/mconnect/device.vala +++ b/src/mconnect/device.vala @@ -178,15 +178,17 @@ class Device : Object { * Generates a unique string for this device */ public string to_unique_string() { - return make_unique_device_string(this.device_id, - this.device_name, - this.device_type, - this.protocol_version); + return Utils.make_unique_device_string(this.device_id, + this.device_name, + this.device_type, + this.protocol_version); } public string to_string() { - return make_device_string(this.device_id, this.device_name, - this.device_type, this.protocol_version); + return Utils.make_device_string(this.device_id, + this.device_name, + this.device_type, + this.protocol_version); } /** diff --git a/src/mconnect/devicechannel.vala b/src/mconnect/devicechannel.vala index 98ca502..36cbcf3 100644 --- a/src/mconnect/devicechannel.vala +++ b/src/mconnect/devicechannel.vala @@ -49,7 +49,7 @@ class DeviceChannel : Object { } private static void fixup_socket(Socket sock) { - socket_set_keepalive(sock); + Utils.socket_set_keepalive(sock); } private void replace_streams(InputStream input, OutputStream output) { diff --git a/src/mconnect/discovereddevice.vala b/src/mconnect/discovereddevice.vala index 587624f..15a7dfd 100644 --- a/src/mconnect/discovereddevice.vala +++ b/src/mconnect/discovereddevice.vala @@ -73,10 +73,10 @@ class DiscoveredDevice : Object { } public string to_unique_string() { - return make_unique_device_string(this.device_id, - this.device_name, - this.device_type, - this.protocol_version); + return Utils.make_unique_device_string(this.device_id, + this.device_name, + this.device_type, + this.protocol_version); } } \ No newline at end of file diff --git a/src/mconnect/transfer-download.vala b/src/mconnect/transfer-download.vala index bff0bbc..560650b 100644 --- a/src/mconnect/transfer-download.vala +++ b/src/mconnect/transfer-download.vala @@ -57,7 +57,7 @@ class DownloadTransfer : Object { this.conn = sc.connect_async.end(res); var sock = this.conn.get_socket(); - socket_set_keepalive(sock); + Utils.socket_set_keepalive(sock); this.start_transfer(); } catch (Error e) { diff --git a/src/mconnect/utils.vala b/src/mconnect/utils.vala index d59e292..e945cfe 100644 --- a/src/mconnect/utils.vala +++ b/src/mconnect/utils.vala @@ -17,6 +17,9 @@ * AUTHORS * Maciek Borzecki */ + +namespace Utils { + using Posix; /** @@ -87,3 +90,5 @@ void socket_set_keepalive(Socket sock) { // enable keepalive sock.set_keepalive(true); } + +} \ No newline at end of file