Skip to content

Commit

Permalink
fix: correct writable checks (#147)
Browse files Browse the repository at this point in the history
fix: correct writable checks
  • Loading branch information
devotox authored and trs committed Feb 21, 2019
1 parent 8c8f392 commit 03ff982
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/commands/registration/stor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {

const destroyConnection = (connection, reject) => (err) => {
if (connection) {
if (connection.writeable) connection.end();
if (connection.writable) connection.end();
connection.destroy(err);
}
reject(err);
Expand All @@ -36,7 +36,7 @@ module.exports = {
const socketPromise = new Promise((resolve, reject) => {
this.connector.socket.on('data', (data) => {
if (this.connector.socket) this.connector.socket.pause();
if (stream) {
if (stream && stream.writable) {
stream.write(data, this.transferType, () => this.connector.socket && this.connector.socket.resume());
}
});
Expand Down

0 comments on commit 03ff982

Please sign in to comment.