Browse Source

devicechannel, device: channel close need not be async

bboozzoo/dbus-support-interfaces
Maciek Borzecki 8 years ago
parent
commit
6c8bf2ee67
2 changed files with 14 additions and 8 deletions
  1. +13
    -7
      src/mconnect/device.vala
  2. +1
    -1
      src/mconnect/devicechannel.vala

+ 13
- 7
src/mconnect/device.vala View File

@ -201,10 +201,9 @@ class Device : Object {
* Deactivate device * Deactivate device
*/ */
public void deactivate() { 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); assert(pkt.pkt_type == Packet.PAIR);
bool pair = pkt.body.get_boolean_member("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) { if (_pair_in_progress == true) {
// response to host initiated pairing // response to host initiated pairing
if (pair == true) { if (pair == true) {
@ -319,9 +322,12 @@ class Device : Object {
private void handle_disconnect() { private void handle_disconnect() {
// channel got disconnected // channel got disconnected
debug("channel disconnected"); debug("channel disconnected");
_channel.close.begin((c) => {
channel_closed_cleanup();
});
close_and_cleanup();
}
private void close_and_cleanup() {
_channel.close();
channel_closed_cleanup();
} }
/** /**


+ 1
- 1
src/mconnect/devicechannel.vala View File

@ -118,7 +118,7 @@ class DeviceChannel : Object {
return true; return true;
} }
public async void close() {
public void close() {
debug("closing connection"); debug("closing connection");
if (_srcid > 0) { if (_srcid > 0) {


Loading…
Cancel
Save