Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lan: fix uncaught promise rejection #1609

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/service/backends/lan.js
Original file line number Diff line number Diff line change
Expand Up @@ -854,10 +854,9 @@ var Channel = GObject.registerClass({
reject(e);
}
});
});
}).then(this._encryptClient.bind(this));

let connection = await openConnection;
connection = await this._encryptClient(connection);
const connection = await openConnection;
const source = connection.get_input_stream();

// Start the transfer
Expand Down Expand Up @@ -911,17 +910,17 @@ var Channel = GObject.registerClass({
}
}
);
});
}).then(this._encryptServer.bind(this));

// Notify the device we're ready
// Create an upload request
packet.body.payloadHash = this.checksum;
packet.payloadSize = size;
packet.payloadTransferInfo = {port: port};
this.sendPacket(new Core.Packet(packet));
const requestUpload = this.sendPacket(new Core.Packet(packet));

// Accept the connection and configure the channel
let connection = await acceptConnection;
connection = await this._encryptServer(connection);
// Request an upload stream, accept the connection and get the output
const [, connection] = await Promise.all([requestUpload,
acceptConnection]);
const target = connection.get_output_stream();

// Start the transfer
Expand Down