Discussion:
[asio-users] from 1.49 to 1.54 upgrade connect handler behavior change
Tolga Ceylan
2013-08-27 19:07:00 UTC
Permalink
Hi all;

I'm running asio on a CentOS 64 bit machine. The code base has been tested
over a year now
and when I upgraded from 1.49 to 1.54, I see a behavior change when an
async connect is scheduled
for the socket. ( client TCP socket without SSL )

When the handler used to fire, you'd know the socket is connected and you
could fetch the remote end point
for logging purposes.

But now, the remote_endpoint() throws an exception if the socket is not
connected.

The error passed to the handler is not set. And is_open() is true...

Is this expected behavior?

I think this is OK since the socket can drop to disconnected state any
time.

But I need to have a way of fetching/checking remote endpoint without
triggering any exceptions.

Cheers,
Tolga
Tolga Ceylan
2013-08-27 19:27:42 UTC
Permalink
Oh I see, remote_endpoint(boost::system::error_code& ec).

Problem solved!
Post by Tolga Ceylan
Hi all;
I'm running asio on a CentOS 64 bit machine. The code base has been tested
over a year now
and when I upgraded from 1.49 to 1.54, I see a behavior change when an
async connect is scheduled
for the socket. ( client TCP socket without SSL )
When the handler used to fire, you'd know the socket is connected and you
could fetch the remote end point
for logging purposes.
But now, the remote_endpoint() throws an exception if the socket is not
connected.
The error passed to the handler is not set. And is_open() is true...
Is this expected behavior?
I think this is OK since the socket can drop to disconnected state any
time.
But I need to have a way of fetching/checking remote endpoint without
triggering any exceptions.
Cheers,
Tolga
Loading...