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

Add Send/Sync traits on LookupHost struct #27966

Merged
merged 2 commits into from
Aug 25, 2015

Conversation

GuillaumeGomez
Copy link
Member

Part of #22709.
cc @Veedrac

r? @bluss

I don't have added tests yet, I'll see how to do it tomorrow.

@bluss
Copy link
Member

bluss commented Aug 23, 2015

Hi! Did you find a resource that gives us confidence that this is in fact thread safe? Just wondering if you've found anything interesting.

@GuillaumeGomez
Copy link
Member Author

Not yet, it was just in order to gather people. I totally missed the last discussion you had with others so this time I hope I might be included. :)

@bluss
Copy link
Member

bluss commented Aug 23, 2015

http://tools.ietf.org/html/rfc3493#section-6.1 says the functions are thread safe. There shouldn't be much of an issue, we just need to treat the returned pointer to linked list as an owned pointer. LookupHost is trivially Sync because we can't access anything of its internals through a &self.

@GuillaumeGomez
Copy link
Member Author

Well, I guess it will be quick to check then.

@alexcrichton
Copy link
Member

@bors: r+ 8529d75

Yeah reading through the docs seems to indicating nothing thread-unsafe about these functions, and regardless of the interaction between getenv, getaddrinfo, and setenv it doesn't affect the actual iterator itself.

@GuillaumeGomez
Copy link
Member Author

@alexcrichton: Hold on ! Shouldn't I add tests ?

@alexcrichton
Copy link
Member

Sure, feel free to add an amendment which adds those tests.

@nagisa
Copy link
Member

nagisa commented Aug 24, 2015

Wow this took quite a while to happen.

@GuillaumeGomez
Copy link
Member Author

@nagisa: It took me a while to find what I was looking for. ^^'

@alexcrichton
Copy link
Member

@bors: r- (gonna add a test)

@alexcrichton
Copy link
Member

@bors: r+ 528d99c

@bors
Copy link
Contributor

bors commented Aug 25, 2015

⌛ Testing commit 528d99c with merge 656c3ac...

bors added a commit that referenced this pull request Aug 25, 2015
Part of #22709.
cc @Veedrac

r? @bluss

I don't have added tests yet, I'll see how to do it tomorrow.
@bors bors merged commit 528d99c into rust-lang:master Aug 25, 2015
@GuillaumeGomez GuillaumeGomez deleted the iterator branch August 26, 2015 21:50
($ctor:expr, $($iter:ident),+) => ({
$(
let mut x = $ctor;
is_sync(x.$iter());
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems wrong. You're testing whether the return value of <LookupHost as Iterator>::next is Send/Sync. Shouldn't you be testing LookupHost directly? That would be IntoIter<SocketAddr> now, I think.

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.

6 participants