|
Boost Users : |
Subject: [Boost-users] Access violation while deleting ssl socket
From: Martinell, Dan F (Dan.F.Martinell_at_[hidden])
Date: 2013-05-03 18:48:02
I just upgraded the boost libraries from 1.43 to 1.53 and switched from a 32bit build to a 64bit build. The code worked fine before the upgrade but in 1.53 I am getting an out of access violation while trying to delete the sslSocket.
Here is a sample of the code:
ssl::stream<ip::tcp::socket>* sslSocket = (ssl::stream<ip::tcp::socket>*) NULL;
sslSocket = new ssl::stream<ip::tcp::socket>(io_service, ctx);
sslSocket->lowest_layer().connect(*endpoint_iterator, error);
sslSocket->handshake(ssl::stream_base::client);
sslSocket->shutdown();
delete sslSocket; //This throws the exception
I also tried doing this and several variations of it but I still have the same issue:
sslSocket->lowest_layer().cancel();
sslSocket->lowest_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_both,EC);
sslSocket->lowest_layer().close();
delete sslSocket;
I read through the documentation and the examples but didn't see anything that describes how to do this properly. Does anyone know why this wouldn't work or the proper way to close the SSL connection? I can provide more of the code if that would be helpful.
Thanks,
Dan Martinell
Application Security
Boeing Information Security
cell: 425-283-6712
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net