Skip to content

Commit

Permalink
fix send return
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Lee committed Dec 31, 2024
1 parent 79a6407 commit 6442d41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/net/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,6 @@ impl BluefinConnection {

#[inline]
pub fn send(&mut self, buf: &[u8]) -> BluefinResult<usize> {
// TODO! This returns the total bytes sent (including bluefin payload). This
// really should only return the total payload bytes
self.writer_handler.send_data(buf)?;
Ok(buf.len())
self.writer_handler.send_data(buf)
}
}
4 changes: 2 additions & 2 deletions src/worker/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl WriterHandler {
}

#[inline]
pub(crate) fn send_data(&self, payload: &[u8]) -> BluefinResult<()> {
pub(crate) fn send_data(&self, payload: &[u8]) -> BluefinResult<usize> {
match self.data_sender {
Some(ref sender) => {
if let Err(e) = sender.send(payload.to_vec()) {
Expand All @@ -83,7 +83,7 @@ impl WriterHandler {
e
)));

Check warning on line 84 in src/worker/writer.rs

View check run for this annotation

Codecov / codecov/patch

src/worker/writer.rs#L81-L84

Added lines #L81 - L84 were not covered by tests
}
Ok(())
Ok(payload.len())
}
None => Err(BluefinError::WriteError(

Check warning on line 88 in src/worker/writer.rs

View check run for this annotation

Codecov / codecov/patch

src/worker/writer.rs#L88

Added line #L88 was not covered by tests
"Sender is not available. Cannot send.".to_string(),
Expand Down

0 comments on commit 6442d41

Please sign in to comment.