Boost logo

Boost Users :

From: Sunsawe (sunsawe_at_[hidden])
Date: 2007-06-21 02:37:51


Well...
To know where this thing was coming from, i just started to comment out each
line of code and tested what was happenning.
I finally commented out all the code and the error was still there. Then
figured out that the error is appearing as soon as my code includes:

#include <boost/asio/ssl.hpp>

I moved it in different .h files and the effect was the same evenif i am not
using no more anything with ssl.

Does it help someone to explain?

Thanks

Sunsawe wrote:
>
> Hi,I'm new to boost and asio. I'm trying to use the ssl support of asio in
> a simple client.This is the code that i'm using to connect to the server:
> boost::asio::io_service io_service; boost::asio::ssl::context * ctx;
> boost::asio::ssl::stream<boost::asio::ip::tcp::socket> * socket;
> boost::asio::error Error; boost::asio::ip::tcp::resolver
> resolver(io_service); boost::asio::ip::tcp::resolver::query
> query(boost::asio::ip::tcp::v4(),hostname,port );
> boost::asio::ip::tcp::resolver::iterator endpoint_iterator =
> resolver.resolve(query,boost::asio::assign_error(Error));
> boost::asio::ip::tcp::resolver::iterator end; if(Error)
> return false; ctx = new boost::asio::ssl::context(io_service,
> boost::asio::ssl::context::sslv23); boost::asio::ip::tcp::endpoint
> endpoint = *endpoint_iterator; socket = new
> boost::asio::ssl::stream<boost::asio::ip::tcp::socket>(io_service,*ctx);
> Error = boost::asio::error::host_not_found; while (Error &&
> endpoint_iterator != end) {
> socket->lowest_layer().close();
> socket->lowest_layer().connect(endpoint,boost::asio::assign_error(Error));
> } if (Error) return false;
> socket->handshake(boost::asio::ssl::stream_base::client,boost::asio::assign_error(Error));
> if (Error) return false; else return true;That compiles
> fine but at run time i have this assertion exception:Assertion
> failed!Program:... //it is written like thatFile:
> (PATH)\boost-1_33_1\...\shared_ptr.hLine: 253Expression: px != 0I'm using
> vs2005. i can't see what is happening because evenif i'm using the "Step
> Into new Instance" mode to run the program in debug mode, the exception is
> fired before any step. This is the call stack: msvcr80d.dll!_wassert(const
> wchar_t * expr=0x0093888c, const wchar_t * filename=0x009388a0, unsigned
> int lineno=253) Line 384 C
> CTest.exe!boost::shared_ptr<boost::asio::ssl::detail::openssl_init<1>::do_init>::operator->()
> Line 253 + 0x1f bytes C++
> CTest.exe!boost::asio::ssl::detail::openssl_init<1>::do_init::openssl_locking_func(int
> mode=5, int n=16, const char * file=0x009401dc, int line=271) Line 83 +
> 0x37 bytes C++ CTest.exe!_CRYPTO_lock() + 0x81 bytes C
> CTest.exe!_ssl_load_ciphers() + 0x113 bytes C
> CTest.exe!_SSL_COMP_get_compression_methods() + 0x5 bytes C
> CTest.exe!_SSL_library_init() + 0x129 bytes C
> CTest.exe!boost::asio::ssl::detail::openssl_init<1>::do_init::do_init()
> Line 57 C++
> CTest.exe!boost::asio::ssl::detail::openssl_init<1>::do_init::instance()
> Line 74 + 0x4a bytes C++
> CTest.exe!boost::asio::ssl::detail::openssl_init<1>::openssl_init<1>()
> Line 96 + 0x5a bytes C++ CTest.exe!`dynamic initializer for
> 'boost::asio::ssl::detail::openssl_init<1>::instance_''() Line 69 + 0x28
> bytes C++ msvcr80d.dll!_initterm(void (void)* * pfbegin=0x00937234,
> void (void)* * pfend=0x00937f0c) Line 855 C
> CTest.exe!__tmainCRTStartup() Line 501 + 0xf bytes C
> CTest.exe!WinMainCRTStartup() Line 403 C kernel32.dll!7c816ff7()
> [Frames below may be incorrect and/or missing, no symbols loaded for
> kernel32.dll]
> CTest.exe!boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>::basic_endpoint<boost::asio::ip::tcp>(const
> boost::asio::ip::address & addr={...}, unsigned short port_num=111) Line
> 155 + 0x21 bytes C++
> CTest.exe!boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>::basic_endpoint<boost::asio::ip::tcp>(const
> boost::asio::ip::address & addr={...}, unsigned short port_num=115) Line
> 155 + 0x21 bytes C++
> CTest.exe!boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>::basic_endpoint<boost::asio::ip::tcp>(const
> boost::asio::ip::address & addr={...}, unsigned short port_num=111) Line
> 155 + 0x42 bytes C++
> CTest.exe!boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>::basic_endpoint<boost::asio::ip::tcp>(const
> boost::asio::ip::address & addr={...}, unsigned short port_num=54) Line
> 155 + 0x21 bytes C++ CTest.exe!wxFileName::Assign(const wxFileName &
> filepath={...}) Line 310 C++
> CTest.exe!boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>::basic_endpoint<boost::asio::ip::tcp>(const
> boost::asio::ip::address & addr={...}, unsigned short port_num=111) Line
> 155 + 0x42 bytes C++
> CTest.exe!boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>::basic_endpoint<boost::asio::ip::tcp>(const
> boost::asio::ip::address & addr={...}, unsigned short port_num=54) Line
> 155 + 0x21 bytes C++ CTest.exe!wxFileName::Assign(const wxFileName &
> filepath={...}) Line 310 C++
> CTest.exe!boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>::basic_endpoint<boost::asio::ip::tcp>(const
> boost::asio::ip::address & addr={...}, unsigned short port_num=57) Line
> 155 + 0x42 bytes C++ CTest.exe!_RSA_padding_check_PKCS1_type_1() +
> 0xf2 bytes C
> CTest.exe!boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>::basic_endpoint<boost::asio::ip::tcp>(const
> boost::asio::ip::address & addr={...}, unsigned short port_num=897) Line
> 155 + 0x21 bytes C++ 02840448() dbghelp.dll!03020004() Can somebody
> tell me what i'm doing wrong?Thanks
> _________________________________________________________________
> David Guetta a réuni les sons les plus connus de Messenger dans le Mix
> Messenger, le son de l’été ! Téléchargez-le gratuitement !
> http://specials.divertissements.fr.msn.com/mixmessenger
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
View this message in context: http://www.nabble.com/-asio--Assertion-failed-at-run-time-tf3940290.html#a11227475
Sent from the Boost - Users mailing list archive at Nabble.com.

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