Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Http request to be logged when connection_verbose is set #1737

Merged
merged 3 commits into from Jan 31, 2023

Conversation

phankydn
Copy link
Contributor

Fixes: #1723

Copy link
Owner

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will always work. The first non-empty buf might not be as long as the amount of bytes written. The underlying call could have written from several of the buffers.

@phankydn
Copy link
Contributor Author

@seanmonstar Updated.

Copy link
Owner

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you make a new struct Vectored(_, usize), you can implement fmt::Debug that writes to the formatter in a loop, thus not needing to allocate a new temporary vector.

@phankydn phankydn force-pushed the master branch 3 times, most recently from c99fff9 to 4d40fcb Compare January 22, 2023 11:14
@phankydn
Copy link
Contributor Author

@seanmonstar Thanks for the suggestion. Updated.

src/connect.rs Outdated
Pin::new(&mut self.inner).poll_write_vectored(cx, bufs)
match Pin::new(&mut self.inner).poll_write_vectored(cx, bufs) {
Poll::Ready(Ok(nwritten)) => {
log::trace!("{:08x} write: {:?}", self.id, Vectored { bufs, nwritten });
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking, would it be useful if the log indicated it was a writev? Or "write (vectored)" if people are filtering by "write"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense. Thanks

Copy link
Owner

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for catching this!

@seanmonstar seanmonstar merged commit bdd4db0 into seanmonstar:master Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

connection_verbose does not log outgoing traffic in certain circumstances.
2 participants