Skip to content

support definition of local endpoint for cleartext client session#1204

Closed
akonskarm wants to merge 1 commit intonghttp2:masterfrom
akonskarm:master
Closed

support definition of local endpoint for cleartext client session#1204
akonskarm wants to merge 1 commit intonghttp2:masterfrom
akonskarm:master

Conversation

@akonskarm
Copy link
Copy Markdown

No description provided.

Comment thread src/asio_client_session_tcp_impl.cc Outdated
boost::asio::io_service &io_service, const boost::asio::ip::tcp::endpoint &local_endpoint,
const std::string &host, const std::string &service,
const boost::posix_time::time_duration &connect_timeout)
: session_impl(io_service, connect_timeout), socket_(io_service) {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like local_endpoint is not used.

@akonskarm
Copy link
Copy Markdown
Author

Hi Tatsuhiro.

Sorry for my mistake, I force-pushed the fix.

Let me know if it's alright now.

Best
A.

const std::string &host, const std::string &service)
: impl_(std::make_shared<session_tcp_impl>(
io_service, host, service, boost::posix_time::seconds(60))) {
impl_->start_resolve(host, service);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

local_endpoint is still not used. Should I assume that you just added session_tcp_impl::session_tcp_impl ctor which takes local_endpont and didn't fully implement it so that it can be used by public interface?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Tatsuhiro, thanks for your patience. I keep doing the merge wrong.

Best
A.

@akonskarm
Copy link
Copy Markdown
Author

I hope the merge was correct now

Best
A.

Comment thread src/asio_client_session_tcp_impl.cc Outdated
self->connected(endpoint_it);
});
self->connected(endpoint_it);
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are these changes necessary? It looks like nothing to do with local endpoint.

@akonskarm
Copy link
Copy Markdown
Author

Hi Tatsuhiro

Fixed the whitespace.

Best
A.

[self](const boost::system::error_code &ec,
tcp::resolver::iterator endpoint_it) {
socket_.async_connect(*endpoint_it,
[self,endpoint_it](const boost::system::error_code& ec) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do you change this line? Doesn't boost::asio::async_connect work for you?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi Tatsuhiro

The issue with boost::asio::async_connect is that it's going to close and reopen the connection, so the local ip will be unbound.

Please check this thread: https://stackoverflow.com/questions/20890703/how-to-use-a-specfic-networkinterface-ip-with-boost-asio-sockets

Best
A.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got it. Thanks.

@tatsuhiro-t
Copy link
Copy Markdown
Member

Cherry-picked as 7e06ac1
Thank you for PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants