Skip to content

Commit

Permalink
msg.finished is only finished if socket has been detached
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Jun 24, 2019
1 parent 08345db commit 7c8d7f3
Show file tree
Hide file tree
Showing 2 changed files with 1,533 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ function isFinished (msg) {

if (typeof msg.finished === 'boolean') {
// OutgoingMessage
return Boolean(msg.finished || (socket && !socket.writable))
return Boolean(
(!socket && msg.finished && msg.outputSize === 0) ||
(socket && !socket.writable) ||
(msg.stream && msg.stream.closed)
)
}

if (typeof msg.complete === 'boolean') {
Expand Down
Loading

0 comments on commit 7c8d7f3

Please sign in to comment.