Skip to content

Update to hyper 0.12#91

Merged
softprops merged 10 commits intosoftprops:masterfrom
abusch:update-to-hyper-0.12
Sep 30, 2018
Merged

Update to hyper 0.12#91
softprops merged 10 commits intosoftprops:masterfrom
abusch:update-to-hyper-0.12

Conversation

@abusch
Copy link
Copy Markdown
Contributor

@abusch abusch commented Sep 24, 2018

This builds upon @dylanmckay's branch that did most of the work. I've bumped hyperlocal to 0.6, removed the dependency on tokio_core, and now store an instance of Runtime in Transport instead of creating a new one for every request. I'm not sure which of these changes did it, but it fixes the hangs I was having with this branch.

Copy link
Copy Markdown
Contributor

@dylanmckay dylanmckay left a comment

Choose a reason for hiding this comment

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

left a few minor comments, mostly typos

Double checked all newly-added dependencies and it looks like they all still refer to the most up-to-date version of the package (it's been a while since the patch was first written).

Looking nice.

Comment thread src/lib.rs Outdated
}
}

/// Creates a new docker instance for a dockr host
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/dockr/docker, it's potentially my typo originally though

Comment thread src/transport.rs Outdated
runtime: RefCell<Runtime>,
host: String,
},
/// TCP/TLS.w
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

trailing w

Comment thread src/transport.rs Outdated
} else {
None
fn get_error_message(res: Response<Body>) -> Option<String> {
let chunk = match res.into_body().concat2().wait() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Most of the other wait calls have been replaced with self.runtime().block_on(req) - should this one be too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hmm, I guess so?

Comment thread src/transport.rs Outdated
use std::io::{Read, Write};
use tokio::runtime::Runtime;

trait InteractiveStream : Read + Write { }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suspect this might be left over from when I first split this PR out from some related shiplift changes, it doesn't look used.

@abusch
Copy link
Copy Markdown
Contributor Author

abusch commented Sep 24, 2018

Thanks for the review! I think I've addressed all the comments.

@dylanmckay
Copy link
Copy Markdown
Contributor

Perfect, those four comments have all been fixed

@abusch
Copy link
Copy Markdown
Contributor Author

abusch commented Sep 25, 2018

@softprops what say you? Do you think this can be merge?

@softprops
Copy link
Copy Markdown
Owner

It's been a while. I'm going to try to fold as much as I can into a new release including this

@softprops
Copy link
Copy Markdown
Owner

Can you fix up the remaining merge conflicts. I'll merge after and try to roll up a release

@abusch
Copy link
Copy Markdown
Contributor Author

abusch commented Sep 29, 2018

Alright, I've merged master in this branch and resolved the conflicts. It builds and the tests pass both with and without the feature.
(not to self: I should put SSL support behind a feature flag as well...)

@softprops softprops merged commit 074b6db into softprops:master Sep 30, 2018
Comment thread src/transport.rs
| StatusCode::CREATED
| StatusCode::SWITCHING_PROTOCOLS => {
let chunk =
self.runtime().block_on(res.into_body().concat2())?;
Copy link
Copy Markdown

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 correctly handles the case where a stream never ends; when reading from an endpoint like /events the return is never hit. Instead of storing data in memory and returning a Cursor over a vec, this method should instead return a Read that blocks for u8 as they come in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I suspect you're correct... The whole wrapping of Hyper's async API in a synchronous API is quite clunky unfortunately :( Ideally this would return a Stream<Vec<u8>> or similar, and I'm slowly working towards this in a branch but I'm not there yet... I'm not sure how to fix this until then, so I'm open to ideas :)

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.

4 participants