Skip to content

Commit

Permalink
fix: #75 Make function connect_with_stream public
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed May 18, 2024
1 parent 18bbcc5 commit 93620e8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

- [Changelog](#changelog)
- [5.4.0](#540)
- [5.3.1](#531)
- [5.3.0](#530)
- [5.2.2](#522)
Expand Down Expand Up @@ -31,6 +32,13 @@

---

## 5.4.0

Released on 18/05/2024

- [Issue 75](https://github.com/veeso/suppaftp/issues/75): Public access to `connect_with_stream`
- [PR 78](https://github.com/veeso/suppaftp/pull/78): Async SSL file uploads not properly closing

## 5.3.1

Released on 28/01/2024
Expand Down
7 changes: 2 additions & 5 deletions suppaftp/src/async_ftp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ where
}

/// Connect using provided configured tcp stream
async fn connect_with_stream(stream: TcpStream) -> FtpResult<Self> {
pub async fn connect_with_stream(stream: TcpStream) -> FtpResult<Self> {
debug!("Established connection with server");
let mut ftp_stream = ImplAsyncFtpStream {
reader: BufReader::new(DataStream::Tcp(stream)),
Expand Down Expand Up @@ -490,10 +490,7 @@ where
pub async fn finalize_put_stream(&mut self, mut stream: impl Write + Unpin) -> FtpResult<()> {
debug!("Finalizing put stream");
// Drop stream NOTE: must be done first, otherwise server won't return any response
stream
.close()
.await
.map_err(FtpError::ConnectionError)?;
stream.close().await.map_err(FtpError::ConnectionError)?;
drop(stream);
trace!("Stream dropped");
// Read response
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 @@ -72,7 +72,7 @@ where
}

/// Connect using provided configured tcp stream
fn connect_with_stream(stream: TcpStream) -> FtpResult<Self> {
pub fn connect_with_stream(stream: TcpStream) -> FtpResult<Self> {
debug!("Established connection with server");
let mut ftp_stream = Self {
reader: BufReader::new(DataStream::Tcp(stream)),
Expand Down

0 comments on commit 93620e8

Please sign in to comment.