From 6c8bf2ee6795feecc7d94500d7d7ba9b8209d10a Mon Sep 17 00:00:00 2001 From: Maciek Borzecki Date: Thu, 1 Jun 2017 22:57:02 +0200 Subject: [PATCH] devicechannel, device: channel close need not be async --- src/mconnect/device.vala | 20 +++++++++++++------- src/mconnect/devicechannel.vala | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/mconnect/device.vala b/src/mconnect/device.vala index 2fefd13..79bc681 100644 --- a/src/mconnect/device.vala +++ b/src/mconnect/device.vala @@ -201,10 +201,9 @@ class Device : Object { * Deactivate device */ public void deactivate() { - if (_channel != null) - _channel.close.begin((c) => { - channel_closed_cleanup(); - }); + if (_channel != null) { + close_and_cleanup(); + } } /** @@ -285,6 +284,10 @@ class Device : Object { assert(pkt.pkt_type == Packet.PAIR); bool pair = pkt.body.get_boolean_member("pair"); + + debug("pair in progress: %s is paired: %s pair: %s", + _pair_in_progress.to_string(), this.is_paired.to_string(), + pair.to_string()); if (_pair_in_progress == true) { // response to host initiated pairing if (pair == true) { @@ -319,9 +322,12 @@ class Device : Object { private void handle_disconnect() { // channel got disconnected debug("channel disconnected"); - _channel.close.begin((c) => { - channel_closed_cleanup(); - }); + close_and_cleanup(); + } + + private void close_and_cleanup() { + _channel.close(); + channel_closed_cleanup(); } /** diff --git a/src/mconnect/devicechannel.vala b/src/mconnect/devicechannel.vala index d61cbe5..493ddc7 100644 --- a/src/mconnect/devicechannel.vala +++ b/src/mconnect/devicechannel.vala @@ -118,7 +118,7 @@ class DeviceChannel : Object { return true; } - public async void close() { + public void close() { debug("closing connection"); if (_srcid > 0) {