Skip to content

Commit

Permalink
Fix abort() getting stuck when being passed a reference
Browse files Browse the repository at this point in the history
- It was possible to pass a reference to data_stream, instead of
  ownership, which the code intended.
- Require 'static, ie. normal references cannot be passed anymore.
- Could stop old, buggy code from compiling.
  • Loading branch information
clonejo committed Jan 3, 2024
1 parent 3251558 commit e0fb49d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion suppaftp/src/async_ftp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ where
/// abort the previous FTP service command
pub async fn abort<R>(&mut self, data_stream: R) -> FtpResult<()>
where
R: Read + std::marker::Unpin,
R: Read + std::marker::Unpin + 'static,
{
debug!("Aborting active file transfer");
self.perform(Command::Abor).await?;
Expand Down
2 changes: 1 addition & 1 deletion suppaftp/src/sync_ftp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ where
}

/// abort the previous FTP service command
pub fn abort(&mut self, data_stream: impl Read) -> FtpResult<()> {
pub fn abort(&mut self, data_stream: impl Read + 'static) -> FtpResult<()> {
debug!("Aborting active file transfer");
self.perform(Command::Abor)?;
// Drop stream NOTE: must be done first, otherwise server won't return any response
Expand Down

0 comments on commit e0fb49d

Please sign in to comment.