Skip to content

Commit

Permalink
Fix 451-Error during read from data connection (#212)
Browse files Browse the repository at this point in the history
Update event for closing/destroying the socket for uploads from finish to end

Fixes #205
  • Loading branch information
cjsewell committed Jul 6, 2022
1 parent e1acee0 commit 5d680f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export function uploadFrom(source: Readable, config: TransferConfig): Promise<FT
onConditionOrEvent(canUpload, dataSocket, "secureConnect", () => {
config.ftp.log(`Uploading to ${describeAddress(dataSocket)} (${describeTLS(dataSocket)})`)
resolver.onDataStart(config.remotePath, config.type)
source.pipe(dataSocket).once("finish", () => {
source.pipe(dataSocket).once("end", () => {
dataSocket.destroy() // Explicitly close/destroy the socket to signal the end.
resolver.onDataDone(task)
})
Expand Down

0 comments on commit 5d680f7

Please sign in to comment.